ineedcodes 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/package.json +2 -1
  2. package/skills/401-403-bypass-techniques/SKILL.md +348 -0
  3. package/skills/active-directory-acl-abuse/BLOODHOUND_PATHS.md +281 -0
  4. package/skills/active-directory-acl-abuse/SKILL.md +295 -0
  5. package/skills/active-directory-certificate-services/ADCS_ESC_MATRIX.md +197 -0
  6. package/skills/active-directory-certificate-services/SKILL.md +303 -0
  7. package/skills/active-directory-kerberos-attacks/KERBEROS_ATTACK_CHAINS.md +226 -0
  8. package/skills/active-directory-kerberos-attacks/SKILL.md +311 -0
  9. package/skills/ai-ml-security/SKILL.md +425 -0
  10. package/skills/android-pentesting-tricks/FRIDA_SCRIPTS.md +394 -0
  11. package/skills/android-pentesting-tricks/SKILL.md +369 -0
  12. package/skills/anti-debugging-techniques/ANTI_DEBUG_MATRIX.md +117 -0
  13. package/skills/anti-debugging-techniques/SKILL.md +407 -0
  14. package/skills/api-auth-and-jwt-abuse/SKILL.md +76 -0
  15. package/skills/api-authorization-and-bola/SKILL.md +48 -0
  16. package/skills/api-recon-and-docs/SKILL.md +61 -0
  17. package/skills/api-sec/SKILL.md +49 -0
  18. package/skills/arbitrary-write-to-rce/SKILL.md +361 -0
  19. package/skills/auth-sec/SKILL.md +41 -0
  20. package/skills/authbypass-authentication-flaws/SKILL.md +441 -0
  21. package/skills/bba-ad-attacker/SKILL.md +420 -0
  22. package/skills/bba-api-security/SKILL.md +95 -0
  23. package/skills/bba-attack-planner/SKILL.md +186 -0
  24. package/skills/bba-binary-exploit/SKILL.md +65 -0
  25. package/skills/bba-bizlogic-hunter/SKILL.md +304 -0
  26. package/skills/bba-bug-bounty/SKILL.md +245 -0
  27. package/skills/bba-cicd-redteam/SKILL.md +515 -0
  28. package/skills/bba-cloud-security/SKILL.md +97 -0
  29. package/skills/bba-container-escape/SKILL.md +161 -0
  30. package/skills/bba-credential-tester/SKILL.md +346 -0
  31. package/skills/bba-crypto-analyst/SKILL.md +54 -0
  32. package/skills/bba-ctf-solver/SKILL.md +166 -0
  33. package/skills/bba-detection-engineer/SKILL.md +93 -0
  34. package/skills/bba-engagement-planner/SKILL.md +68 -0
  35. package/skills/bba-exploit-chainer/SKILL.md +280 -0
  36. package/skills/bba-exploit-guide/SKILL.md +96 -0
  37. package/skills/bba-forensics-analyst/SKILL.md +512 -0
  38. package/skills/bba-graphql-hunter/SKILL.md +145 -0
  39. package/skills/bba-hardware-hacker/SKILL.md +57 -0
  40. package/skills/bba-jwt-cracker/SKILL.md +133 -0
  41. package/skills/bba-llm-redteam/SKILL.md +149 -0
  42. package/skills/bba-malware-analyst/SKILL.md +305 -0
  43. package/skills/bba-mobile-pentester/SKILL.md +350 -0
  44. package/skills/bba-osint-collector/SKILL.md +645 -0
  45. package/skills/bba-payload-crafter/SKILL.md +347 -0
  46. package/skills/bba-phishing-operator/SKILL.md +516 -0
  47. package/skills/bba-poc-validator/SKILL.md +249 -0
  48. package/skills/bba-privesc-advisor/SKILL.md +98 -0
  49. package/skills/bba-purple-team/SKILL.md +56 -0
  50. package/skills/bba-recon-advisor/SKILL.md +215 -0
  51. package/skills/bba-red-team-operator/SKILL.md +61 -0
  52. package/skills/bba-report-generator/SKILL.md +145 -0
  53. package/skills/bba-reverse-engineer/SKILL.md +298 -0
  54. package/skills/bba-social-engineer/SKILL.md +341 -0
  55. package/skills/bba-ssrf-hunter/SKILL.md +120 -0
  56. package/skills/bba-stig-analyst/SKILL.md +108 -0
  57. package/skills/bba-subdomain-takeover/SKILL.md +141 -0
  58. package/skills/bba-swarm-orchestrator/SKILL.md +351 -0
  59. package/skills/bba-threat-modeler/SKILL.md +574 -0
  60. package/skills/bba-vuln-scanner/SKILL.md +305 -0
  61. package/skills/bba-web-hunter/SKILL.md +285 -0
  62. package/skills/bba-wireless-pentester/SKILL.md +539 -0
  63. package/skills/binary-protection-bypass/PROTECTION_BYPASS_MATRIX.md +168 -0
  64. package/skills/binary-protection-bypass/SKILL.md +295 -0
  65. package/skills/browser-exploitation-v8/SKILL.md +334 -0
  66. package/skills/browser-exploitation-v8/V8_EXPLOITATION_PATTERNS.md +288 -0
  67. package/skills/business-logic-vuln/SKILL.md +33 -0
  68. package/skills/business-logic-vulnerabilities/CHECKLIST.md +375 -0
  69. package/skills/business-logic-vulnerabilities/METHODOLOGY.md +337 -0
  70. package/skills/business-logic-vulnerabilities/SCENARIOS.md +1095 -0
  71. package/skills/business-logic-vulnerabilities/SKILL.md +711 -0
  72. package/skills/classical-cipher-analysis/SKILL.md +663 -0
  73. package/skills/clickjacking/SKILL.md +163 -0
  74. package/skills/cmdi-command-injection/SKILL.md +687 -0
  75. package/skills/code-obfuscation-deobfuscation/SKILL.md +391 -0
  76. package/skills/container-escape-techniques/DOCKER_ESCAPE_CHAINS.md +296 -0
  77. package/skills/container-escape-techniques/SKILL.md +339 -0
  78. package/skills/cors-cross-origin-misconfiguration/SCENARIOS.md +152 -0
  79. package/skills/cors-cross-origin-misconfiguration/SKILL.md +270 -0
  80. package/skills/crlf-injection/SKILL.md +179 -0
  81. package/skills/csp-bypass-advanced/SKILL.md +259 -0
  82. package/skills/csrf-cross-site-request-forgery/SKILL.md +526 -0
  83. package/skills/csv-formula-injection/SKILL.md +144 -0
  84. package/skills/dangling-markup-injection/SKILL.md +321 -0
  85. package/skills/defi-attack-patterns/SKILL.md +355 -0
  86. package/skills/dependency-confusion/SKILL.md +178 -0
  87. package/skills/deserialization-insecure/JAVA_GADGET_CHAINS.md +511 -0
  88. package/skills/deserialization-insecure/SKILL.md +725 -0
  89. package/skills/dns-rebinding-attacks/SKILL.md +337 -0
  90. package/skills/email-header-injection/SKILL.md +349 -0
  91. package/skills/expression-language-injection/SKILL.md +243 -0
  92. package/skills/file-access-vuln/SKILL.md +33 -0
  93. package/skills/format-string-exploitation/SKILL.md +312 -0
  94. package/skills/ghost-bits-cast-attack/PAYLOAD_COOKBOOK.md +448 -0
  95. package/skills/ghost-bits-cast-attack/SKILL.md +799 -0
  96. package/skills/graphql-and-hidden-parameters/SKILL.md +50 -0
  97. package/skills/hack/SKILL.md +162 -0
  98. package/skills/hash-attack-techniques/SKILL.md +491 -0
  99. package/skills/heap-exploitation/HOUSE_OF_TECHNIQUES.md +244 -0
  100. package/skills/heap-exploitation/IO_FILE_EXPLOITATION.md +256 -0
  101. package/skills/heap-exploitation/SKILL.md +217 -0
  102. package/skills/http-host-header-attacks/SKILL.md +323 -0
  103. package/skills/http-parameter-pollution/SKILL.md +208 -0
  104. package/skills/http2-specific-attacks/SKILL.md +350 -0
  105. package/skills/idor-broken-object-authorization/SKILL.md +336 -0
  106. package/skills/injection-checking/EXTRA_INJECTION_TYPES.md +450 -0
  107. package/skills/injection-checking/SKILL.md +50 -0
  108. package/skills/insecure-source-code-management/SKILL.md +161 -0
  109. package/skills/ios-pentesting-tricks/IOS_RUNTIME_TRICKS.md +411 -0
  110. package/skills/ios-pentesting-tricks/SKILL.md +418 -0
  111. package/skills/jndi-injection/SKILL.md +265 -0
  112. package/skills/jwt-oauth-token-attacks/SKILL.md +301 -0
  113. package/skills/kernel-exploitation/KERNEL_HEAP_TECHNIQUES.md +293 -0
  114. package/skills/kernel-exploitation/KERNEL_MITIGATION_BYPASS.md +224 -0
  115. package/skills/kernel-exploitation/SKILL.md +307 -0
  116. package/skills/kubernetes-pentesting/SKILL.md +348 -0
  117. package/skills/lattice-crypto-attacks/SKILL.md +497 -0
  118. package/skills/linux-lateral-movement/SKILL.md +348 -0
  119. package/skills/linux-privilege-escalation/KERNEL_EXPLOITS_CHECKLIST.md +260 -0
  120. package/skills/linux-privilege-escalation/SKILL.md +346 -0
  121. package/skills/linux-privilege-escalation/SUID_CAPABILITIES_TRICKS.md +305 -0
  122. package/skills/linux-security-bypass/SKILL.md +345 -0
  123. package/skills/llm-prompt-injection/JAILBREAK_PATTERNS.md +306 -0
  124. package/skills/llm-prompt-injection/SKILL.md +357 -0
  125. package/skills/macos-process-injection/DYLIB_XPC_TECHNIQUES.md +373 -0
  126. package/skills/macos-process-injection/SKILL.md +384 -0
  127. package/skills/macos-security-bypass/SKILL.md +337 -0
  128. package/skills/macos-security-bypass/TCC_BYPASS_MATRIX.md +200 -0
  129. package/skills/memory-forensics-volatility/SKILL.md +323 -0
  130. package/skills/memory-forensics-volatility/VOLATILITY_CHEATSHEET.md +225 -0
  131. package/skills/mobile-ssl-pinning-bypass/SKILL.md +531 -0
  132. package/skills/network-protocol-attacks/NAME_RESOLUTION_POISONING.md +226 -0
  133. package/skills/network-protocol-attacks/SKILL.md +330 -0
  134. package/skills/nosql-injection/SKILL.md +341 -0
  135. package/skills/ntlm-relay-coercion/COERCION_METHODS.md +253 -0
  136. package/skills/ntlm-relay-coercion/SKILL.md +267 -0
  137. package/skills/oauth-oidc-misconfiguration/SKILL.md +46 -0
  138. package/skills/open-redirect/SKILL.md +380 -0
  139. package/skills/path-traversal-lfi/SKILL.md +802 -0
  140. package/skills/prototype-pollution/SKILL.md +190 -0
  141. package/skills/prototype-pollution-advanced/KNOWN_GADGETS.md +253 -0
  142. package/skills/prototype-pollution-advanced/SKILL.md +338 -0
  143. package/skills/race-condition/SKILL.md +526 -0
  144. package/skills/recon-and-methodology/SKILL.md +389 -0
  145. package/skills/recon-for-sec/SKILL.md +29 -0
  146. package/skills/request-smuggling/H2_SMUGGLING_VARIANTS.md +498 -0
  147. package/skills/request-smuggling/SKILL.md +314 -0
  148. package/skills/reverse-shell-techniques/SHELL_CHEATSHEET.md +196 -0
  149. package/skills/reverse-shell-techniques/SKILL.md +290 -0
  150. package/skills/rsa-attack-techniques/RSA_ATTACK_CATALOG.md +432 -0
  151. package/skills/rsa-attack-techniques/SKILL.md +437 -0
  152. package/skills/saml-sso-assertion-attacks/SKILL.md +41 -0
  153. package/skills/sandbox-escape-techniques/PYTHON_SANDBOX_ESCAPE.md +349 -0
  154. package/skills/sandbox-escape-techniques/SECCOMP_BYPASS.md +332 -0
  155. package/skills/sandbox-escape-techniques/SKILL.md +250 -0
  156. package/skills/smart-contract-vulnerabilities/SKILL.md +314 -0
  157. package/skills/smart-contract-vulnerabilities/SOLIDITY_VULN_PATTERNS.md +460 -0
  158. package/skills/sqli-sql-injection/SCENARIOS.md +575 -0
  159. package/skills/sqli-sql-injection/SKILL.md +489 -0
  160. package/skills/sqli-sql-injection/SQLMAP_ADVANCED.md +642 -0
  161. package/skills/ssrf-server-side-request-forgery/SCENARIOS.md +226 -0
  162. package/skills/ssrf-server-side-request-forgery/SKILL.md +323 -0
  163. package/skills/ssrf-server-side-request-forgery/URL_PARSER_TRICKS.md +650 -0
  164. package/skills/ssti-server-side-template-injection/ENGINE_PAYLOADS.md +456 -0
  165. package/skills/ssti-server-side-template-injection/SCENARIOS.md +319 -0
  166. package/skills/ssti-server-side-template-injection/SKILL.md +344 -0
  167. package/skills/stack-overflow-and-rop/ROP_ADVANCED_TECHNIQUES.md +249 -0
  168. package/skills/stack-overflow-and-rop/SKILL.md +304 -0
  169. package/skills/steganography-techniques/SKILL.md +348 -0
  170. package/skills/steganography-techniques/STEGO_TOOLS_GUIDE.md +335 -0
  171. package/skills/subdomain-takeover/SKILL.md +247 -0
  172. package/skills/symbolic-execution-tools/ANGR_COOKBOOK.md +437 -0
  173. package/skills/symbolic-execution-tools/SKILL.md +419 -0
  174. package/skills/symmetric-cipher-attacks/BLOCK_CIPHER_ATTACKS.md +364 -0
  175. package/skills/symmetric-cipher-attacks/SKILL.md +462 -0
  176. package/skills/traffic-analysis-pcap/SKILL.md +341 -0
  177. package/skills/tunneling-and-pivoting/SKILL.md +343 -0
  178. package/skills/type-juggling/SKILL.md +291 -0
  179. package/skills/unauthorized-access-common-services/PORT_SERVICE_MATRIX.md +340 -0
  180. package/skills/unauthorized-access-common-services/SKILL.md +388 -0
  181. package/skills/upload-insecure-files/SCENARIOS.md +158 -0
  182. package/skills/upload-insecure-files/SKILL.md +543 -0
  183. package/skills/vm-and-bytecode-reverse/SKILL.md +450 -0
  184. package/skills/vr-cheatsheet-authentication_bypass/SKILL.md +184 -0
  185. package/skills/vr-cheatsheet-dangerous_functions/SKILL.md +200 -0
  186. package/skills/vr-cheatsheet-linux_commands/SKILL.md +40 -0
  187. package/skills/vr-cheatsheet-rce/SKILL.md +177 -0
  188. package/skills/vr-cheatsheet-reverse_engineering/SKILL.md +144 -0
  189. package/skills/vr-cheatsheet-sqli/SKILL.md +270 -0
  190. package/skills/vr-cheatsheet-ssrf/SKILL.md +173 -0
  191. package/skills/vr-cheatsheet-xss/SKILL.md +177 -0
  192. package/skills/vr-methodology-mindset_and_tips/SKILL.md +51 -0
  193. package/skills/vr-template-vulnerability_report_template/SKILL.md +59 -0
  194. package/skills/vr-writeup-CVE-2026-9136/SKILL.md +171 -0
  195. package/skills/vr-writeup-ZVE-2026-3795/SKILL.md +350 -0
  196. package/skills/vr-writeup-api_key_leak/SKILL.md +103 -0
  197. package/skills/waf-bypass-techniques/SKILL.md +290 -0
  198. package/skills/waf-bypass-techniques/WAF_PRODUCT_MATRIX.md +202 -0
  199. package/skills/web-cache-deception/CACHE_POISONING_TECHNIQUES.md +637 -0
  200. package/skills/web-cache-deception/SKILL.md +222 -0
  201. package/skills/websocket-security/SKILL.md +454 -0
  202. package/skills/windows-av-evasion/AMSI_BYPASS_TECHNIQUES.md +289 -0
  203. package/skills/windows-av-evasion/SKILL.md +342 -0
  204. package/skills/windows-lateral-movement/CREDENTIAL_DUMPING.md +308 -0
  205. package/skills/windows-lateral-movement/SKILL.md +335 -0
  206. package/skills/windows-privilege-escalation/SKILL.md +328 -0
  207. package/skills/windows-privilege-escalation/TOKEN_POTATO_TRICKS.md +216 -0
  208. package/skills/windows-privilege-escalation/UAC_BYPASS_METHODS.md +225 -0
  209. package/skills/xslt-injection/SKILL.md +281 -0
  210. package/skills/xss-cross-site-scripting/ADVANCED_XSS_TRICKS.md +276 -0
  211. package/skills/xss-cross-site-scripting/SCENARIOS.md +278 -0
  212. package/skills/xss-cross-site-scripting/SKILL.md +379 -0
  213. package/skills/xxe-xml-external-entity/SCENARIOS.md +112 -0
  214. package/skills/xxe-xml-external-entity/SKILL.md +554 -0
  215. package/src/agent.js +1 -1
  216. package/src/session.js +47 -11
  217. package/src/skills.js +30 -6
  218. package/src/ui.js +1 -1
