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.
- package/package.json +2 -1
- package/skills/401-403-bypass-techniques/SKILL.md +348 -0
- package/skills/active-directory-acl-abuse/BLOODHOUND_PATHS.md +281 -0
- package/skills/active-directory-acl-abuse/SKILL.md +295 -0
- package/skills/active-directory-certificate-services/ADCS_ESC_MATRIX.md +197 -0
- package/skills/active-directory-certificate-services/SKILL.md +303 -0
- package/skills/active-directory-kerberos-attacks/KERBEROS_ATTACK_CHAINS.md +226 -0
- package/skills/active-directory-kerberos-attacks/SKILL.md +311 -0
- package/skills/ai-ml-security/SKILL.md +425 -0
- package/skills/android-pentesting-tricks/FRIDA_SCRIPTS.md +394 -0
- package/skills/android-pentesting-tricks/SKILL.md +369 -0
- package/skills/anti-debugging-techniques/ANTI_DEBUG_MATRIX.md +117 -0
- package/skills/anti-debugging-techniques/SKILL.md +407 -0
- package/skills/api-auth-and-jwt-abuse/SKILL.md +76 -0
- package/skills/api-authorization-and-bola/SKILL.md +48 -0
- package/skills/api-recon-and-docs/SKILL.md +61 -0
- package/skills/api-sec/SKILL.md +49 -0
- package/skills/arbitrary-write-to-rce/SKILL.md +361 -0
- package/skills/auth-sec/SKILL.md +41 -0
- package/skills/authbypass-authentication-flaws/SKILL.md +441 -0
- package/skills/bba-ad-attacker/SKILL.md +420 -0
- package/skills/bba-api-security/SKILL.md +95 -0
- package/skills/bba-attack-planner/SKILL.md +186 -0
- package/skills/bba-binary-exploit/SKILL.md +65 -0
- package/skills/bba-bizlogic-hunter/SKILL.md +304 -0
- package/skills/bba-bug-bounty/SKILL.md +245 -0
- package/skills/bba-cicd-redteam/SKILL.md +515 -0
- package/skills/bba-cloud-security/SKILL.md +97 -0
- package/skills/bba-container-escape/SKILL.md +161 -0
- package/skills/bba-credential-tester/SKILL.md +346 -0
- package/skills/bba-crypto-analyst/SKILL.md +54 -0
- package/skills/bba-ctf-solver/SKILL.md +166 -0
- package/skills/bba-detection-engineer/SKILL.md +93 -0
- package/skills/bba-engagement-planner/SKILL.md +68 -0
- package/skills/bba-exploit-chainer/SKILL.md +280 -0
- package/skills/bba-exploit-guide/SKILL.md +96 -0
- package/skills/bba-forensics-analyst/SKILL.md +512 -0
- package/skills/bba-graphql-hunter/SKILL.md +145 -0
- package/skills/bba-hardware-hacker/SKILL.md +57 -0
- package/skills/bba-jwt-cracker/SKILL.md +133 -0
- package/skills/bba-llm-redteam/SKILL.md +149 -0
- package/skills/bba-malware-analyst/SKILL.md +305 -0
- package/skills/bba-mobile-pentester/SKILL.md +350 -0
- package/skills/bba-osint-collector/SKILL.md +645 -0
- package/skills/bba-payload-crafter/SKILL.md +347 -0
- package/skills/bba-phishing-operator/SKILL.md +516 -0
- package/skills/bba-poc-validator/SKILL.md +249 -0
- package/skills/bba-privesc-advisor/SKILL.md +98 -0
- package/skills/bba-purple-team/SKILL.md +56 -0
- package/skills/bba-recon-advisor/SKILL.md +215 -0
- package/skills/bba-red-team-operator/SKILL.md +61 -0
- package/skills/bba-report-generator/SKILL.md +145 -0
- package/skills/bba-reverse-engineer/SKILL.md +298 -0
- package/skills/bba-social-engineer/SKILL.md +341 -0
- package/skills/bba-ssrf-hunter/SKILL.md +120 -0
- package/skills/bba-stig-analyst/SKILL.md +108 -0
- package/skills/bba-subdomain-takeover/SKILL.md +141 -0
- package/skills/bba-swarm-orchestrator/SKILL.md +351 -0
- package/skills/bba-threat-modeler/SKILL.md +574 -0
- package/skills/bba-vuln-scanner/SKILL.md +305 -0
- package/skills/bba-web-hunter/SKILL.md +285 -0
- package/skills/bba-wireless-pentester/SKILL.md +539 -0
- package/skills/binary-protection-bypass/PROTECTION_BYPASS_MATRIX.md +168 -0
- package/skills/binary-protection-bypass/SKILL.md +295 -0
- package/skills/browser-exploitation-v8/SKILL.md +334 -0
- package/skills/browser-exploitation-v8/V8_EXPLOITATION_PATTERNS.md +288 -0
- package/skills/business-logic-vuln/SKILL.md +33 -0
- package/skills/business-logic-vulnerabilities/CHECKLIST.md +375 -0
- package/skills/business-logic-vulnerabilities/METHODOLOGY.md +337 -0
- package/skills/business-logic-vulnerabilities/SCENARIOS.md +1095 -0
- package/skills/business-logic-vulnerabilities/SKILL.md +711 -0
- package/skills/classical-cipher-analysis/SKILL.md +663 -0
- package/skills/clickjacking/SKILL.md +163 -0
- package/skills/cmdi-command-injection/SKILL.md +687 -0
- package/skills/code-obfuscation-deobfuscation/SKILL.md +391 -0
- package/skills/container-escape-techniques/DOCKER_ESCAPE_CHAINS.md +296 -0
- package/skills/container-escape-techniques/SKILL.md +339 -0
- package/skills/cors-cross-origin-misconfiguration/SCENARIOS.md +152 -0
- package/skills/cors-cross-origin-misconfiguration/SKILL.md +270 -0
- package/skills/crlf-injection/SKILL.md +179 -0
- package/skills/csp-bypass-advanced/SKILL.md +259 -0
- package/skills/csrf-cross-site-request-forgery/SKILL.md +526 -0
- package/skills/csv-formula-injection/SKILL.md +144 -0
- package/skills/dangling-markup-injection/SKILL.md +321 -0
- package/skills/defi-attack-patterns/SKILL.md +355 -0
- package/skills/dependency-confusion/SKILL.md +178 -0
- package/skills/deserialization-insecure/JAVA_GADGET_CHAINS.md +511 -0
- package/skills/deserialization-insecure/SKILL.md +725 -0
- package/skills/dns-rebinding-attacks/SKILL.md +337 -0
- package/skills/email-header-injection/SKILL.md +349 -0
- package/skills/expression-language-injection/SKILL.md +243 -0
- package/skills/file-access-vuln/SKILL.md +33 -0
- package/skills/format-string-exploitation/SKILL.md +312 -0
- package/skills/ghost-bits-cast-attack/PAYLOAD_COOKBOOK.md +448 -0
- package/skills/ghost-bits-cast-attack/SKILL.md +799 -0
- package/skills/graphql-and-hidden-parameters/SKILL.md +50 -0
- package/skills/hack/SKILL.md +162 -0
- package/skills/hash-attack-techniques/SKILL.md +491 -0
- package/skills/heap-exploitation/HOUSE_OF_TECHNIQUES.md +244 -0
- package/skills/heap-exploitation/IO_FILE_EXPLOITATION.md +256 -0
- package/skills/heap-exploitation/SKILL.md +217 -0
- package/skills/http-host-header-attacks/SKILL.md +323 -0
- package/skills/http-parameter-pollution/SKILL.md +208 -0
- package/skills/http2-specific-attacks/SKILL.md +350 -0
- package/skills/idor-broken-object-authorization/SKILL.md +336 -0
- package/skills/injection-checking/EXTRA_INJECTION_TYPES.md +450 -0
- package/skills/injection-checking/SKILL.md +50 -0
- package/skills/insecure-source-code-management/SKILL.md +161 -0
- package/skills/ios-pentesting-tricks/IOS_RUNTIME_TRICKS.md +411 -0
- package/skills/ios-pentesting-tricks/SKILL.md +418 -0
- package/skills/jndi-injection/SKILL.md +265 -0
- package/skills/jwt-oauth-token-attacks/SKILL.md +301 -0
- package/skills/kernel-exploitation/KERNEL_HEAP_TECHNIQUES.md +293 -0
- package/skills/kernel-exploitation/KERNEL_MITIGATION_BYPASS.md +224 -0
- package/skills/kernel-exploitation/SKILL.md +307 -0
- package/skills/kubernetes-pentesting/SKILL.md +348 -0
- package/skills/lattice-crypto-attacks/SKILL.md +497 -0
- package/skills/linux-lateral-movement/SKILL.md +348 -0
- package/skills/linux-privilege-escalation/KERNEL_EXPLOITS_CHECKLIST.md +260 -0
- package/skills/linux-privilege-escalation/SKILL.md +346 -0
- package/skills/linux-privilege-escalation/SUID_CAPABILITIES_TRICKS.md +305 -0
- package/skills/linux-security-bypass/SKILL.md +345 -0
- package/skills/llm-prompt-injection/JAILBREAK_PATTERNS.md +306 -0
- package/skills/llm-prompt-injection/SKILL.md +357 -0
- package/skills/macos-process-injection/DYLIB_XPC_TECHNIQUES.md +373 -0
- package/skills/macos-process-injection/SKILL.md +384 -0
- package/skills/macos-security-bypass/SKILL.md +337 -0
- package/skills/macos-security-bypass/TCC_BYPASS_MATRIX.md +200 -0
- package/skills/memory-forensics-volatility/SKILL.md +323 -0
- package/skills/memory-forensics-volatility/VOLATILITY_CHEATSHEET.md +225 -0
- package/skills/mobile-ssl-pinning-bypass/SKILL.md +531 -0
- package/skills/network-protocol-attacks/NAME_RESOLUTION_POISONING.md +226 -0
- package/skills/network-protocol-attacks/SKILL.md +330 -0
- package/skills/nosql-injection/SKILL.md +341 -0
- package/skills/ntlm-relay-coercion/COERCION_METHODS.md +253 -0
- package/skills/ntlm-relay-coercion/SKILL.md +267 -0
- package/skills/oauth-oidc-misconfiguration/SKILL.md +46 -0
- package/skills/open-redirect/SKILL.md +380 -0
- package/skills/path-traversal-lfi/SKILL.md +802 -0
- package/skills/prototype-pollution/SKILL.md +190 -0
- package/skills/prototype-pollution-advanced/KNOWN_GADGETS.md +253 -0
- package/skills/prototype-pollution-advanced/SKILL.md +338 -0
- package/skills/race-condition/SKILL.md +526 -0
- package/skills/recon-and-methodology/SKILL.md +389 -0
- package/skills/recon-for-sec/SKILL.md +29 -0
- package/skills/request-smuggling/H2_SMUGGLING_VARIANTS.md +498 -0
- package/skills/request-smuggling/SKILL.md +314 -0
- package/skills/reverse-shell-techniques/SHELL_CHEATSHEET.md +196 -0
- package/skills/reverse-shell-techniques/SKILL.md +290 -0
- package/skills/rsa-attack-techniques/RSA_ATTACK_CATALOG.md +432 -0
- package/skills/rsa-attack-techniques/SKILL.md +437 -0
- package/skills/saml-sso-assertion-attacks/SKILL.md +41 -0
- package/skills/sandbox-escape-techniques/PYTHON_SANDBOX_ESCAPE.md +349 -0
- package/skills/sandbox-escape-techniques/SECCOMP_BYPASS.md +332 -0
- package/skills/sandbox-escape-techniques/SKILL.md +250 -0
- package/skills/smart-contract-vulnerabilities/SKILL.md +314 -0
- package/skills/smart-contract-vulnerabilities/SOLIDITY_VULN_PATTERNS.md +460 -0
- package/skills/sqli-sql-injection/SCENARIOS.md +575 -0
- package/skills/sqli-sql-injection/SKILL.md +489 -0
- package/skills/sqli-sql-injection/SQLMAP_ADVANCED.md +642 -0
- package/skills/ssrf-server-side-request-forgery/SCENARIOS.md +226 -0
- package/skills/ssrf-server-side-request-forgery/SKILL.md +323 -0
- package/skills/ssrf-server-side-request-forgery/URL_PARSER_TRICKS.md +650 -0
- package/skills/ssti-server-side-template-injection/ENGINE_PAYLOADS.md +456 -0
- package/skills/ssti-server-side-template-injection/SCENARIOS.md +319 -0
- package/skills/ssti-server-side-template-injection/SKILL.md +344 -0
- package/skills/stack-overflow-and-rop/ROP_ADVANCED_TECHNIQUES.md +249 -0
- package/skills/stack-overflow-and-rop/SKILL.md +304 -0
- package/skills/steganography-techniques/SKILL.md +348 -0
- package/skills/steganography-techniques/STEGO_TOOLS_GUIDE.md +335 -0
- package/skills/subdomain-takeover/SKILL.md +247 -0
- package/skills/symbolic-execution-tools/ANGR_COOKBOOK.md +437 -0
- package/skills/symbolic-execution-tools/SKILL.md +419 -0
- package/skills/symmetric-cipher-attacks/BLOCK_CIPHER_ATTACKS.md +364 -0
- package/skills/symmetric-cipher-attacks/SKILL.md +462 -0
- package/skills/traffic-analysis-pcap/SKILL.md +341 -0
- package/skills/tunneling-and-pivoting/SKILL.md +343 -0
- package/skills/type-juggling/SKILL.md +291 -0
- package/skills/unauthorized-access-common-services/PORT_SERVICE_MATRIX.md +340 -0
- package/skills/unauthorized-access-common-services/SKILL.md +388 -0
- package/skills/upload-insecure-files/SCENARIOS.md +158 -0
- package/skills/upload-insecure-files/SKILL.md +543 -0
- package/skills/vm-and-bytecode-reverse/SKILL.md +450 -0
- package/skills/vr-cheatsheet-authentication_bypass/SKILL.md +184 -0
- package/skills/vr-cheatsheet-dangerous_functions/SKILL.md +200 -0
- package/skills/vr-cheatsheet-linux_commands/SKILL.md +40 -0
- package/skills/vr-cheatsheet-rce/SKILL.md +177 -0
- package/skills/vr-cheatsheet-reverse_engineering/SKILL.md +144 -0
- package/skills/vr-cheatsheet-sqli/SKILL.md +270 -0
- package/skills/vr-cheatsheet-ssrf/SKILL.md +173 -0
- package/skills/vr-cheatsheet-xss/SKILL.md +177 -0
- package/skills/vr-methodology-mindset_and_tips/SKILL.md +51 -0
- package/skills/vr-template-vulnerability_report_template/SKILL.md +59 -0
- package/skills/vr-writeup-CVE-2026-9136/SKILL.md +171 -0
- package/skills/vr-writeup-ZVE-2026-3795/SKILL.md +350 -0
- package/skills/vr-writeup-api_key_leak/SKILL.md +103 -0
- package/skills/waf-bypass-techniques/SKILL.md +290 -0
- package/skills/waf-bypass-techniques/WAF_PRODUCT_MATRIX.md +202 -0
- package/skills/web-cache-deception/CACHE_POISONING_TECHNIQUES.md +637 -0
- package/skills/web-cache-deception/SKILL.md +222 -0
- package/skills/websocket-security/SKILL.md +454 -0
- package/skills/windows-av-evasion/AMSI_BYPASS_TECHNIQUES.md +289 -0
- package/skills/windows-av-evasion/SKILL.md +342 -0
- package/skills/windows-lateral-movement/CREDENTIAL_DUMPING.md +308 -0
- package/skills/windows-lateral-movement/SKILL.md +335 -0
- package/skills/windows-privilege-escalation/SKILL.md +328 -0
- package/skills/windows-privilege-escalation/TOKEN_POTATO_TRICKS.md +216 -0
- package/skills/windows-privilege-escalation/UAC_BYPASS_METHODS.md +225 -0
- package/skills/xslt-injection/SKILL.md +281 -0
- package/skills/xss-cross-site-scripting/ADVANCED_XSS_TRICKS.md +276 -0
- package/skills/xss-cross-site-scripting/SCENARIOS.md +278 -0
- package/skills/xss-cross-site-scripting/SKILL.md +379 -0
- package/skills/xxe-xml-external-entity/SCENARIOS.md +112 -0
- package/skills/xxe-xml-external-entity/SKILL.md +554 -0
- package/src/agent.js +1 -1
- package/src/session.js +47 -11
- package/src/skills.js +30 -6
- package/src/ui.js +1 -1
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Protection Bypass Matrix — Comprehensive Cross-Reference
|
|
2
|
+
|
|
3
|
+
> **AI LOAD INSTRUCTION**: Load this for a systematic lookup of which bypass technique works against which protection, and what primitive is required. Assumes [SKILL.md](./SKILL.md) is loaded for individual protection details.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. PROTECTION × BYPASS × PRIMITIVE MATRIX
|
|
8
|
+
|
|
9
|
+
### ASLR Bypass
|
|
10
|
+
|
|
11
|
+
| Bypass Technique | Required Primitive | Success Rate | Architecture | Notes |
|
|
12
|
+
|---|---|---|---|---|
|
|
13
|
+
| Format string leak | `printf(user_input)` | 100% (deterministic) | Any | `%p` leak stack/libc/heap addresses |
|
|
14
|
+
| OOB read | Array bounds violation | 100% | Any | Read adjacent pointers |
|
|
15
|
+
| UAF read | Use-after-free | 100% | Any | Read freed chunk fd/bk → libc/heap |
|
|
16
|
+
| Brute force | Ability to retry | ~1/4096 (32-bit) | x86 only | Infeasible on 64-bit (28-bit entropy) |
|
|
17
|
+
| Partial overwrite | 1-2 byte write | 1/16 per nibble | Any | Page offset (12 bits) is fixed |
|
|
18
|
+
| ret2dlresolve | Stack overflow + writable area | 100% | Any | No ASLR knowledge needed |
|
|
19
|
+
| SROP | Stack overflow + sigreturn gadget | 100% | Any | Set all registers without knowledge |
|
|
20
|
+
| Return-to-PLT | Stack overflow | 100% | No PIE | PLT addresses fixed without PIE |
|
|
21
|
+
| Stack reading | Fork server + crash oracle | 100% | Any | Byte-by-byte in child process |
|
|
22
|
+
| stdout FILE abuse | Write to stdout structure | 100% | Any | Partial overwrite `_IO_write_base` |
|
|
23
|
+
|
|
24
|
+
### PIE Bypass
|
|
25
|
+
|
|
26
|
+
| Bypass Technique | Required Primitive | Success Rate | Notes |
|
|
27
|
+
|---|---|---|---|
|
|
28
|
+
| Leak .text pointer | Read from stack (return addr) | 100% | PIE base = addr - offset |
|
|
29
|
+
| Partial overwrite | 1-2 byte overflow | 1/16 | Last 12 bits fixed |
|
|
30
|
+
| BROP | Fork server, crash probing | ~100% | Blind discovery without binary |
|
|
31
|
+
| Relative addressing | Known offset between objects | 100% | Intra-binary references |
|
|
32
|
+
|
|
33
|
+
### NX Bypass
|
|
34
|
+
|
|
35
|
+
| Bypass Technique | Required Primitive | Gadget Requirement | Notes |
|
|
36
|
+
|---|---|---|---|
|
|
37
|
+
| ROP chain | Stack overflow | `pop reg; ret` gadgets | Standard approach |
|
|
38
|
+
| ret2libc | Stack overflow | `pop rdi; ret` (64-bit) | Call system/execve |
|
|
39
|
+
| ret2csu | Stack overflow | `__libc_csu_init` | 3 args without `pop rdx` |
|
|
40
|
+
| SROP | Stack overflow | `syscall; ret` + sigreturn | Set all registers |
|
|
41
|
+
| mprotect chain | Stack overflow + known address | `pop rdi/rsi/rdx; ret` | Make page RWX |
|
|
42
|
+
| JIT spray | JIT engine present | None | Plant code in JIT pages |
|
|
43
|
+
|
|
44
|
+
### Canary Bypass
|
|
45
|
+
|
|
46
|
+
| Bypass Technique | Required Primitive | Condition | Notes |
|
|
47
|
+
|---|---|---|---|
|
|
48
|
+
| Format string leak | `printf(user_input)` | Canary on stack before return addr | `%N$p` reads canary |
|
|
49
|
+
| Brute force | Fork server | Canary same in child | 256 × 7 attempts (64-bit) |
|
|
50
|
+
| Stack reading | One-byte write/read | Overwrite null byte, read error | Output-based oracle |
|
|
51
|
+
| Thread TLS overwrite | Large overflow | Overflow reaches `fs:[0x28]` | Overwrite canary source |
|
|
52
|
+
| `__stack_chk_fail` GOT | Partial RELRO + write | GOT writable | Replace with no-op |
|
|
53
|
+
| Avoid stack entirely | Heap vulnerability | No canary on heap | Heap exploitation path |
|
|
54
|
+
|
|
55
|
+
### RELRO Bypass
|
|
56
|
+
|
|
57
|
+
| RELRO Level | Writable Targets | Bypass |
|
|
58
|
+
|---|---|---|
|
|
59
|
+
| None | `.got`, `.got.plt`, `.dynamic` | Direct GOT overwrite |
|
|
60
|
+
| Partial | `.got.plt` (lazy binding entries) | GOT overwrite on lazy-bound functions |
|
|
61
|
+
| Full | Nothing in GOT | `__malloc_hook` (pre-2.34), `_IO_FILE`, `exit_funcs`, stack, `.fini_array` |
|
|
62
|
+
|
|
63
|
+
### Full RELRO Alternative Target Matrix
|
|
64
|
+
|
|
65
|
+
| Target | glibc Version | Required Knowledge | Overwrite Size | Trigger |
|
|
66
|
+
|---|---|---|---|---|
|
|
67
|
+
| `__malloc_hook` | < 2.34 | libc base | 8 bytes | Any malloc (printf with large fmt) |
|
|
68
|
+
| `__free_hook` | < 2.34 | libc base | 8 bytes | Any free |
|
|
69
|
+
| `__realloc_hook` | < 2.34 | libc base | 8 bytes | Any realloc |
|
|
70
|
+
| `_IO_list_all` | Any | libc base | 8 bytes | exit / abort |
|
|
71
|
+
| `_IO_FILE vtable` | Any (bypass varies) | libc base + heap | 8 bytes + fake vtable | I/O operation or exit |
|
|
72
|
+
| `__exit_funcs` | Any | libc base + pointer guard | 8 bytes (mangled) | exit() |
|
|
73
|
+
| `TLS_dtor_list` | ≥ 2.34 | TLS addr + pointer guard | 8 bytes (mangled) | Thread exit / exit() |
|
|
74
|
+
| `.fini_array` | If writable | Binary base | 8 bytes | Normal program exit |
|
|
75
|
+
| `_dl_fini` link_map | Any | ld.so base | Multiple fields | exit() |
|
|
76
|
+
| Stack return address | Always | Stack address | 8 bytes | Function return |
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## 2. COMBINED PROTECTION SCENARIOS
|
|
81
|
+
|
|
82
|
+
### Scenario: NX + ASLR + Canary + Partial RELRO (Typical CTF)
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
1. Leak canary via format string or info disclosure
|
|
86
|
+
2. Leak libc address via format string or PLT leak (puts@GOT)
|
|
87
|
+
3. Craft ROP chain: pop_rdi → "/bin/sh" → system (ret2libc)
|
|
88
|
+
4. Overflow: [padding][canary][saved_rbp][ROP chain]
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Scenario: NX + ASLR + Canary + Full RELRO + PIE
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
1. Format string (multi-shot): leak canary + PIE base + libc base
|
|
95
|
+
2. Cannot overwrite GOT (Full RELRO) → target __malloc_hook or _IO_FILE
|
|
96
|
+
3. Second format string or overflow: write target address
|
|
97
|
+
4. Trigger: call malloc (for __malloc_hook) or exit (for _IO_FILE)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Scenario: NX + ASLR + No Canary + No PIE + Partial RELRO (Beginner CTF)
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
1. No canary → direct overflow to return address
|
|
104
|
+
2. No PIE → binary addresses known → PLT/GOT addresses fixed
|
|
105
|
+
3. Leak libc: overflow → puts@plt(puts@GOT) → leak → main
|
|
106
|
+
4. Second overflow: system("/bin/sh") or one_gadget
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Scenario: Static Binary + NX + Canary + ASLR
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
1. No libc (static) → cannot ret2libc
|
|
113
|
+
2. Need canary bypass → leak via available primitive
|
|
114
|
+
3. SROP: sigreturn to set all registers → execve("/bin/sh", NULL, NULL)
|
|
115
|
+
4. Or: ret2dlresolve not applicable (static) → rely on ROP gadgets from large binary
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## 3. COMPILATION FLAGS REFERENCE
|
|
121
|
+
|
|
122
|
+
| Protection | Enable Flag | Disable Flag |
|
|
123
|
+
|---|---|---|
|
|
124
|
+
| Canary | `-fstack-protector-all` | `-fno-stack-protector` |
|
|
125
|
+
| NX | Default on (`-z noexecstack`) | `-z execstack` |
|
|
126
|
+
| PIE | `-pie` (default on modern gcc) | `-no-pie` |
|
|
127
|
+
| Partial RELRO | `-Wl,-z,relro` (default) | `-Wl,-z,norelro` |
|
|
128
|
+
| Full RELRO | `-Wl,-z,relro,-z,now` | Omit `-z,now` |
|
|
129
|
+
| FORTIFY | `-D_FORTIFY_SOURCE=2 -O2` | Omit flag |
|
|
130
|
+
| ASLR | Kernel: `echo 2 > /proc/sys/kernel/randomize_va_space` | `echo 0 > ...` |
|
|
131
|
+
|
|
132
|
+
### QEMU/GDB Testing Flags
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# Disable all protections for testing
|
|
136
|
+
gcc -fno-stack-protector -z execstack -no-pie -Wl,-z,norelro -o vuln vuln.c
|
|
137
|
+
# Disable ASLR for debugging
|
|
138
|
+
echo 0 | sudo tee /proc/sys/kernel/randomize_va_space
|
|
139
|
+
# Or per-process:
|
|
140
|
+
setarch $(uname -m) -R ./vuln
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## 4. PROTECTION INTERACTION EFFECTS
|
|
146
|
+
|
|
147
|
+
| Protection A | Protection B | Combined Effect |
|
|
148
|
+
|---|---|---|
|
|
149
|
+
| ASLR | PIE | Both code AND data randomized → need two leaks (or relative offset) |
|
|
150
|
+
| Full RELRO | glibc ≥ 2.34 | GOT + hooks both unavailable → _IO_FILE or exit_funcs only targets |
|
|
151
|
+
| Canary | ASLR | Must leak canary AND libc base before exploitation |
|
|
152
|
+
| NX | ASLR | ROP chain needed, but gadget addresses unknown → leak first |
|
|
153
|
+
| CET | Full RELRO | ROP blocked + GOT blocked → data-only attacks |
|
|
154
|
+
| FORTIFY | Canary | Format string restricted + stack overflow detected → heap path preferred |
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## 5. QUICK LOOKUP: "I HAVE X, I NEED Y"
|
|
159
|
+
|
|
160
|
+
| I Have | I Need | Path |
|
|
161
|
+
|---|---|---|
|
|
162
|
+
| Format string only | RCE | Leak canary + libc → overwrite GOT(printf→system) or hook |
|
|
163
|
+
| Stack overflow only (no leak) | RCE | ret2dlresolve or SROP (no ASLR knowledge needed) |
|
|
164
|
+
| Stack overflow + format string | RCE | Leak everything → classic ROP chain |
|
|
165
|
+
| Heap overflow only | RCE | Heap exploitation → leak libc → overwrite hook/_IO_FILE → trigger |
|
|
166
|
+
| OOB read only | Leak | Read GOT entries → libc base; read stack → canary + PIE |
|
|
167
|
+
| Arbitrary write (no leak) | RCE | Partial overwrite: .got.plt low bytes to redirect to win function |
|
|
168
|
+
| Arbitrary write + libc leak | RCE | Write one_gadget to hook (pre-2.34) or FSOP (any version) |
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: binary-protection-bypass
|
|
3
|
+
description: >-
|
|
4
|
+
Binary protection bypass playbook. Use when identifying and bypassing ASLR, PIE, NX/DEP, stack canary, RELRO, FORTIFY_SOURCE, CET, and MTE protections in ELF binaries to enable exploitation.gated: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# SKILL: Binary Protection Bypass — Expert Attack Playbook
|
|
8
|
+
|
|
9
|
+
> **AI LOAD INSTRUCTION**: Expert binary protection identification and bypass techniques. Covers ASLR, PIE, NX, RELRO, canary, FORTIFY_SOURCE, stack clash, CET shadow stack, and ARM MTE. Each protection is paired with its bypass methods and required primitives. Distilled from ctf-wiki mitigation sections and real-world exploitation. Base models often confuse which protections block which attacks and miss the combinatorial effect of multiple protections.
|
|
10
|
+
|
|
11
|
+
## 0. RELATED ROUTING
|
|
12
|
+
|
|
13
|
+
- [stack-overflow-and-rop](../stack-overflow-and-rop/SKILL.md) — ROP chains to bypass NX, ret2libc for ASLR bypass
|
|
14
|
+
- [format-string-exploitation](../format-string-exploitation/SKILL.md) — primary method for leaking canary, PIE, libc addresses
|
|
15
|
+
- [heap-exploitation](../heap-exploitation/SKILL.md) — heap attacks for RELRO bypass (when GOT is read-only)
|
|
16
|
+
- [arbitrary-write-to-rce](../arbitrary-write-to-rce/SKILL.md) — what to overwrite when GOT is protected by RELRO
|
|
17
|
+
|
|
18
|
+
### Advanced Reference
|
|
19
|
+
|
|
20
|
+
Load [PROTECTION_BYPASS_MATRIX.md](./PROTECTION_BYPASS_MATRIX.md) for comprehensive protection × bypass × primitive matrix.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 1. PROTECTION IDENTIFICATION
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
$ checksec ./binary
|
|
28
|
+
[*] '/path/to/binary'
|
|
29
|
+
Arch: amd64-64-little
|
|
30
|
+
RELRO: Full RELRO ← GOT read-only
|
|
31
|
+
Stack: Canary found ← stack canary enabled
|
|
32
|
+
NX: NX enabled ← stack not executable
|
|
33
|
+
PIE: PIE enabled ← position-independent code
|
|
34
|
+
FORTIFY: Enabled ← fortified libc functions
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Quick Identification Table
|
|
38
|
+
|
|
39
|
+
| Protection | Check Command | Binary Indicator |
|
|
40
|
+
|---|---|---|
|
|
41
|
+
| ASLR | `cat /proc/sys/kernel/randomize_va_space` | OS-level (0=off, 1=partial, 2=full) |
|
|
42
|
+
| PIE | `checksec` or `readelf -h` (Type: DYN) | Binary compiled with `-pie` |
|
|
43
|
+
| NX | `checksec` or `readelf -l` (no RWE segment) | `gcc -z noexecstack` (default on) |
|
|
44
|
+
| Canary | `checksec` or look for `__stack_chk_fail@plt` | `gcc -fstack-protector-all` |
|
|
45
|
+
| Partial RELRO | `readelf -l` (GNU_RELRO segment, `.got.plt` writable) | `gcc -Wl,-z,relro` |
|
|
46
|
+
| Full RELRO | `readelf -l` + `.got` section read-only | `gcc -Wl,-z,relro,-z,now` |
|
|
47
|
+
| FORTIFY | Presence of `__printf_chk`, `__memcpy_chk` etc. | `gcc -D_FORTIFY_SOURCE=2` |
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 2. ASLR BYPASS
|
|
52
|
+
|
|
53
|
+
ASLR randomizes base addresses of stack, heap, libc, and mmap regions at each execution.
|
|
54
|
+
|
|
55
|
+
| Bypass Method | Required Primitive | Notes |
|
|
56
|
+
|---|---|---|
|
|
57
|
+
| Information leak | Any read primitive (format string, OOB read, UAF) | Leak libc/stack/heap address → calculate base |
|
|
58
|
+
| Partial overwrite | Write primitive (limited length) | Overwrite last 1-2 bytes (page offset fixed) |
|
|
59
|
+
| Brute force (32-bit) | Ability to reconnect/retry | ~256–4096 attempts (8-12 bits entropy) |
|
|
60
|
+
| Return-to-PLT | Stack overflow | PLT addresses are at fixed offset from binary base (if no PIE) |
|
|
61
|
+
| ret2dlresolve | Stack overflow + write primitive | Resolve arbitrary function without knowing libc base |
|
|
62
|
+
| Format string leak | Format string vulnerability | `%N$p` for stack/libc/heap addresses |
|
|
63
|
+
| Stack reading | Byte-by-byte (fork server) | Read stack byte-by-byte via crash oracle |
|
|
64
|
+
|
|
65
|
+
### ASLR Entropy (x86-64 Linux)
|
|
66
|
+
|
|
67
|
+
| Region | Entropy (bits) | Positions |
|
|
68
|
+
|---|---|---|
|
|
69
|
+
| Stack | 22 | ~4M |
|
|
70
|
+
| mmap / libc | 28 | ~256M |
|
|
71
|
+
| Heap (brk) | 13 | ~8K |
|
|
72
|
+
| PIE binary | 28 | ~256M |
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## 3. PIE BYPASS
|
|
77
|
+
|
|
78
|
+
PIE (Position Independent Executable) randomizes the binary's own code/data base address.
|
|
79
|
+
|
|
80
|
+
| Bypass Method | Required Primitive | Notes |
|
|
81
|
+
|---|---|---|
|
|
82
|
+
| Information leak | Read return address from stack | PIE base = leaked_addr - known_offset |
|
|
83
|
+
| Partial overwrite | One-byte or two-byte write | Last 12 bits of page offset are fixed |
|
|
84
|
+
| Format string leak | Format string vulnerability | `%N$p` where N points to .text return address |
|
|
85
|
+
| Relative addressing | Knowledge of binary layout | If you know relative offsets, only need one leak |
|
|
86
|
+
|
|
87
|
+
### Partial Overwrite Details
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
PIE binary loaded at: 0x555555554000 (example)
|
|
91
|
+
Function at offset 0x1234: 0x555555555234
|
|
92
|
+
|
|
93
|
+
Overwrite return address last 2 bytes: 0x?234 → 0x?XXX
|
|
94
|
+
Unknown: bits 12-15 (one nibble = 4 bits = 16 possibilities)
|
|
95
|
+
Success rate: 1/16 per attempt
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## 4. NX / DEP BYPASS
|
|
101
|
+
|
|
102
|
+
NX (No-eXecute) / DEP (Data Execution Prevention) prevents execution of code on the stack/heap.
|
|
103
|
+
|
|
104
|
+
| Bypass Method | Detail |
|
|
105
|
+
|---|---|
|
|
106
|
+
| ROP (Return-Oriented Programming) | Chain existing code gadgets ending in `ret` |
|
|
107
|
+
| ret2libc | Call libc functions (system, execve) directly |
|
|
108
|
+
| ret2csu | Use `__libc_csu_init` gadgets for controlled function calls |
|
|
109
|
+
| ret2dlresolve | Forge dynamic linker structures to resolve arbitrary functions |
|
|
110
|
+
| SROP | Use sigreturn to set all registers from fake signal frame |
|
|
111
|
+
| mprotect ROP | Chain mprotect(addr, size, PROT_RWX) → make page executable → jump to shellcode |
|
|
112
|
+
| JIT spray | In JIT environments (V8, etc.), create executable code via JIT compiler |
|
|
113
|
+
|
|
114
|
+
### mprotect Chain
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
# Make stack executable, then jump to shellcode
|
|
118
|
+
rop = b'A' * offset
|
|
119
|
+
rop += p64(pop_rdi) + p64(stack_page) # page-aligned address
|
|
120
|
+
rop += p64(pop_rsi) + p64(0x1000) # size
|
|
121
|
+
rop += p64(pop_rdx) + p64(7) # PROT_READ|PROT_WRITE|PROT_EXEC
|
|
122
|
+
rop += p64(mprotect_addr)
|
|
123
|
+
rop += p64(shellcode_addr) # jump to shellcode on now-executable stack
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## 5. RELRO BYPASS
|
|
129
|
+
|
|
130
|
+
| RELRO Level | GOT Status | Bypass |
|
|
131
|
+
|---|---|---|
|
|
132
|
+
| No RELRO | GOT fully writable | Direct GOT overwrite |
|
|
133
|
+
| Partial RELRO | `.got.plt` writable (lazy binding) | GOT overwrite still works |
|
|
134
|
+
| Full RELRO | All GOT entries resolved at load, GOT read-only | Cannot write GOT → target other structures |
|
|
135
|
+
|
|
136
|
+
### Full RELRO Alternative Targets
|
|
137
|
+
|
|
138
|
+
| Target | When | How |
|
|
139
|
+
|---|---|---|
|
|
140
|
+
| `__malloc_hook` | glibc < 2.34 | Overwrite with one_gadget |
|
|
141
|
+
| `__free_hook` | glibc < 2.34 | Overwrite with `system`, trigger `free("/bin/sh")` |
|
|
142
|
+
| `_IO_FILE vtable` | Any glibc | FSOP / vtable hijack |
|
|
143
|
+
| `__exit_funcs` | Any glibc | Overwrite exit handler list |
|
|
144
|
+
| `TLS_dtor_list` | glibc ≥ 2.34 | Thread-local destructor list (needs pointer guard) |
|
|
145
|
+
| `.fini_array` | If writable | Overwrite destructor function pointers |
|
|
146
|
+
| Stack return address | Direct stack write | Overwrite return address for ROP |
|
|
147
|
+
|
|
148
|
+
See [arbitrary-write-to-rce](../arbitrary-write-to-rce/SKILL.md) for comprehensive target list.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 6. CANARY BYPASS
|
|
153
|
+
|
|
154
|
+
| Method | Condition | Detail |
|
|
155
|
+
|---|---|---|
|
|
156
|
+
| Format string leak | printf(user_input) | `%N$p` to read canary from stack |
|
|
157
|
+
| Brute-force | fork() server (canary persists in child) | Byte-by-byte: 256 × (canary_size-1) attempts |
|
|
158
|
+
| Stack reading | Partial overwrite / info leak | Overwrite canary's null byte, leak via output |
|
|
159
|
+
| Thread canary overwrite | Overflow reaches TLS | Canary at `fs:[0x28]`; overflow past buffer to TLS → overwrite canary with known value |
|
|
160
|
+
| Canary-relative overwrite | Overflow after canary but before return addr | Skip canary, only overwrite return address (rare layout) |
|
|
161
|
+
| Heap-based | Vulnerability is on heap, not stack | Canary only protects stack |
|
|
162
|
+
| __stack_chk_fail GOT overwrite | Partial RELRO | Overwrite `__stack_chk_fail@GOT` to point to harmless function → canary check passes |
|
|
163
|
+
|
|
164
|
+
### Canary Format
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
x86: 0x00XXXXXX (4 bytes, leading null byte)
|
|
168
|
+
x86-64: 0x00XXXXXXXXXXXXXX (8 bytes, leading null byte)
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
The leading `\x00` prevents string operations from accidentally reading the canary.
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## 7. FORTIFY_SOURCE BYPASS
|
|
176
|
+
|
|
177
|
+
`_FORTIFY_SOURCE=2` adds buffer size checking and restricts format string operations.
|
|
178
|
+
|
|
179
|
+
| Fortified Function | Restriction | Bypass |
|
|
180
|
+
|---|---|---|
|
|
181
|
+
| `__printf_chk` | `%n` with positional args (`%N$n`) forbidden | Use non-positional `%n` or `%hn` chain |
|
|
182
|
+
| `__memcpy_chk` | Destination buffer size checked | Use heap overflow instead of stack |
|
|
183
|
+
| `__strcpy_chk` | Same | |
|
|
184
|
+
| `__read_chk` | Read size checked against buffer | |
|
|
185
|
+
|
|
186
|
+
### Format String with FORTIFY_SOURCE
|
|
187
|
+
|
|
188
|
+
```python
|
|
189
|
+
# %1$n is blocked by __printf_chk
|
|
190
|
+
# But sequential (non-positional) %n may still work:
|
|
191
|
+
# Print exact byte count, then %hn — must be very precise
|
|
192
|
+
# Or: find unfortified printf in binary/libc via ROP
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## 8. CET (Control-flow Enforcement Technology)
|
|
198
|
+
|
|
199
|
+
Intel CET adds two mechanisms:
|
|
200
|
+
|
|
201
|
+
### Shadow Stack
|
|
202
|
+
|
|
203
|
+
- Hardware-maintained copy of return addresses
|
|
204
|
+
- On `ret`, CPU checks shadow stack matches actual stack
|
|
205
|
+
- Mismatch → `#CP` fault (control protection exception)
|
|
206
|
+
|
|
207
|
+
| Impact | Detail |
|
|
208
|
+
|---|---|
|
|
209
|
+
| ROP blocked | Return address overwrite detected on `ret` |
|
|
210
|
+
| JOP possible | `jmp [reg]` not checked by shadow stack |
|
|
211
|
+
| COP possible | `call [reg]` pushes to shadow stack but target validated by IBT |
|
|
212
|
+
|
|
213
|
+
### Indirect Branch Tracking (IBT)
|
|
214
|
+
|
|
215
|
+
- Indirect `jmp`/`call` must land on `ENDBR64` instruction
|
|
216
|
+
- Non-ENDBR landing → `#CP` fault
|
|
217
|
+
|
|
218
|
+
**Bypass**:
|
|
219
|
+
- Data-only attacks (don't change control flow)
|
|
220
|
+
- Find valid ENDBR gadgets that chain into useful operations
|
|
221
|
+
- JOP with ENDBR-prefixed gadgets
|
|
222
|
+
- Target structures outside CFI scope (modprobe_path, function pointer arrays)
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## 9. MTE (Memory Tagging Extension, ARM)
|
|
227
|
+
|
|
228
|
+
ARM MTE assigns 4-bit tags to memory pointers and allocations. Tag mismatch = fault.
|
|
229
|
+
|
|
230
|
+
| Aspect | Detail |
|
|
231
|
+
|---|---|
|
|
232
|
+
| Tag bits | 4 bits in pointer (bits 56-59) = 16 possible tags |
|
|
233
|
+
| Granule | 16 bytes (each 16-byte granule has one tag) |
|
|
234
|
+
| Check | Load/store: pointer tag must match memory tag |
|
|
235
|
+
| Probabilistic | Random tag → 1/16 chance attacker guesses correctly |
|
|
236
|
+
|
|
237
|
+
### Bypass Approaches
|
|
238
|
+
|
|
239
|
+
| Method | Success Rate |
|
|
240
|
+
|---|---|
|
|
241
|
+
| Brute-force | 1/16 per attempt (6.25%) |
|
|
242
|
+
| Tag oracle | Side-channel to determine tag (timing, error messages) |
|
|
243
|
+
| In-bounds exploit | Stay within same tagged region (use relative offsets) |
|
|
244
|
+
| Tag bypass gadget | Use `LDGM`/`STGM` instructions if accessible |
|
|
245
|
+
| Speculative execution | Spectre-style bypass of tag check |
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## 10. DECISION TREE
|
|
250
|
+
|
|
251
|
+
```
|
|
252
|
+
Binary analysis: checksec output
|
|
253
|
+
├── NX disabled?
|
|
254
|
+
│ └── Shellcode on stack/heap (simplest path)
|
|
255
|
+
│
|
|
256
|
+
├── NX enabled (standard modern binary)?
|
|
257
|
+
│ ├── Need code execution → ROP/ret2libc
|
|
258
|
+
│ │
|
|
259
|
+
│ ├── Canary enabled?
|
|
260
|
+
│ │ ├── fork server? → byte-by-byte brute-force
|
|
261
|
+
│ │ ├── Format string? → leak canary via %p
|
|
262
|
+
│ │ ├── Heap vuln? → canary doesn't protect heap
|
|
263
|
+
│ │ └── Partial RELRO? → overwrite __stack_chk_fail@GOT
|
|
264
|
+
│ │
|
|
265
|
+
│ ├── PIE enabled?
|
|
266
|
+
│ │ ├── Format string? → leak .text address → PIE base
|
|
267
|
+
│ │ ├── Partial overwrite → last 12 bits fixed (1/16 brute-force)
|
|
268
|
+
│ │ └── OOB read? → leak code pointer
|
|
269
|
+
│ │
|
|
270
|
+
│ ├── ASLR enabled?
|
|
271
|
+
│ │ ├── Info leak available → leak libc base
|
|
272
|
+
│ │ ├── No leak → ret2dlresolve or SROP
|
|
273
|
+
│ │ ├── 32-bit? → brute-force feasible (~4096 attempts)
|
|
274
|
+
│ │ └── Return-to-PLT (no libc base needed for PLT calls)
|
|
275
|
+
│ │
|
|
276
|
+
│ ├── RELRO level?
|
|
277
|
+
│ │ ├── None/Partial → GOT overwrite
|
|
278
|
+
│ │ └── Full → alternative targets:
|
|
279
|
+
│ │ ├── glibc < 2.34 → __malloc_hook / __free_hook
|
|
280
|
+
│ │ ├── glibc ≥ 2.34 → _IO_FILE / exit_funcs / TLS_dtor_list
|
|
281
|
+
│ │ ├── .fini_array (if writable)
|
|
282
|
+
│ │ └── Stack return address
|
|
283
|
+
│ │
|
|
284
|
+
│ └── FORTIFY_SOURCE?
|
|
285
|
+
│ ├── Blocks positional %n → use sequential %n or heap exploit
|
|
286
|
+
│ └── Blocks buffer overflows in fortified functions → use unfortified paths
|
|
287
|
+
│
|
|
288
|
+
├── CET (shadow stack)?
|
|
289
|
+
│ ├── ROP blocked → data-only attack or JOP
|
|
290
|
+
│ └── ENDBR-gadget chaining
|
|
291
|
+
│
|
|
292
|
+
└── MTE (ARM)?
|
|
293
|
+
├── 1/16 brute-force
|
|
294
|
+
└── Stay in-bounds for relative corruption
|
|
295
|
+
```
|