$npx -y skills add meltedinhex/analyst-ai-pack --skill bypassing-anti-vm-and-sandbox-checksBypasses anti-VM and sandbox checks during analysis by locating the specific detection
| 1 | # Bypassing Anti-VM and Sandbox Checks |
| 2 | |
| 3 | ## When to Use |
| 4 | |
| 5 | - An evasive sample refuses to detonate under analysis and you need to locate and neutralize its |
| 6 | anti-VM/sandbox checks (artifact strings, timing stalls, CPUID hypervisor bit, MAC/registry |
| 7 | checks). |
| 8 | - You are planning patches or environment hardening to force execution. |
| 9 | |
| 10 | **Do not use** patching as a shortcut that changes malicious logic — patch only the evasion gate. |
| 11 | Run only in an isolated, instrumented VM with snapshots. |
| 12 | |
| 13 | ## Prerequisites |
| 14 | |
| 15 | - The sample and a debugger/disassembler on an isolated VM. |
| 16 | |
| 17 | ## Safety & Handling |
| 18 | |
| 19 | - The sample executes during bypass work; use a disposable, snapshotted, network-controlled VM. |
| 20 | |
| 21 | ## Workflow |
| 22 | |
| 23 | ### Step 1: Locate the evasion checks |
| 24 | |
| 25 | ```bash |
| 26 | python scripts/analyst.py locate sample.bin |
| 27 | ``` |
| 28 | |
| 29 | Reports offsets of anti-VM artifact strings, timing APIs (`GetTickCount`, `rdtsc`), CPUID usage, |
| 30 | and environment-fingerprint APIs to point you at the detection routines. |
| 31 | |
| 32 | ### Step 2: Plan the bypass |
| 33 | |
| 34 | For each check decide the approach: patch the conditional jump after the check, hook/stub the API |
| 35 | to return benign values, or harden the VM (rename adapters, patch registry, add fake processes). |
| 36 | |
| 37 | ### Step 3: Apply and verify |
| 38 | |
| 39 | Patch the gate (e.g., force the "not detected" branch) and confirm the sample proceeds past the |
| 40 | check. |
| 41 | |
| 42 | ### Step 4: Document |
| 43 | |
| 44 | Record each check, its offset, and the bypass applied for reproducibility. |
| 45 | |
| 46 | ## Validation |
| 47 | |
| 48 | - Each located check maps to a real detection primitive (string/timing/CPUID/API). |
| 49 | - The patched/hooked gate provably lets execution continue. |
| 50 | - Only the evasion gate is altered, not the payload logic. |
| 51 | |
| 52 | ## Pitfalls |
| 53 | |
| 54 | - Multiple layered checks — bypassing one is not enough. |
| 55 | - Timing checks needing instruction-accurate handling (`rdtsc` deltas). |
| 56 | - Anti-tamper detecting the patch; prefer hooking returns over byte patches when fragile. |
| 57 | |
| 58 | ## References |
| 59 | |
| 60 | - See [`references/api-reference.md`](references/api-reference.md) for the locator. |
| 61 | - ATT&CK T1497 and the CPUID hypervisor bit reference (linked in frontmatter). |