@@ -0,0 +1,407 @@
1
+ ---
2
+ name: anti-debugging-techniques
3
+ description: >-
4
+ Anti-debugging detection and bypass playbook. Use when reversing protected
5
+ binaries that detect debuggers via ptrace, PEB flags, timing checks, or
6
+ signal/exception handlers on Linux and Windows.gated: true
7
+ ---
8
+
9
+ # SKILL: Anti-Debugging Techniques — Detection & Bypass Playbook
10
+
11
+ > **AI LOAD INSTRUCTION**: Expert anti-debug techniques across Linux and Windows. Covers ptrace, PEB flags, NtQueryInformationProcess, timing attacks, signal-based detection, TLS callbacks, VEH tricks, and all corresponding bypass methods. Base models often miss the distinction between user-mode and kernel-mode detection and the correct patching strategy for each.
12
+
13
+ ## 0. RELATED ROUTING
14
+
15
+ - [code-obfuscation-deobfuscation](../code-obfuscation-deobfuscation/SKILL.md) when the binary also uses control flow flattening, VM protection, or string encryption
16
+ - [vm-and-bytecode-reverse](../vm-and-bytecode-reverse/SKILL.md) when the anti-debug sits inside a custom VM dispatcher
17
+ - [symbolic-execution-tools](../symbolic-execution-tools/SKILL.md) when you want to symbolically skip anti-debug checks entirely
18
+
19
+ ### Advanced Reference
20
+
21
+ Also load [ANTI_DEBUG_MATRIX.md](./ANTI_DEBUG_MATRIX.md) when you need:
22
+ - Complete cross-reference matrix of technique × OS × detection method × bypass method
23
+ - Per-technique reliability ratings and false-positive notes
24
+ - Tool compatibility chart (GDB, x64dbg, WinDbg, Frida, ScyllaHide)
25
+
26
+ ### Quick bypass picks
27
+
28
+ | Detection Class | First Bypass | Backup |
29
+ |---|---|---|
30
+ | ptrace-based (Linux) | `LD_PRELOAD` hook `ptrace()` → return 0 | Kernel module to hide tracer |
31
+ | PEB.BeingDebugged (Windows) | Patch PEB byte at `fs:[0x30]+0x2` | ScyllaHide auto-patch |
32
+ | Timing check (rdtsc) | Conditional BP after rdtsc, fix registers | Frida hook `rdtsc` return |
33
+ | IsDebuggerPresent | NOP the call / hook return 0 | x64dbg built-in hide |
34
+ | INT 2D / UD2 exception | Set VEH to handle gracefully | TitanHide driver |
35
+
36
+ ---
37
+
38
+ ## 1. LINUX ANTI-DEBUG TECHNIQUES
39
+
40
+ ### 1.1 ptrace(PTRACE_TRACEME)
41
+
42
+ The classic self-attach: a process calls `ptrace(PTRACE_TRACEME, 0, 0, 0)`. If a debugger is already attached, the call fails (returns -1).
43
+
44
+ ```c
45
+ if (ptrace(PTRACE_TRACEME, 0, 0, 0) == -1) {
46
+ exit(1); // debugger detected
47
+ }
48
+ ```
49
+
50
+ **Bypass methods**:
51
+
52
+ | Method | How |
53
+ |---|---|
54
+ | `LD_PRELOAD` shim | Compile shared lib: `long ptrace(int r, ...) { return 0; }` and set `LD_PRELOAD` |
55
+ | Binary patch | NOP the `ptrace` call or patch return value check |
56
+ | GDB catch | `catch syscall ptrace` → modify `$rax` to 0 on return |
57
+ | Kernel module | Hook `sys_ptrace` to allow multiple tracers |
58
+
59
+ ### 1.2 /proc/self/status — TracerPid
60
+
61
+ ```c
62
+ FILE *f = fopen("/proc/self/status", "r");
63
+ // parse TracerPid: if non-zero → debugger attached
64
+ ```
65
+
66
+ **Bypass**: Mount a FUSE filesystem over `/proc/self`, or `LD_PRELOAD` hook `fopen`/`fread` to filter `TracerPid` to 0.
67
+
68
+ ### 1.3 Timing Checks (rdtsc / clock_gettime)
69
+
70
+ Measures elapsed time between two points; debugger single-stepping causes noticeable delay.
71
+
72
+ ```asm
73
+ rdtsc
74
+ mov ebx, eax ; save low 32 bits
75
+ ; ... protected code ...
76
+ rdtsc
77
+ sub eax, ebx
78
+ cmp eax, 0x1000 ; threshold
79
+ ja debugger_detected
80
+ ```
81
+
82
+ **Bypass**: Set hardware breakpoint after second `rdtsc`, modify `eax` to pass the comparison. Or use Frida to replace the timing function.
83
+
84
+ ### 1.4 Signal-Based Detection (SIGTRAP)
85
+
86
+ ```c
87
+ volatile int caught = 0;
88
+ void handler(int sig) { caught = 1; }
89
+ signal(SIGTRAP, handler);
90
+ raise(SIGTRAP);
91
+ if (!caught) exit(1); // debugger swallowed the signal
92
+ ```
93
+
94
+ When a debugger is attached, `SIGTRAP` is consumed by the debugger rather than delivered to the handler. **Bypass**: In GDB, use `handle SIGTRAP nostop pass` to forward the signal.
95
+
96
+ ### 1.5 /proc/self/maps & LD_PRELOAD Detection
97
+
98
+ Checks for injected libraries or memory regions characteristic of debuggers/instrumentation.
99
+
100
+ ```c
101
+ FILE *f = fopen("/proc/self/maps", "r");
102
+ while (fgets(buf, sizeof(buf), f)) {
103
+ if (strstr(buf, "frida") || strstr(buf, "LD_PRELOAD"))
104
+ exit(1);
105
+ }
106
+ ```
107
+
108
+ **Bypass**: Hook `fopen("/proc/self/maps")` to return a filtered version, or rename Frida's agent library.
109
+
110
+ ### 1.6 Environment Variable Checks
111
+
112
+ Some protections check for `LD_PRELOAD`, `LINES`, `COLUMNS` (set by GDB's terminal), or debugger-specific env vars.
113
+
114
+ **Bypass**: Unset suspicious env vars before launch, or hook `getenv()`.
115
+
116
+ ---
117
+
118
+ ## 2. WINDOWS ANTI-DEBUG TECHNIQUES
119
+
120
+ ### 2.1 IsDebuggerPresent / CheckRemoteDebuggerPresent
121
+
122
+ ```c
123
+ if (IsDebuggerPresent()) ExitProcess(1);
124
+
125
+ BOOL debugged = FALSE;
126
+ CheckRemoteDebuggerPresent(GetCurrentProcess(), &debugged);
127
+ if (debugged) ExitProcess(1);
128
+ ```
129
+
130
+ **Bypass**: Hook `kernel32!IsDebuggerPresent` to return 0, or patch PEB directly.
131
+
132
+ ### 2.2 PEB Flags
133
+
134
+ | Field | Offset (x64) | Debugged Value | Normal Value |
135
+ |---|---|---|---|
136
+ | `BeingDebugged` | `PEB+0x02` | 1 | 0 |
137
+ | `NtGlobalFlag` | `PEB+0xBC` | `0x70` (FLG_HEAP_*) | 0 |
138
+ | `ProcessHeap.Flags` | Heap+0x40 | `0x40000062` | `0x00000002` |
139
+ | `ProcessHeap.ForceFlags` | Heap+0x44 | `0x40000060` | 0 |
140
+
141
+ ```asm
142
+ mov rax, gs:[0x60] ; PEB
143
+ movzx eax, byte [rax+0x02] ; BeingDebugged
144
+ test eax, eax
145
+ jnz debugger_detected
146
+ ```
147
+
148
+ **Bypass**: Zero all four fields. ScyllaHide does this automatically.
149
+
150
+ ### 2.3 NtQueryInformationProcess
151
+
152
+ | InfoClass | Value | Debugged Return |
153
+ |---|---|---|
154
+ | `ProcessDebugPort` | 0x07 | Non-zero port |
155
+ | `ProcessDebugObjectHandle` | 0x1E | Valid handle |
156
+ | `ProcessDebugFlags` | 0x1F | 0 (inverted!) |
157
+
158
+ **Bypass**: Hook `ntdll!NtQueryInformationProcess` to return clean values per info class.
159
+
160
+ ### 2.4 Hardware Breakpoint Detection
161
+
162
+ ```c
163
+ CONTEXT ctx;
164
+ ctx.ContextFlags = CONTEXT_DEBUG_REGISTERS;
165
+ GetThreadContext(GetCurrentThread(), &ctx);
166
+ if (ctx.Dr0 || ctx.Dr1 || ctx.Dr2 || ctx.Dr3)
167
+ ExitProcess(1);
168
+ ```
169
+
170
+ **Bypass**: Hook `GetThreadContext` to zero DR0–DR3, or use `NtSetInformationThread(ThreadHideFromDebugger)` preemptively (ironically, the anti-debug technique itself).
171
+
172
+ ### 2.5 INT 2D / INT 3 / UD2 Exception Tricks
173
+
174
+ `INT 2D` is the kernel debug service interrupt. Without a debugger, it raises `STATUS_BREAKPOINT`; with a debugger, behavior differs (byte skipping).
175
+
176
+ ```asm
177
+ xor eax, eax
178
+ int 2dh
179
+ nop ; debugger may skip this byte
180
+ ; ... divergent execution path ...
181
+ ```
182
+
183
+ **Bypass**: Handle in VEH or patch the interrupt instruction.
184
+
185
+ ### 2.6 TLS Callbacks
186
+
187
+ TLS callbacks execute before `main()` / `WinMain()`. Anti-debug checks placed here run before the debugger's initial break.
188
+
189
+ **Bypass**: In x64dbg, set "Break on TLS Callbacks" option. In WinDbg, use `sxe ld` to break on module load.
190
+
191
+ ### 2.7 NtSetInformationThread(ThreadHideFromDebugger)
192
+
193
+ ```c
194
+ NtSetInformationThread(GetCurrentThread(), ThreadHideFromDebugger, NULL, 0);
195
+ ```
196
+
197
+ After this call, the thread becomes invisible to the debugger — breakpoints and single-stepping stop working silently.
198
+
199
+ **Bypass**: Hook `NtSetInformationThread` to NOP when `ThreadInfoClass == 0x11`.
200
+
201
+ ### 2.8 VEH-Based Detection
202
+
203
+ Registers a Vectored Exception Handler that checks `EXCEPTION_RECORD` for debugger-specific behavior (single-step flag, guard page violations with debugger semantics).
204
+
205
+ **Bypass**: Understand the VEH logic and ensure the exception chain behaves identically to non-debugged execution.
206
+
207
+ ---
208
+
209
+ ## 3. ADVANCED MULTI-LAYER TECHNIQUES
210
+
211
+ ### 3.1 Self-Debugging (fork + ptrace)
212
+
213
+ The process forks a child that attaches to the parent via ptrace. If an external debugger is already attached, the child's ptrace fails.
214
+
215
+ ```c
216
+ pid_t child = fork();
217
+ if (child == 0) {
218
+ if (ptrace(PTRACE_ATTACH, getppid(), 0, 0) == -1)
219
+ kill(getppid(), SIGKILL);
220
+ else
221
+ ptrace(PTRACE_DETACH, getppid(), 0, 0);
222
+ _exit(0);
223
+ }
224
+ wait(NULL);
225
+ ```
226
+
227
+ **Bypass**: Patch the `fork()` return or kill/detach the watchdog child.
228
+
229
+ ### 3.2 Multi-Process Debugging Detection
230
+
231
+ Parent and child cooperatively check each other's debug state, creating a mutual-watch pattern.
232
+
233
+ **Bypass**: Attach to both processes (GDB `follow-fork-mode`, or two debugger instances).
234
+
235
+ ### 3.3 Timing-Based with Multiple Checkpoints
236
+
237
+ Distributes timing checks across multiple functions, comparing cumulative drift. Single patches fail because the total still exceeds threshold.
238
+
239
+ **Bypass**: Frida `Interceptor.replace` all timing sources (`rdtsc`, `clock_gettime`, `QueryPerformanceCounter`) to return controlled values.
240
+
241
+ ### 3.4 Nanomite / INT3 Patching
242
+
243
+ Original conditional jumps are replaced with `INT3` (0xCC). A parent debugger process handles each `INT3`, evaluates the condition, and sets the child's EIP accordingly.
244
+
245
+ **Bypass**: Reconstruct the original jump table by tracing all `INT3` handlers, then patch the binary.
246
+
247
+ ---
248
+
249
+ ## 4. COUNTERMEASURE TOOLS
250
+
251
+ | Tool | Platform | Capability |
252
+ |---|---|---|
253
+ | **ScyllaHide** | Windows (x64dbg/IDA/OllyDbg) | Auto-patches PEB, hooks NtQuery*, hides threads, fixes timing |
254
+ | **TitanHide** | Windows (kernel driver) | Kernel-level hiding for all user-mode checks |
255
+ | **Frida** | Cross-platform | Script-based hooking of any function, timing spoofing |
256
+ | **LD_PRELOAD shims** | Linux | Replace ptrace, getenv, fopen at load time |
257
+ | **GDB scripts** | Linux | `catch syscall`, conditional BP, register fixup |
258
+ | **Qiling** | Cross-platform | Full-system emulation, bypass all hardware checks |
259
+
260
+ ---
261
+
262
+ ## 5. SYSTEMATIC BYPASS METHODOLOGY
263
+
264
+ ```
265
+ Step 1: Static analysis — identify anti-debug calls
266
+ └─ Search for: ptrace, IsDebuggerPresent, NtQuery, rdtsc,
267
+ GetTickCount, SIGTRAP, INT 2D, TLS directory entries
268
+
269
+ Step 2: Classify each check
270
+ ├─ API-based → hook or patch the call
271
+ ├─ Flag-based → patch PEB/proc fields
272
+ ├─ Timing-based → spoof time source
273
+ ├─ Exception-based → forward/handle exception correctly
274
+ └─ Multi-process → handle both processes
275
+
276
+ Step 3: Apply bypass (order matters)
277
+ 1. Load ScyllaHide / set LD_PRELOAD (covers 80% of checks)
278
+ 2. Handle TLS callbacks (break before main)
279
+ 3. Patch remaining custom checks (Frida or binary patch)
280
+ 4. Verify: run with breakpoints, confirm no premature exit
281
+
282
+ Step 4: Validate bypass completeness
283
+ └─ Set BP on ExitProcess/exit/_exit — if hit unexpectedly,
284
+ a check was missed → trace back from exit call
285
+ ```
286
+
287
+ ---
288
+
289
+ ## 6. DECISION TREE
290
+
291
+ ```
292
+ Binary exits/crashes under debugger?
293
+
294
+ ├─ Crashes immediately before main?
295
+ │ └─ TLS callback anti-debug
296
+ │ └─ Enable TLS callback breaking in debugger
297
+
298
+ ├─ Crashes at startup?
299
+ │ ├─ Linux: check for ptrace(TRACEME)
300
+ │ │ └─ LD_PRELOAD hook or NOP patch
301
+ │ └─ Windows: check IsDebuggerPresent / PEB
302
+ │ └─ ScyllaHide or manual PEB patch
303
+
304
+ ├─ Crashes after some execution?
305
+ │ ├─ Consistent crash point → API-based check
306
+ │ │ ├─ NtQueryInformationProcess → hook return values
307
+ │ │ ├─ /proc/self/status → filter TracerPid
308
+ │ │ └─ Hardware BP detection → hook GetThreadContext
309
+ │ │
310
+ │ ├─ Variable crash point → timing-based check
311
+ │ │ └─ Hook rdtsc / QueryPerformanceCounter
312
+ │ │
313
+ │ └─ Crash on breakpoint hit → exception-based check
314
+ │ ├─ INT 2D / INT 3 trick → handle in VEH
315
+ │ └─ SIGTRAP handler → GDB: handle SIGTRAP pass
316
+
317
+ ├─ Debugger loses control silently?
318
+ │ └─ ThreadHideFromDebugger
319
+ │ └─ Hook NtSetInformationThread
320
+
321
+ ├─ Child process detects and kills parent?
322
+ │ └─ Self-debugging (fork+ptrace)
323
+ │ └─ Patch fork() or handle both processes
324
+
325
+ └─ All basic bypasses applied but still detected?
326
+ └─ Multi-layer / custom checks
327
+ ├─ Use Frida for comprehensive API hooking
328
+ ├─ Full emulation with Qiling
329
+ └─ Trace all calls to exit/abort to find remaining checks
330
+ ```
331
+
332
+ ---
333
+
334
+ ## 7. CTF & REAL-WORLD PATTERNS
335
+
336
+ ### Common CTF Anti-Debug Patterns
337
+
338
+ | Pattern | Frequency | Quick Bypass |
339
+ |---|---|---|
340
+ | Single `ptrace(TRACEME)` | Very common | `LD_PRELOAD` one-liner |
341
+ | `IsDebuggerPresent` + `NtGlobalFlag` | Common | ScyllaHide |
342
+ | rdtsc timing in loop | Moderate | Patch comparison threshold |
343
+ | signal(SIGTRAP) + raise | Moderate | GDB signal forwarding |
344
+ | fork + ptrace watchdog | Rare but tricky | Kill child or patch fork |
345
+ | Nanomite INT3 replacement | Rare (advanced) | Reconstruct jump table |
346
+
347
+ ### Real-World Protections
348
+
349
+ | Protector | Primary Anti-Debug | Recommended Tool |
350
+ |---|---|---|
351
+ | VMProtect | PEB + timing + driver-level | TitanHide + ScyllaHide |
352
+ | Themida | Multi-layer PEB + SEH + timing | ScyllaHide + manual patches |
353
+ | Enigma Protector | IsDebuggerPresent + CRC checks | x64dbg + ScyllaHide |
354
+ | UPX (custom) | Usually none (just packing) | Standard unpack |
355
+ | Custom (malware) | Varies widely | Frida + Qiling for analysis |
356
+
357
+ ---
358
+
359
+ ## 8. QUICK REFERENCE — BYPASS CHEAT SHEET
360
+
361
+ ### Linux One-Liners
362
+
363
+ ```bash
364
+ # LD_PRELOAD anti-ptrace
365
+ echo 'long ptrace(int r, ...) { return 0; }' > /tmp/ap.c
366
+ gcc -shared -o /tmp/ap.so /tmp/ap.c
367
+ LD_PRELOAD=/tmp/ap.so ./target
368
+
369
+ # GDB: catch and bypass ptrace
370
+ (gdb) catch syscall ptrace
371
+ (gdb) commands
372
+ > set $rax = 0
373
+ > continue
374
+ > end
375
+ ```
376
+
377
+ ### Frida Anti-Debug Bypass (Cross-Platform)
378
+
379
+ ```javascript
380
+ // Hook IsDebuggerPresent (Windows)
381
+ Interceptor.replace(
382
+ Module.getExportByName('kernel32.dll', 'IsDebuggerPresent'),
383
+ new NativeCallback(() => 0, 'int', [])
384
+ );
385
+
386
+ // Hook ptrace (Linux)
387
+ Interceptor.replace(
388
+ Module.getExportByName(null, 'ptrace'),
389
+ new NativeCallback(() => 0, 'long', ['int', 'int', 'pointer', 'pointer'])
390
+ );
391
+
392
+ // Timing spoof
393
+ Interceptor.attach(Module.getExportByName(null, 'clock_gettime'), {
394
+ onLeave(retval) {
395
+ // manipulate timespec to hide debugger delay
396
+ }
397
+ });
398
+ ```
399
+
400
+ ### x64dbg ScyllaHide Quick Setup
401
+
402
+ 1. Plugins → ScyllaHide → Options
403
+ 2. Check: PEB BeingDebugged, NtGlobalFlag, HeapFlags
404
+ 3. Check: NtQueryInformationProcess (all classes)
405
+ 4. Check: NtSetInformationThread (HideFromDebugger)
406
+ 5. Check: GetTickCount, QueryPerformanceCounter
407
+ 6. Apply → restart debugging session
@@ -0,0 +1,76 @@
1
+ ---
2
+ name: api-auth-and-jwt-abuse
3
+ description: >-
4
+ API authentication and JWT abuse playbook. Use when testing bearer tokens, API keys, claim trust, header spoofing, rate limits, and API auth boundary weaknesses.gated: true
5
+ ---
6
+
7
+ # SKILL: API Auth and JWT Abuse — Token Trust, Header Tricks, and Rate Limits
8
+
9
+ > **AI LOAD INSTRUCTION**: Use this skill when APIs rely on JWT, bearer tokens, API keys, or weak request identity signals. Focus on token trust boundaries, claim misuse, header spoofing, and rate-limit bypass.
10
+
11
+ ## 1. TOKEN TRIAGE
12
+
13
+ Inspect:
14
+
15
+ - `alg`, `kid`, `jku`, `x5u`
16
+ - role, org, tenant, scope, or privilege claims
17
+ - issuer and audience mismatches
18
+ - reuse of mobile and web tokens across products
19
+
20
+ ## 2. QUICK ATTACK PICKS
21
+
22
+ | Pattern | First Test |
23
+ |---|---|
24
+ | `alg:none` acceptance | unsigned token with trailing dot |
25
+ | RS256 confusion | switch to HS256 using public key as secret |
26
+ | `kid` lookup trust | path traversal or injection in `kid` |
27
+ | remote key fetch trust | attacker-controlled `jku` or `x5u` |
28
+ | weak secret | offline crack with targeted wordlists |
29
+
30
+ ## 3. HIDDEN FIELDS AND BATCH ABUSE
31
+
32
+ ### Mass assignment field picks
33
+
34
+ ```text
35
+ role
36
+ isAdmin
37
+ admin
38
+ verified
39
+ plan
40
+ tier
41
+ permissions
42
+ org
43
+ owner
44
+ ```
45
+
46
+ ### Rate limit and batch abuse picks
47
+
48
+ ```text
49
+ X-Forwarded-For: 1.2.3.4
50
+ X-Real-IP: 5.6.7.8
51
+ Forwarded: for=9.9.9.9
52
+ ```
53
+
54
+ GraphQL or JSON batch abuse candidates:
55
+
56
+ - arrays of login mutations
57
+ - bulk object fetches with varying IDs
58
+ - repeated password reset or verification calls in one request
59
+
60
+ ## 4. RATE LIMIT BYPASS FAMILIES
61
+
62
+ ```text
63
+ X-Forwarded-For
64
+ X-Real-IP
65
+ Forwarded
66
+ User-Agent rotation
67
+ Path case / slash variants
68
+ ```
69
+
70
+ ## 5. NEXT ROUTING
71
+
72
+ - For GraphQL batching and hidden parameters: [graphql and hidden parameters](../graphql-and-hidden-parameters/SKILL.md)
73
+ - For default credential and brute-force planning: [authentication bypass](../authbypass-authentication-flaws/SKILL.md)
74
+ - For full JWT and OAuth depth: [jwt oauth token attacks](../jwt-oauth-token-attacks/SKILL.md)
75
+ - For OAuth or OIDC configuration flaws in browser and SSO flows: [oauth oidc misconfiguration](../oauth-oidc-misconfiguration/SKILL.md)
76
+ - For credentialed browser reads and origin trust bugs: [cors cross origin misconfiguration](../cors-cross-origin-misconfiguration/SKILL.md)
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: api-authorization-and-bola
3
+ description: >-
4
+ API authorization and BOLA testing playbook. Use when APIs expose object identifiers, nested resources, hidden writable fields, or weak function-level authorization.gated: true
5
+ ---
6
+
7
+ # SKILL: API Authorization and BOLA — Object Access, Function Access, and Mass Assignment
8
+
9
+ > **AI LOAD INSTRUCTION**: Use this skill when an API exposes object IDs, nested resources, or role-sensitive functions and you need a focused authorization test path: BOLA, BFLA, method abuse, and hidden field control.
10
+
11
+ ## 1. CORE TEST LOOP
12
+
13
+ 1. Create Account A and Account B.
14
+ 2. As Account A, capture create, read, update, and delete flows.
15
+ 3. Replay with Account B's token.
16
+ 4. Test sibling endpoints, nested endpoints, and alternate HTTP verbs.
17
+
18
+ ## 2. TEST SURFACES
19
+
20
+ | Surface | Example |
21
+ |---|---|
22
+ | object read | `/api/v1/orders/123` |
23
+ | nested object | `/api/v1/users/1/invoices/9` |
24
+ | admin or internal function | `/api/v1/admin/users` |
25
+ | update path | `PUT`, `PATCH`, `DELETE` variants |
26
+ | hidden JSON fields | `role`, `org`, `verified`, `tier` |
27
+
28
+ ## 3. QUICK PAYLOADS
29
+
30
+ ```json
31
+ {"role":"admin"}
32
+ {"isAdmin":true}
33
+ {"org":"target-company"}
34
+ {"verified":true}
35
+ ```
36
+
37
+ ## 4. WHAT TESTERS MISS
38
+
39
+ - object IDs in headers, cookies, GraphQL args, and nested objects
40
+ - alternate methods sharing the same route but weaker authz
41
+ - parent check present, child resource check missing
42
+ - admin docs revealing extra writable fields
43
+
44
+ ## 5. NEXT ROUTING
45
+
46
+ - For JWT or token-layer abuse: [api auth and jwt abuse](../api-auth-and-jwt-abuse/SKILL.md)
47
+ - For GraphQL and hidden parameter discovery: [graphql and hidden parameters](../graphql-and-hidden-parameters/SKILL.md)
48
+ - For broader IDOR patterns outside APIs: [idor broken object authorization](../idor-broken-object-authorization/SKILL.md)
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: api-recon-and-docs
3
+ description: >-
4
+ API reconnaissance and documentation review playbook. Use when discovering endpoints, schemas, versions, OpenAPI specs, hidden docs, and surface area for API testing.gated: true
5
+ ---
6
+
7
+ # SKILL: API Recon and Docs — Endpoints, Schemas, and Version Surface
8
+
9
+ > **AI LOAD INSTRUCTION**: Use this skill first when the target is a REST, mobile, or GraphQL API and you need to enumerate endpoints, documentation, versions, and hidden surface area before exploitation.
10
+
11
+ ## 1. PRIMARY GOALS
12
+
13
+ 1. Discover all reachable API entrypoints.
14
+ 2. Extract schemas, optional fields, and role differences.
15
+ 3. Identify old versions, mobile paths, GraphQL endpoints, and undocumented parameters.
16
+
17
+ ## 2. RECON CHECKLIST
18
+
19
+ ### JavaScript and client mining
20
+
21
+ ```bash
22
+ curl https://target/app.js | grep -oE '(/api|/rest|/graphql)[^"'\'' ]+' | sort -u
23
+ ```
24
+
25
+ ### Common documentation and schema paths
26
+
27
+ ```text
28
+ /swagger.json
29
+ /openapi.json
30
+ /api-docs
31
+ /docs
32
+ /.well-known/
33
+ /graphql
34
+ /gql
35
+ ```
36
+
37
+ ### Version and product drift
38
+
39
+ ```text
40
+ /api/v1/
41
+ /api/v2/
42
+ /api/mobile/v1/
43
+ /legacy/
44
+ ```
45
+
46
+ ## 3. WHAT TO EXTRACT FROM DOCS
47
+
48
+ - optional and undocumented fields
49
+ - admin-only request examples
50
+ - deprecated endpoints that may still be active
51
+ - schema hints like `additionalProperties: true`
52
+ - parameter names tied to filtering, sorting, IDs, roles, or tenancy
53
+
54
+ ## 4. NEXT ROUTING
55
+
56
+ | Finding | Next Skill |
57
+ |---|---|
58
+ | object IDs everywhere | [api authorization and bola](../api-authorization-and-bola/SKILL.md) |
59
+ | JWT, OAuth, role claims | [api auth and jwt abuse](../api-auth-and-jwt-abuse/SKILL.md) |
60
+ | GraphQL or hidden fields | [graphql and hidden parameters](../graphql-and-hidden-parameters/SKILL.md) |
61
+ | strong auth boundary but suspicious business flow | [business logic vulnerabilities](../business-logic-vulnerabilities/SKILL.md) |
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: api-sec
3
+ description: >-
4
+ Entry P1 category router for API security. Use when choosing between API
5
+ recon, authorization, token abuse, and hidden-parameter workflows before any
6
+ deeper API topic skill.gated: true
7
+ ---
8
+
9
+ # API Security Router
10
+
11
+ This is the routing entry point for API security testing.
12
+
13
+ Use this skill first to decide whether the API issue is mostly recon/docs, object authorization, token trust, or GraphQL/hidden parameters, then route to a deeper topic skill.
14
+
15
+ ## When to Use
16
+
17
+ - The target exposes REST APIs, mobile backends, or GraphQL endpoints
18
+ - You need to define API testing order before going into specific topics
19
+ - You want to handle object authorization, JWT, GraphQL, and hidden fields as separate tracks
20
+
21
+ ## Skill Map
22
+
23
+ - [API Recon and Docs](../api-recon-and-docs/SKILL.md): OpenAPI, Swagger, version drift, hidden documentation
24
+ - [API Authorization and BOLA](../api-authorization-and-bola/SKILL.md): BOLA, BFLA, method abuse, hidden writable fields
25
+ - [API Auth and JWT Abuse](../api-auth-and-jwt-abuse/SKILL.md): bearer token, header trust, claim abuse, rate-limit bypass
26
+ - [GraphQL and Hidden Parameters](../graphql-and-hidden-parameters/SKILL.md): introspection, batching, undocumented fields, hidden parameters
27
+
28
+ ## Quick Triage
29
+
30
+ | Observation | Route |
31
+ |---|---|
32
+ | Swagger or OpenAPI is present | [api-recon-and-docs](../api-recon-and-docs/SKILL.md) |
33
+ | IDs appear in URL, JSON, headers, or GraphQL args | [api-authorization-and-bola](../api-authorization-and-bola/SKILL.md) |
34
+ | JWT token visible in traffic | [api-auth-and-jwt-abuse](../api-auth-and-jwt-abuse/SKILL.md) |
35
+ | `/graphql` or batched JSON arrays are present | [graphql-and-hidden-parameters](../graphql-and-hidden-parameters/SKILL.md) |
36
+ | Registration, login, or profile updates accept extra fields | [api-authorization-and-bola](../api-authorization-and-bola/SKILL.md) then [api-auth-and-jwt-abuse](../api-auth-and-jwt-abuse/SKILL.md) |
37
+
38
+ ## Recommended Flow
39
+
40
+ 1. Start with exposed endpoints and documentation assets
41
+ 2. Then evaluate object-level and function-level authorization
42
+ 3. Then evaluate token, header, signature, and rate-limit boundaries
43
+ 4. If GraphQL or complex JSON is present, continue with hidden fields and schema abuse
44
+
45
+ ## Related Categories
46
+
47
+ - [auth-sec](../auth-sec/SKILL.md)
48
+ - [business-logic-vuln](../business-logic-vuln/SKILL.md)
49
+ - [recon-for-sec](../recon-for-sec/SKILL.md)