本文へスキップ
Skillpedia
セキュリティ6.5k · #14161

anti-debug-bypass

できること

このスキルは、プログラムに見られる一般的なアンチデバッグやアンチVMの確認と、分析者がそれを検証環境でどう扱うかを説明します。保護されたプログラムや悪意のあるソフトウェアを調べるリバースエンジニア向けです。

使う場面

  • ✓デバッガーが接続されるとプログラムが終了したり、動作が変わったりすることを分析者が見つけたとき。
  • ✓リサーチャーが、サンプルがどのアンチデバッグの確認を使っているかを特定したいとき。
  • ✓チームが保護されたプログラムを調べており、仮想マシンへの反応を確認する必要があるとき。

スキルのリンク

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/reverser/anti-debug-bypass/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/reverser/anti-debug-bypass/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“デバッガーを接続すると、このプログラムが動作を止めます。その理由を調べるにはどうすればよいですか?”

毎週5つの新しいスキル。1分で読めます。

仕組み

このスキルは、一般的な確認を一覧にし、プログラム内でそれらを探す方法を示し、分析中にそれぞれがどう扱われるかを説明します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Anti-Debug Bypass Playbook

Malware and protected commercial software check for debuggers and sandboxes before running real logic. Bypassing these checks is required to dynamically analyze them. Each check has a known counter.

1. Enumerate anti-debug techniques in the binary

Static signature scan

# Windows API calls
strings /tmp/sample | grep -iE 'IsDebuggerPresent|NtQuery|CheckRemoteDebugger|OutputDebugString'

# Linux ptrace check
strings /tmp/sample | grep -iE 'ptrace|/proc/self/status|TracerPid'

# CPUID hypervisor check
strings /tmp/sample | grep -iE 'vmware|VirtualBox|qemu|xen'

# Detect via YARA rules
yara -r /opt/yara-rules/anti_debug.yar /tmp/sample

Decepticon helper:

bin_anti_debug_scan("/tmp/sample")

2. Common checks + bypasses

Windows checks

Check What it does Bypass
IsDebuggerPresent() reads PEB.BeingDebugged byte Set PEB.BeingDebugged = 0 in debugger; ScyllaHide handles
CheckRemoteDebuggerPresent() calls NtQueryInformationProcess(ProcessDebugPort) Patch return to FALSE; ScyllaHide hooks the syscall
NtQueryInformationProcess(ProcessDebugPort) returns nonzero if debugger attached Hook + return 0
NtQueryInformationProcess(ProcessDebugFlags) returns 0 if debugger, 1 if not Force return 1
NtQueryInformationProcess(ProcessDebugObjectHandle) nonzero handle if attached Force NULL
PEB.NtGlobalFlag 0x70 if heap debugging Set to 0
PEB.HeapFlags & PEB.ForceFlags non-default if debugger Reset to defaults
NtSetInformationThread(ThreadHideFromDebugger) unhook debugger from thread Hook NtSetInformationThread
INT 2D / INT 3 exception handling normal flow if no debugger Set exception handler in debugger
Hardware breakpoint detection (GetThreadContext check) reads DR0-3, fails if BPs set Use software BPs, or zero DRs before check

ScyllaHide (x64dbg/x32dbg/IDA plugin) handles essentially all of these automatically.

Linux checks

Check What it does Bypass
ptrace(PTRACE_TRACEME) fails if already traced Run w/o ptrace, or use LD_PRELOAD to hook
Read /proc/self/status TracerPid: nonzero if debugger LD_PRELOAD hook reading; or modify /proc on a fork
prctl(PR_SET_DUMPABLE, 0) prevents gdb attach Patch out the prctl
getppid() parent process name if it's gdb/strace rename gdb binary, or LD_PRELOAD getppid
Timing checks via rdtsc measures execution time Use gdb's set $rax = ... to fake; or patch rdtsc out

LD_PRELOAD bypass example

// bypass.c
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <sys/ptrace.h>
#include <string.h>

long ptrace(int request, int pid, void *addr, void *data) {
    return 0;  // pretend it always succeeds
}

FILE *fopen(const char *path, const char *mode) {
    static FILE *(*orig)(const char *, const char *) = NULL;
    if (!orig) orig = dlsym(RTLD_NEXT, "fopen");
    if (strstr(path, "/proc/self/status") || strstr(path, "/proc/self/stat")) {
        // Return a doctored file
        FILE *tmp = tmpfile();
        fprintf(tmp, "TracerPid:\t0\n");
        rewind(tmp);
        return tmp;
    }
    return orig(path, mode);
}
gcc -shared -fPIC bypass.c -o bypass.so -ldl
LD_PRELOAD=./bypass.so gdb /tmp/sample

3. Anti-VM / sandbox detection

Check Bypass
CPUID leaf 0x40000000 (hypervisor bit) Mask CPUID via KVM -cpu host,-hypervisor or VMM config
VMware backdoor 0x564D5868 magic via IN/OUT Patch the magic number check
MAC address vendor (00:0C:29 = VMware) Spoof MAC in VM config
Disk size < 50GB Allocate larger disk for the analysis VM
RAM < 2GB Provision more RAM
Username sandbox, vagrant, virtual Change username in analysis env
Recent file count low Pre-populate Documents folder before run
Mouse cursor never moves Use xdotool to inject mouse jitter
Process count, uptime, kernel objects Boot the VM a while before analysis

4. Dynamic bypass via debugger

x64dbg / x32dbg (Windows)

  1. Install ScyllaHide plugin
  2. In the plugin, enable all checks (PEB patches, NtSetInformation hooks, etc)
  3. Open the binary, set BP at entry → continue
  4. ScyllaHide neutralizes most checks transparently

IDA Pro

  • Built-in remote debugger + IDAStealth plugin
  • For step-tracing through anti-debug: `Debugger options → Suspend on library load
よくある質問

どの確認を扱っていますか?

Windowsのデバッガー確認、Linuxのptrace確認、仮想マシンの検出を扱っています。

分析者にとって、なぜ必要ですか?

分析ツールを検出すると動作を隠すプログラムがあるため、まずこれらの確認を理解する必要があるからです。

他人から活動を隠すためのものですか?

いいえ。検証環境でプログラムの動作を理解するための分析作業に関するものです。

詳細

作者による元の説明

Detect and neutralize anti-debug / anti-VM checks — IsDebuggerPresent, ptrace, NtGlobalFlag, timing, hardware-breakpoint detection.

repo: BitterSecurity/Decepticon

人気

GitHubのスター
6.5k
ランキング
#14161
ライセンス
Apache-2.0
更新日
2026/11/1

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル