XingLo SkillSearch

恶意程序反分析绕过辅助

用于在授权分析环境中处理恶意程序的反调试、虚拟机检测、沙箱识别和时间检查等防分析机制,提供二进制补丁、环境伪装和行为验证思路。适合样本检测到VM或调试器后直接退出、休眠或隐藏关键行为的情况,目标是恢复其真实恶意逻辑以便继续分析。

在 AI 中使用此 Skill将本页链接复制给 AI,即可让 AI 获取完整 Skill 内容并按此执行
安全提示: 本站 Skill 均经 ChatGPT 最新模型扫描,未发现恶意脚本及危险指令、未检出已知恶意行为特征,但不保证绝对安全,使用即表示接受此风险

Skill 文件

版本 20260301 · d2d61eae07900d2e945ef5857d9490a1

references/
scripts/
SKILL.md
---
name: anti-analysis-bypass
description: Defeat malware anti-analysis defenses including anti-debugging, VM detection, sandbox evasion, and timing checks through binary patching and environment masking.
---

# Anti-Analysis Bypass

Defeat malware anti-analysis techniques to enable successful debugging and dynamic analysis. This skill covers identifying and neutralizing anti-debugging, VM detection, sandbox evasion, and timing-based checks.

## Prerequisites

- **Python 3.10+** for running patching and environment setup scripts
- **capa**: Mandiant capability scanner for identifying anti-analysis techniques
- **x64dbg** with **ScyllaHide** plugin: Debugger with anti-detection capabilities
- **TitanHide**: Kernel-level debugger hiding driver (optional)
- **Disassembler** (IDA Pro or Ghidra): For manual binary patching and analysis

## Steps

### 1. Identify Anti-Analysis Techniques

Before patching, identify which anti-analysis techniques the sample uses:

- Run `capa sample.exe` and look for capabilities under "anti-analysis" categories
- Search for known API imports: `IsDebuggerPresent`, `NtQueryInformationProcess`, `GetTickCount`, `QueryPerformanceCounter`, `NtQuerySystemInformation`
- Check for environment queries: registry reads for VM artifacts, WMI queries, hardware checks
- Consult `references/bypass-techniques.md` for a comprehensive list of techniques and indicators

### 2. Patch Anti-Debug Checks in the Binary

Use the automated patching script to neutralize common anti-debugging checks:

```bash
python3 scripts/patch_anti_debug.py --input sample.exe --output sample_patched.exe
```

Options:
- `--techniques all` (default) or specify: `isdebuggerpresent,peb,timing,ntquery`
- `--backup` creates a backup of the original (enabled by default)
- `--dry-run` shows what would be patched without modifying the file
- `--verbose` shows detailed information about each patch

See `references/binary-patching.md` for manual patching techniques.

### 3. Prepare the Analysis Environment

Make the analysis VM appear like a real user workstation:

```bash
python3 scripts/env_setup.py --profile corporate
```

This script:
- Creates realistic user files (documents, downloads, browser history)
- Sets a realistic hostname and username
- Adjusts screen resolution to common values
- Modifies MAC address prefix to non-VM vendor
- Populates recent files and registry artifacts (Windows)
- Creates running process list matching a real desktop

Profiles: `corporate`, `home`, `developer`, `minimal`

### 4. Apply Runtime Bypass Techniques

During debugging, apply these runtime techniques:

- **ScyllaHide** (x64dbg plugin): Hides debugger from most detection methods
- **TitanHide**: Kernel-level debugger hiding
- **Manually set PEB.BeingDebugged = 0**: In debugger, navigate to PEB and zero the flag

### 5. Handle Timing Checks

For timing-based anti-analysis:
- The patching script NOPs out `GetTickCount`, `QueryPerformanceCounter`, and `rdtsc` checks
- Alternatively, use the Hacker disassembler / Single-step breakpoint approach
- For `Sleep` bombs: patch `Sleep` calls to reduce or eliminate delays

### 6. Verify Bypass Effectiveness

After patching and environment setup:
1. Run the patched sample and confirm it executes its payload
2. Compare behavior with the original sample to verify no functionality was lost
3. Monitor for secondary anti-analysis checks that may trigger after the first layer

## References

- `references/bypass-techniques.md` — Anti-analysis bypass reference by technique type
- `references/binary-patching.md` — Binary patching guide for analysis