Use when dynamically analyzing a binary that may be deliberately evasive — check for anti-debugging, anti-VM, and timing-based analysis-detection logic before trusting the observed behavior, because a binary that detects it's being analyzed and alters its behavior in response will produce results that don't reflect how it behaves in a real, unanalyzed environment.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Apply Anti Analysis Detection Awareness?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/jeffreytse-apply-anti-analysis-detection-awareness)
---
name: apply-anti-analysis-detection-awareness
description: Use when dynamically analyzing a binary that may be deliberately evasive — check for anti-debugging, anti-VM, and timing-based analysis-detection logic before trusting the observed behavior, because a binary that detects it's being analyzed and alters its behavior in response will produce results that don't reflect how it behaves in a real, unanalyzed environment.
source: 'Michael Sikorski & Andrew Honig, "Practical Malware Analysis", No Starch Press (2012) — anti-disassembly, anti-debugging, and anti-VM technique chapters; Peter Ferrie, "The Ultimate Anti-Debugging Reference" (2011)'
tags: [reverse-engineering, anti-analysis, dynamic-analysis, malware-analysis, security]
related: [apply-isolated-analysis-environment, apply-dynamic-instrumentation-over-manual-stepping]
---
# Apply Anti-Analysis Detection Awareness
Check for anti-debugging, anti-VM, and timing-based analysis-detection logic before trusting observed behavior, when dynamically analyzing a binary that may be deliberately evasive — because a binary that detects it's being analyzed and alters its behavior in response will produce results that don't reflect how it behaves in a real, unanalyzed environment.
## Why This Is Best Practice
**Sikorski & Honig, "Practical Malware Analysis" (2012):** Documents a wide range of techniques malware specifically uses to detect debuggers, virtual machines, and sandboxes, and to alter its own behavior (going dormant, exiting early, or running a decoy code path) when analysis is detected — meaning that an analysis result obtained under detected conditions can directly misrepresent the binary's actual, real-world behavior rather than merely being incomplete.
**Ferrie, "The Ultimate Anti-Debugging Reference" (2011):** A comprehensive, widely-referenced catalog of specific anti-debugging techniques (timing checks, debugger-presence API calls, exception-based detection, hardware breakpoint detection) that establishes these checks as a well-documented, recurring category an analyst needs to specifically check for, not a rare edge case.
**Why best:** The entire premise of dynamic analysis is that observed runtime behavior reflects actual behavior. A sample that detects analysis and specifically suppresses or alters its malicious behavior in response breaks that premise silently — the analyst sees a clean or benign-looking run and may conclude the sample is harmless, when the correct conclusion is that the sample successfully evaded the specific analysis environment used. Checking for detection logic before trusting results is what prevents this specific, high-consequence misread.
**Adopted by:** Standard caution taught in SANS FOR610 and built into modern malware-analysis sandboxes, many of which specifically harden their environments (patching common VM-detection artifacts, randomizing timing) to reduce the rate of successful evasion.
**Impact:** Documented malware families routinely include VM/sandbox-detection logic specifically because analysts' use of virtualized and debugged environments is well known to malware authors — an unhardened default sandbox configuration can produce a false "benign" verdict for a sample that behaves very differently outside the detected environment.
## Steps
1. **Check for common anti-debugging API calls and patterns** (`IsDebuggerPresent`, `CheckRemoteDebuggerPresent`, manual PEB-flag checks, timing-based checks around suspicious instruction sequences) during static analysis, before dynamic analysis begins.
2. **Check for VM/sandbox-detection artifacts** (known hypervisor-specific registry keys, MAC address prefixes, specific device or driver names, CPUID-based hypervisor detection) that the sample might query.
3. **If detection logic is found, neutralize or patch it before relying on the resulting dynamic analysis** — this may mean patching the specific check, using an analysis environment hardened against the detected artifact, or using dynamic instrumentation to force the check's result.
4. **Treat a suspiciously "clean" or inactive dynamic-analysis result with specific suspicion when the static analysis already suggested malicious capability** — a mismatch between static indicators and observed dynamic behavior is itself a signal of likely evasion.
5. **Re-run analysis in a hardened or alternate environment** if evasion is suspected, to see whether behavior changes meaningfully between environments — a behavior difference across environments is strong evidence of environment-aware evasion logic.
6. **Document which specific anti-analysis techniques were found and how they were bypassed**, so the finding transfers to future analysis of the same family or related samples.
## Rules
- Don't trust a dynamic-analysis result as representative of real-world behavior without first checking whether the sample has the means to detect the analysis environment.
- Treat a mismatch between static-analysis capability indicators and observed dynamic behavior as a specific signal to investigate for evasion, not as evidence the static indicators were simply wrong.
- When detection logic is found, neutralize it before drawing conclusions from the dynamic run, rather than working around it informally or ignoring it.
- Document anti-analysis findings specifically, since the same evasion techniques frequently recur across samples from the same family or toolkit.
## Examples
**Correctly identified evasion:** An analyst's static analysis flags imports consistent with keylogging capability, but a first dynamic run in a standard VM shows no keylogging behavior at all. Recognizing the mismatch, the analyst checks for VM-detection logic, finds a check against a known hypervisor-specific registry key, patches the check, re-runs the sample, and observes the keylogging behavior the static indicators predicted.
**Undetected-evasion failure mode (contrast case):** An analyst runs a sample in a standard, unhardened sandbox, observes no malicious behavior, and reports the sample as likely benign — without checking for anti-VM logic. The sample was in fact successfully detecting the sandboxed environment and suppressing its real behavior, producing an incorrect benign verdict that a specific anti-analysis check would have caught.
## Common Mistakes
- **Concluding a sample is benign from a single dynamic-analysis run without checking for anti-analysis logic first**, especially when static indicators suggested otherwise.
- **Running dynamic analysis in a default, unhardened sandbox configuration** known to be detectable by common VM-fingerprinting techniques.
- **Not re-testing in an alternate or hardened environment when a static/dynamic behavior mismatch is observed**, missing the opportunity to confirm or rule out evasion directly.
- **Patching an anti-analysis check without documenting what was found and how**, losing the finding's value for analyzing related samples later.
## When NOT to Use
- For software already confirmed to be non-evasive, non-malicious, and of known provenance — routine debugging of trusted software doesn't need anti-analysis-detection checking.
- When static analysis has already established, with high confidence, exactly what the sample does and dynamic confirmation is purely a formality — the specific concern this skill addresses (a misleading dynamic result) matters less when the conclusion doesn't depend on the dynamic run.
- In fully automated, high-volume sample triage where the bottleneck is throughput rather than depth — in that case, a sandbox's statistical evasion-detection rate is a design/tooling investment decision rather than something to check manually per-sample.