Disassembler Evasion

December 27, 2024 ยท View on GitHub

ID B0012
Objective(s) Anti-Static Analysis
Related ATT&CK Techniques None
Anti-Analysis Type Evasion
Version 2.3
Created 1 August 2019
Last Modified 27 December 2024

Disassembler Evasion

Anti-disassembly techniques take advantage of weaknesses in either flow-oriented (also referred to as recursive) or linear disassembler algorithms, resulting in inaccurate or incomplete disassembly or the disassembly process halting with an error. Reportedly, the most common anti-disassembly technique is one that employs two consecutive conditional jump instructions (jz followed by jnz) that point to the same target address [1].

Methods

NameIDDescription
Argument ObfuscationB0012.001Simple number or string arguments to API calls are calculated at runtime, making linear disassembly more difficult.
Conditional MisdirectionB0012.002Conditional jumps are sometimes used to confuse disassembly engines, resulting in the wrong instruction boundaries and thus wrong mnemonic and operands; may be identified by instructions jmp/jcc to a label+# (e.g., JNE loc_401345fe+2).
Desynchronizing Opaque PredicatesB0012.006Opaque predicates inject superfluous branches into the disassembly, resulting in disassembly desynchronization, as well as code bloat. The junk bytes introduced damage the disassembly process when the bytes are treated as code. [6] This method is related to Unprotect technique U0201.
Fake FunctionB0012.007A fake function call is used to call an address which confuses a disassembler and results in incorrect disassembly. Manually undefining the function call can enable the disassembler to produce the true code.
pusha/popa SequenceB0012.008Malware uses excessive pusha and popa instructions to confuse disassemblers.
VBA StompingB0012.005Typically, VBA source code is compiled into p-code, which is stored with compressed sourced code in the OLE file with VBA macros. VBA Stomping - when the VBA source code is removed and only the p-code remains - makes analysis much harder. See [4] for an analysis of a VBA-Stomped malicious VBA Office document. See [5] for information on Evil Clippy, a tool that creates malicious MS Office documents.
Value Dependent JumpsB0012.003Explicit use of computed values for control flow, often in the same basic block or function.

Use in Malware

NameDateMethodDescription
BlackEnergy2007B0012.001BlackEnergy contains obfuscated stack strings. [2] [7]
Hupigon2013B0012.001Hupigon contains obfuscated stack strings. [7]
Rombertik2015B0012.001Rombertik contains obfuscated stack strings. [7]

Detection

Tool: capaMappingAPIs
contain anti-disasm techniquesDisassembler Evasion (B0012)--

References

[1] M. Sikorski and A. Honig, Practical Malware Analysis: The Hands-On Guide to Dissecting Malicious Software, No Starch Press, 2012.

[2] https://web.archive.org/web/20220814013655/http://staff.ustc.edu.cn/~bjhua/courses/security/2014/readings/anti-disas.pdf

[3] https://www.kernelhacking.com/rodrigo/docs/blackhat2012-paper.pdf

[4] https://isc.sans.edu/diary/Malicious+VBA+Office+Document+Without+Source+Code/24870

[5] https://boingboing.net/2019/05/05/p-code-r-us.html

[6] https://www.ndss-symposium.org/wp-content/uploads/2020/04/bar2020-23004-paper.pdf

[7] capa v4.0, analyzed at MITRE on 10/12/2022