🔧 Encoders?
Encoders are used to modify payloads to:
Make them compatible with different processor architectures (x64, x86, sparc, ppc, mips).
Remove bad characters (e.g.,
\x00
).(Previously) evade antivirus detection.
🌐 AV Evasion History
Shikata Ga Nai (SGN): Famous XOR-based polymorphic encoder. Name means "It cannot be helped."
Previously dominant for avoiding AV detection.
Modern AV tools now detect SGN easily.
AV evasion through encoders is now limited due to signature detection improvements.
🔧 Legacy Tooling
Pre-2015: Used
msfpayload
andmsfencode
🚀 Modern Tool: msfvenom
Combines
msfpayload
andmsfencode
Example without encoder:
Example with encoder:
🤖 Encoder Selection in Metasploit
Output:
⚖️ Architecture-Based Filtering
Available encoders depend on the selected payload/module architecture.
Example (MS09-050): More x86-compatible encoders are listed (e.g.,
x86/shikata_ga_nai
,x86/alpha_upper
).
📈 Real-World Encoding Impact
Encoding payloads once with SGN is no longer enough for AV evasion.
Example: Generating EXE payload with one SGN iteration:
VirusTotal: 54/69 detections ❌
🔄 Multi-Iteration Encoding
Final payload size: ~611 bytes
VirusTotal: 52/65 detections ❌
🌐 VirusTotal API Integration
Requires API key from VirusTotal
Useful for quick AV check of generated payloads
📆 Summary
Purpose
Make payloads compatible & optionally evade AV
Legacy Tools
msfpayload + msfencode (pre-2015)
Modern Tool
msfvenom (combined tool)
Common Encoder
x86/shikata_ga_nai (Polymorphic XOR)
Effectiveness
Limited AV evasion nowadays
Extra
Use -i
for multiple iterations to slightly improve AV evasion
Next step: Explore Encoders + Obfuscation + Payload Customization for deeper evasion tactics.
Last updated