Get the Whitepaper called Metasploit: Low Level View. It touches on topics such as code injection and malware detection evasion / Metasploit encoders.
You can download it from the following link: https://packetstormsecurity.com/files/download/110259/metasploit-lowlevel.pdf
Source: https://packetstormsecurity.com/files/110259/Metasploit-Low-Level-View.html

