On-Disk Detection: Bypass AV’s/EDR’s using syscalls with legacy instruction, series of instructions and random nop instructions
The author found that their binary using direct syscalls was detected by Microsoft Defender because the binary contained the 'syscall' instruction. They bypassed on-disk detection by replacing the syscall instruction with the legacy 'int 2Eh' instruction, adding a series of instructions to avoid pattern detection, and inserting random nop instructions.
Published on systemweakness.com
Hi everyone, today I am going to explain some techniques to bypass AV/EDR’s static as well as dynamic detection. The main focus is to bypass on-disk detection of binary which is using direct syscalls.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the antivirus/EDR detected the binary because it contained the 'syscall' instruction, which is a common indicator of direct syscall usage in malware.
What the attacker needed
Ability to compile C++ and assembly code; Knowledge of direct syscalls and SysWhispers2; Access to a Windows system with Defender
How it was found
- Compile a C++ binary that uses direct syscalls for process injection.
- Observe that Microsoft Defender detects the binary on disk.
- Use objdump to find the 'syscall' instruction in the binary.
- Replace the 'syscall' instruction with the legacy 'int 2Eh' instruction.
- Add a series of instructions to avoid pattern detection.
- Insert random nop instructions before the syscall.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
This is a write-up about evading antivirus and endpoint detection and response (EDR) tools. The author shows that security software can detect malicious programs by looking for specific machine code instructions, such as the 'syscall' instruction. By changing how the program asks the operating system to do things, using older or obfuscated instructions, the program can avoid being flagged.