CFG Flattening with CMOV: Antivirus & EDR Evasion via Control Flow Obfuscation in x64 Assembly

Static analysis tools and AI-driven EDRs map malicious behavior through branching instructions — JMP, JZ, JNZ form the edges of a Control Flow Graph that heuristic engines traverse. CMOV-based CFG flattening removes all conditional branches, collapsing the graph to a single flat node sequence that defeats both signature-based and ML-based detection. Full x64 Assembly implementation: branch-free syscall obfuscation, CMOV patterns for JZ/JNZ/JLE replacement, and empirical bypass results against NGAV and Ghidra CFG analysis.

April 15, 2026 · 13 min · JM00NJ

Position Independent Code (PIC) in x64 Assembly: Stack Anchor Technique, Sectionless Shellcode & ASLR-Safe Payloads

Standard Assembly code with absolute addresses breaks under ASLR — fixed addresses become invalid at runtime. PIC solves this via RIP-relative addressing: all memory references computed as offsets from the current instruction pointer. The Stack Anchor technique carves a 32KB R/W region (sub rsp,0x8000 + and rsp,-16 + mov rbp,rsp), providing writable storage without .data or .bss sections. Read-only templates in .text are copied to the stack via rep movsb for runtime modification. Result: a single position-independent code block deployable anywhere in memory — standard for shellcode, injection payloads, and fileless implants.

April 3, 2026 · 5 min · JM00NJ
DigitalOcean Referral Badge