ptn1411/skill/anti-debugging-techniques

Claude Code and agent skill by ptn1411/skill

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Anti-debug detection and bypass for protected binaries. Activate before patching commercial apps that use ptrace/PEB/timing/exception checks on Linux or Windows.

Install

npx vskill@latest install ptn1411/skill/anti-debugging-techniques

SKILL.md

Anti-Debugging Techniques

Upstream reference: yaklang/hack-skills/anti-debugging-techniques — distilled from ctf-wiki + hacktricks. Use that page for full prose.
Language rule: instructions in English; final user-facing summary in Vietnamese.

0. Authorization & routing

Operates under MASTER_POLICY.md §1-§2 (owner-attested target, granted technical authority).

Run this skill before [binary-patcher](../binary-patcher/SKILL.md) on any commercial-grade binary — patches misfire when anti-debug watchdogs are still live.

Sibling skillWhen
binary-identifierFirst — fingerprint protector (VMProtect/Themida ship known anti-debug stacks)
binary-protection-bypassAfter — ASLR/PIE/canary still blocks patch even if debugger is hidden
vm-and-bytecode-reverseWhen the check is implemented inside a custom VM dispatcher
symbolic-execution-toolsSkip checks symbolically with angr instead of patching

1. Detection-class → first-line bypass

ClassLinux primaryWindows primary
API callLD_PRELOAD shim returning 0Hook IsDebuggerPresent / NtQueryInformationProcess
Process flagFilter TracerPid in /proc/self/statusZero PEB BeingDebugged / NtGlobalFlag / heap flags
TimingFrida hook on clock_gettimeFrida hook on rdtsc / QueryPerformanceCounter
Signal / exceptionGDB handle SIGTRAP nostop passVEH handler or ScyllaHide
HW breakpointn/aHook GetThreadContext to clear DR0–DR3
Multi-process watchdogGDB set follow-fork-mode childAttach to both processes

2. Linux check signatures (grep-able)

text
ptrace( # PTRACE_TRACEME self-attach
fopen("/proc/self/status" # TracerPid scan
fopen("/proc/self/maps" # Frida/LD_PRELOAD scan
rdtsc # timing measurement
signal(SIGTRAP # signal-swallowed test
fork() # potential watchdog parent/child

3. Windows PEB + Nt* offsets (x64)

FieldLocationDebuggedClean
BeingDebuggedPEB+0x0210
NtGlobalFlagPEB+0xBC0x700
ProcessHeap.FlagsHeap+0x400x400000620x00000002
ProcessHeap.ForceFlagsHeap+0x440x400000600

NtQueryInformationProcess info-class IDs: ProcessDebugPort=0x07, ProcessDebugObjectHandle=0x1E, ProcessDebugFlags=0x1F (returns 0 when debugged — inverted).

4. Tooling matrix

ToolPlatformUse
ScyllaHideWindows (x64dbg/IDA plugin)One-click PEB/Nt*/timing patch
TitanHideWindows kernel driverKernel-level hide for DR/heap checks
FridaCross-platformScript hooks, timing spoof
LD_PRELOADLinuxptrace/getenv/fopen replacement
GDBLinuxcatch syscall, conditional BP, register fixup
QilingCross-platformFull emulation — bypasses HW-level checks

5. Functional bypass snippets

Linux ptrace shim
bash
# bash / WSL
cat > /tmp/ap.c <<'EOF'
long ptrace(int r, int p, void *a, void *d) { return 0; }
EOF
gcc -shared -fPIC -o /tmp/ap.so /tmp/ap.c
LD_PRELOAD=/tmp/ap.so ./target
GDB catch-and-clear
text
(gdb) catch syscall ptrace
(gdb) commands
> set $rax = 0
> continue
> end
Frida cross-platform
javascript
// Linux ptrace
Interceptor.replace(
Module.getExportByName(null, 'ptrace'),
new NativeCallback(() => 0, 'long', ['int', 'int', 'pointer', 'pointer'])
);
// Windows IsDebuggerPresent
Interceptor.replace(
Module.getExportByName('kernel32.dll', 'IsDebuggerPresent'),
new NativeCallback(() => 0, 'int', [])
);
x64dbg + ScyllaHide (PowerShell launch)
powershell
& 'C:\Tools\x64dbg\x64\x64dbg.exe' 'C:\Program Files\MyApp\target.exe'
# In GUI: Plugins → ScyllaHide → Options →
# PEB BeingDebugged, NtGlobalFlag, HeapFlags
# NtQueryInformationProcess (all classes)
# NtSetInformationThread (HideFromDebugger)
# GetTickCount, QueryPerformanceCounter
# → Apply → restart session

6. Bypass methodology

  1. Static scan — grep the strings/imports above; map every check site.
  2. Classify each hit into the table in §1.
  3. Apply layered bypass — start with ScyllaHide (Win) or LD_PRELOAD shim (Linux); they cover ~80% of common checks.
  4. Handle TLS callbacks before main runs (x64dbg "Break on TLS" / WinDbg sxe ld).
  5. Verify — set BP on ExitProcess/exit/_exit; if hit unexpectedly, a check was missed → trace back.

7. Real-world protector defaults

ProtectorStackRecommended kit
VMProtectPEB + timing + driverTitanHide + ScyllaHide
ThemidaPEB + SEH + timingScyllaHide + manual NOP
EnigmaIsDebuggerPresent + CRCx64dbg + ScyllaHide
UPX (custom)Usually noneStandard unpack

8. Final report (Vietnamese)

🛡️ Bypass Anti-Debug hoàn tất:
🔍 Phát hiện : <DETECTION_TYPES>
🛠️ Bypass : <METHODS>
🧰 Công cụ : <ScyllaHide | Frida | LD_PRELOAD | GDB>
✅ Verify : chạy không exit sớm dưới debugger
▶ Tiếp:
binary-protection-bypass (nếu ASLR/PIE chặn patch)
→ binary-patcher (vá license check)

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
150
Repository forks
90
7-day trend score
25

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/ptn1411/skill/anti-debugging-techniques/badge)](https://verified-skill.com/skills/ptn1411/skill/anti-debugging-techniques)

Something wrong with this skill or its page? Tell us.