pwn 0.5.497 → 0.5.498
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.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/pwn/plugins/burp_suite.rb +134 -179
- data/lib/pwn/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c41bc76760db0b513a3ad2e622d66299878abc0470557cf342afe18b5cee66e7
|
|
4
|
+
data.tar.gz: 56af59b296710ca0a24819d7dcd122e8e058b65152a9e04202a53ff0e41c6473
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d1346423bc99955590ecd3eaa819b9af4bc584dee83e405557afc23e3a0819fb52a2a83952e09f72c37e648696fe58ad8abd6f20e91ef80821ff381728c160a0
|
|
7
|
+
data.tar.gz: 91408051ad834f50b5665f9bc1bad7b1a87e83e57641e34995aa8f79eca42e8fc98e2be59e44209609e4f0ffe212b8f774ebd4100803006c194c059e9050e69d
|
data/README.md
CHANGED
|
@@ -37,7 +37,7 @@ $ cd /opt/pwn
|
|
|
37
37
|
$ ./install.sh
|
|
38
38
|
$ ./install.sh ruby-gem
|
|
39
39
|
$ pwn
|
|
40
|
-
pwn[v0.5.
|
|
40
|
+
pwn[v0.5.498]:001 >>> PWN.help
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
[](https://youtu.be/G7iLUY4FzsI)
|
|
@@ -52,7 +52,7 @@ $ rvm use ruby-3.4.4@pwn
|
|
|
52
52
|
$ gem uninstall --all --executables pwn
|
|
53
53
|
$ gem install --verbose pwn
|
|
54
54
|
$ pwn
|
|
55
|
-
pwn[v0.5.
|
|
55
|
+
pwn[v0.5.498]:001 >>> PWN.help
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
If you're using a multi-user install of RVM do:
|
|
@@ -62,7 +62,7 @@ $ rvm use ruby-3.4.4@pwn
|
|
|
62
62
|
$ rvmsudo gem uninstall --all --executables pwn
|
|
63
63
|
$ rvmsudo gem install --verbose pwn
|
|
64
64
|
$ pwn
|
|
65
|
-
pwn[v0.5.
|
|
65
|
+
pwn[v0.5.498]:001 >>> PWN.help
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
PWN periodically upgrades to the latest version of Ruby which is reflected in `/opt/pwn/.ruby-version`. The easiest way to upgrade to the latest version of Ruby from a previous PWN installation is to run the following script:
|
|
@@ -43,6 +43,136 @@ module PWN
|
|
|
43
43
|
raise e
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
+
# Supported Method Parameters::
|
|
47
|
+
# burp_obj = PWN::Plugins::BurpSuite.init_introspection_thread(
|
|
48
|
+
# burp_obj: 'required - burp_obj returned by #start method',
|
|
49
|
+
# enumerable_array: 'required - array of items to process in the thread'
|
|
50
|
+
# )
|
|
51
|
+
private_class_method def self.init_introspection_thread(opts = {})
|
|
52
|
+
# if PWN::Env[:ai][:introspection] is true,
|
|
53
|
+
# spin up PWN::Plugins::ThreadPool to
|
|
54
|
+
# 1. Periodically call get_proxy_history(burp_obj: burp_obj) method
|
|
55
|
+
# 2. For each entry w/ empty comment,
|
|
56
|
+
# generate AI analysis via PWN::AI::Introspection.reflect_on
|
|
57
|
+
# and populate the comment field for the entry.
|
|
58
|
+
# 3. Update the highlight field based on EPSS score extracted from AI analysis.
|
|
59
|
+
# 4. Call update_proxy_history(burp_obj: burp_obj, entry: updated_entry)
|
|
60
|
+
burp_obj = opts[:burp_obj]
|
|
61
|
+
raise 'ERROR: burp_obj parameter is required' unless burp_obj.is_a?(Hash)
|
|
62
|
+
|
|
63
|
+
if PWN::Env[:ai][:introspection]
|
|
64
|
+
introspection_thread = Thread.new do
|
|
65
|
+
system_role_content = '
|
|
66
|
+
Your expertise lies in dissecting HTTP request/response pairs to identify high-impact vulnerabilities, including but not limited to XSS (reflected, stored, DOM-based), CSRF, SSRF, IDOR, open redirects, CORS misconfigurations, authentication bypasses, SQLi/NoSQLi, command/code injection, business logic flaws, and API abuse. You prioritize zero-days and novel chains, always focusing on exploitability, impact (e.g., account takeover, data exfiltration, RCE), and reproducibility.
|
|
67
|
+
|
|
68
|
+
When analyzing HTTP request/response pairs:
|
|
69
|
+
|
|
70
|
+
1. **Parse and Contextualize Traffic**:
|
|
71
|
+
- Break down every element: HTTP method, URI (path, query parameters), headers (e.g., Host, User-Agent, Cookies, Authorization, Referer, Origin, Content-Type), request body (e.g., form data, JSON payloads), response status code, response headers, and response body (HTML, JSON, XML, etc.).
|
|
72
|
+
- Identify dynamic elements: User-controlled inputs (e.g., query params, POST data, headers like X-Forwarded-For), server-side echoes, redirects, and client-side processing.
|
|
73
|
+
- Trace data flow: Map how inputs propagate from request to response, including any client-side JavaScript execution where exploitation may be possible in the client without communicating with the server (e.g. DOM-XSS).
|
|
74
|
+
|
|
75
|
+
2. **Vulnerability Hunting Framework**:
|
|
76
|
+
- **Input Validation & Sanitization**: Check for unescaped/lack of encoding in outputs (e.g., HTML context for XSS, URL context for open redirects).
|
|
77
|
+
- **XSS Focus**: Hunt for sinks like innerHTML/outerHTML, document.write, eval, setTimeout/setInterval with strings, location.href/assign/replace, and history.pushState. Test payloads like <script>alert(1)</script>, javascript:alert(1), and polyglots. For DOM-based, simulate client-side execution.
|
|
78
|
+
- **JavaScript Library Analysis**: If JS is present (e.g., in response body or referenced scripts), deobfuscate and inspect:
|
|
79
|
+
- Objects/properties that could clobber DOM (e.g., window.name, document.cookie manipulation leading to prototype pollution).
|
|
80
|
+
- DOM XSS vectors: Analyze event handlers, querySelector, addEventListener with unsanitized data from location.hash/search, postMessage, or localStorage.
|
|
81
|
+
- Third-party libs (e.g., jQuery, React): Flag known sink patterns like .html(), dangerouslySetInnerHTML, or eval-like functions.
|
|
82
|
+
- **Server-Side Issues**: Probe for SSRF (e.g., via URL params fetching internal resources), IDOR (e.g., manipulating IDs in paths/bodies), rate limiting bypass, and insecure deserialization (e.g., in JSON/PHP objects).
|
|
83
|
+
- **Headers & Misc**: Examine for exposed sensitive info (e.g., debug headers, stack traces), misconfigured security headers (CSP, HSTS), and upload flaws (e.g., file extension bypass).
|
|
84
|
+
- **Chaining Opportunities**: Always consider multi-step exploits, like XSS leading to CSRF token theft or SSRF to internal metadata endpoints.
|
|
85
|
+
|
|
86
|
+
3. **PoC Generation**:
|
|
87
|
+
- Produce concise, step-by-step PoCs in a standardized format:
|
|
88
|
+
- **Description**: Clear vuln summary, CVSS-like severity, and impact.
|
|
89
|
+
- **Steps to Reproduce**: Numbered HTTP requests (use curl or Burp syntax, e.g., `curl -X POST -d "param=<payload>" https://target.com/endpoint`).
|
|
90
|
+
- **Payloads**: Provide working, minimal payloads with variations for evasion (e.g., encoded, obfuscated).
|
|
91
|
+
- **Screenshots/Evidence**: Suggest what to capture (e.g., alert popup for XSS, response diff for IDOR).
|
|
92
|
+
- **Mitigation Advice**: Recommend fixes (e.g., output encoding, input validation).
|
|
93
|
+
- Ensure PoCs are ethical: Target only in-scope assets, avoid DoS, and emphasize disclosure via proper channels (e.g., HackerOne, Bugcrowd).
|
|
94
|
+
- If no vuln found, explain why and suggest further tests (e.g., fuzzing params).
|
|
95
|
+
4. Risk Score:
|
|
96
|
+
For each analysis generate a risk score between 0% - 100% based on exploitability and impact. This should be reflected as { "risk_score": "nnn%" } in the final output JSON.
|
|
97
|
+
|
|
98
|
+
Analyze provided HTTP request/response pairs methodically: Start with a high-level overview, then dive into specifics, flag potential issues with evidence from the traffic, and end with PoC if applicable. Be verbose in reasoning but concise in output. Prioritize high-severity findings. If data is incomplete, request clarifications.
|
|
99
|
+
'
|
|
100
|
+
|
|
101
|
+
loop do
|
|
102
|
+
# TODO: Implement sitemap and repeater into the loop.
|
|
103
|
+
# Sitemap should work the same as proxy history.
|
|
104
|
+
# Repeater should analyze the reqesut/response pair and suggest
|
|
105
|
+
# modifications to the request to further probe for vulnerabilities.
|
|
106
|
+
proxy_history = get_proxy_history(burp_obj: burp_obj)
|
|
107
|
+
proxy_history.each do |entry|
|
|
108
|
+
next unless entry.key?(:comment) && entry[:comment].to_s.strip.empty?
|
|
109
|
+
|
|
110
|
+
request = entry[:request]
|
|
111
|
+
response = entry[:response]
|
|
112
|
+
host = entry[:http_service][:host]
|
|
113
|
+
port = entry[:http_service][:port]
|
|
114
|
+
protocol = entry[:http_service][:protocol]
|
|
115
|
+
next if request.nil? || response.nil? || host.nil? || port.nil? || protocol.nil?
|
|
116
|
+
|
|
117
|
+
request = Base64.strict_decode64(request)
|
|
118
|
+
response = Base64.strict_decode64(response)
|
|
119
|
+
|
|
120
|
+
http_request_response = PWN::Plugins::Char.force_utf8("#{request}\r\n\r\n#{response}")
|
|
121
|
+
ai_analysis = PWN::AI::Introspection.reflect_on(
|
|
122
|
+
system_role_content: system_role_content,
|
|
123
|
+
request: http_request_response,
|
|
124
|
+
suppress_pii_warning: true
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
next if ai_analysis.nil? || ai_analysis.strip.empty?
|
|
128
|
+
|
|
129
|
+
entry[:comment] = ai_analysis
|
|
130
|
+
# Extract score and assign color highlight based on severity
|
|
131
|
+
if ai_analysis =~ /"risk_score":\s*"(\d{1,3})%"/
|
|
132
|
+
score = Regexp.last_match(1).to_i
|
|
133
|
+
highlight_color = case score
|
|
134
|
+
when 0..24
|
|
135
|
+
'GREEN'
|
|
136
|
+
when 25..49
|
|
137
|
+
'YELLOW'
|
|
138
|
+
when 50..74
|
|
139
|
+
'ORANGE'
|
|
140
|
+
when 75..100
|
|
141
|
+
'RED'
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
highlight_color ||= 'GRAY'
|
|
145
|
+
entry[:highlight] = highlight_color
|
|
146
|
+
|
|
147
|
+
entry.delete(:request)
|
|
148
|
+
entry.delete(:response)
|
|
149
|
+
entry.delete(:http_service)
|
|
150
|
+
|
|
151
|
+
update_proxy_history(
|
|
152
|
+
burp_obj: burp_obj,
|
|
153
|
+
entry: entry
|
|
154
|
+
)
|
|
155
|
+
end
|
|
156
|
+
sleep 10
|
|
157
|
+
end
|
|
158
|
+
rescue Errno::ECONNREFUSED
|
|
159
|
+
puts 'Thread Terminating...'
|
|
160
|
+
rescue StandardError => e
|
|
161
|
+
puts "BurpSuite AI Introspection Thread Error: #{e}"
|
|
162
|
+
puts e.backtrace
|
|
163
|
+
raise e
|
|
164
|
+
ensure
|
|
165
|
+
puts 'BurpSuite AI Introspection Thread >>> Goodbye.'
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
burp_obj[:introspection_thread] = introspection_thread
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
burp_obj
|
|
172
|
+
rescue StandardError => e
|
|
173
|
+
raise e
|
|
174
|
+
end
|
|
175
|
+
|
|
46
176
|
# Supported Method Parameters::
|
|
47
177
|
# burp_obj1 = PWN::Plugins::BurpSuite.start(
|
|
48
178
|
# burp_jar_path: 'optional - path of burp suite pro jar file (defaults to /opt/burpsuite/burpsuite_pro.jar)',
|
|
@@ -124,117 +254,7 @@ module PWN
|
|
|
124
254
|
enabled: true
|
|
125
255
|
)
|
|
126
256
|
|
|
127
|
-
|
|
128
|
-
# spin up PWN::Plugins::ThreadPool to
|
|
129
|
-
# 1. Periodically call get_proxy_history(burp_obj: burp_obj) method
|
|
130
|
-
# 2. For each entry w/ empty comment,
|
|
131
|
-
# generate AI analysis via PWN::AI::Introspection.reflect_on
|
|
132
|
-
# and populate the comment field for the entry.
|
|
133
|
-
# 3. Update the highlight field based on EPSS score extracted from AI analysis.
|
|
134
|
-
# 4. Call update_proxy_history(burp_obj: burp_obj, entry: updated_entry)
|
|
135
|
-
if PWN::Env[:ai][:introspection]
|
|
136
|
-
proxy_history_introspection = Thread.new do
|
|
137
|
-
loop do
|
|
138
|
-
proxy_history = get_proxy_history(burp_obj: burp_obj)
|
|
139
|
-
proxy_history.each do |entry|
|
|
140
|
-
next unless entry.key?(:comment) && entry[:comment].to_s.strip.empty?
|
|
141
|
-
|
|
142
|
-
request = entry[:request]
|
|
143
|
-
response = entry[:response]
|
|
144
|
-
host = entry[:http_service][:host]
|
|
145
|
-
port = entry[:http_service][:port]
|
|
146
|
-
protocol = entry[:http_service][:protocol]
|
|
147
|
-
next if request.nil? || response.nil? || host.nil? || port.nil? || protocol.nil?
|
|
148
|
-
|
|
149
|
-
request = Base64.strict_decode64(request)
|
|
150
|
-
response = Base64.strict_decode64(response)
|
|
151
|
-
|
|
152
|
-
http_request_response = PWN::Plugins::Char.force_utf8("#{request}\r\n\r\n#{response}")
|
|
153
|
-
system_role_content = '
|
|
154
|
-
Your expertise lies in dissecting HTTP request/response pairs to identify high-impact vulnerabilities, including but not limited to XSS (reflected, stored, DOM-based), CSRF, SSRF, IDOR, open redirects, CORS misconfigurations, authentication bypasses, SQLi/NoSQLi, command/code injection, business logic flaws, and API abuse. You prioritize zero-days and novel chains, always focusing on exploitability, impact (e.g., account takeover, data exfiltration, RCE), and reproducibility.
|
|
155
|
-
|
|
156
|
-
When analyzing HTTP request/response pairs:
|
|
157
|
-
|
|
158
|
-
1. **Parse and Contextualize Traffic**:
|
|
159
|
-
- Break down every element: HTTP method, URI (path, query parameters), headers (e.g., Host, User-Agent, Cookies, Authorization, Referer, Origin, Content-Type), request body (e.g., form data, JSON payloads), response status code, response headers, and response body (HTML, JSON, XML, etc.).
|
|
160
|
-
- Identify dynamic elements: User-controlled inputs (e.g., query params, POST data, headers like X-Forwarded-For), server-side echoes, redirects, and client-side processing.
|
|
161
|
-
- Trace data flow: Map how inputs propagate from request to response, including any client-side JavaScript execution where exploitation may be possible in the client without communicating with the server (e.g. DOM-XSS).
|
|
162
|
-
|
|
163
|
-
2. **Vulnerability Hunting Framework**:
|
|
164
|
-
- **Input Validation & Sanitization**: Check for unescaped/lack of encoding in outputs (e.g., HTML context for XSS, URL context for open redirects).
|
|
165
|
-
- **XSS Focus**: Hunt for sinks like innerHTML/outerHTML, document.write, eval, setTimeout/setInterval with strings, location.href/assign/replace, and history.pushState. Test payloads like <script>alert(1)</script>, javascript:alert(1), and polyglots. For DOM-based, simulate client-side execution.
|
|
166
|
-
- **JavaScript Library Analysis**: If JS is present (e.g., in response body or referenced scripts), deobfuscate and inspect:
|
|
167
|
-
- Objects/properties that could clobber DOM (e.g., window.name, document.cookie manipulation leading to prototype pollution).
|
|
168
|
-
- DOM XSS vectors: Analyze event handlers, querySelector, addEventListener with unsanitized data from location.hash/search, postMessage, or localStorage.
|
|
169
|
-
- Third-party libs (e.g., jQuery, React): Flag known sink patterns like .html(), dangerouslySetInnerHTML, or eval-like functions.
|
|
170
|
-
- **Server-Side Issues**: Probe for SSRF (e.g., via URL params fetching internal resources), IDOR (e.g., manipulating IDs in paths/bodies), rate limiting bypass, and insecure deserialization (e.g., in JSON/PHP objects).
|
|
171
|
-
- **Headers & Misc**: Examine for exposed sensitive info (e.g., debug headers, stack traces), misconfigured security headers (CSP, HSTS), and upload flaws (e.g., file extension bypass).
|
|
172
|
-
- **Chaining Opportunities**: Always consider multi-step exploits, like XSS leading to CSRF token theft or SSRF to internal metadata endpoints.
|
|
173
|
-
|
|
174
|
-
3. **PoC Generation**:
|
|
175
|
-
- Produce concise, step-by-step PoCs in a standardized format:
|
|
176
|
-
- **Description**: Clear vuln summary, CVSS-like severity, and impact.
|
|
177
|
-
- **Steps to Reproduce**: Numbered HTTP requests (use curl or Burp syntax, e.g., `curl -X POST -d "param=<payload>" https://target.com/endpoint`).
|
|
178
|
-
- **Payloads**: Provide working, minimal payloads with variations for evasion (e.g., encoded, obfuscated).
|
|
179
|
-
- **Screenshots/Evidence**: Suggest what to capture (e.g., alert popup for XSS, response diff for IDOR).
|
|
180
|
-
- **Mitigation Advice**: Recommend fixes (e.g., output encoding, input validation).
|
|
181
|
-
- Ensure PoCs are ethical: Target only in-scope assets, avoid DoS, and emphasize disclosure via proper channels (e.g., HackerOne, Bugcrowd).
|
|
182
|
-
- If no vuln found, explain why and suggest further tests (e.g., fuzzing params).
|
|
183
|
-
4. Risk Score:
|
|
184
|
-
For each analysis generate a risk score between 0% - 100% based on exploitability and impact. This should be reflected as { "risk_score": "nnn%" } in the final output JSON.
|
|
185
|
-
|
|
186
|
-
Analyze provided HTTP request/response pairs methodically: Start with a high-level overview, then dive into specifics, flag potential issues with evidence from the traffic, and end with PoC if applicable. Be verbose in reasoning but concise in output. Prioritize high-severity findings. If data is incomplete, request clarifications.
|
|
187
|
-
'
|
|
188
|
-
|
|
189
|
-
ai_analysis = PWN::AI::Introspection.reflect_on(
|
|
190
|
-
system_role_content: system_role_content,
|
|
191
|
-
request: http_request_response,
|
|
192
|
-
suppress_pii_warning: true
|
|
193
|
-
)
|
|
194
|
-
|
|
195
|
-
next if ai_analysis.nil? || ai_analysis.strip.empty?
|
|
196
|
-
|
|
197
|
-
entry[:comment] = ai_analysis
|
|
198
|
-
# Extract score and assign color highlight based on severity
|
|
199
|
-
if ai_analysis =~ /"risk_score":\s*"(\d{1,3})%"/
|
|
200
|
-
score = Regexp.last_match(1).to_i
|
|
201
|
-
highlight_color = case score
|
|
202
|
-
when 0..24
|
|
203
|
-
'GREEN'
|
|
204
|
-
when 25..49
|
|
205
|
-
'YELLOW'
|
|
206
|
-
when 50..74
|
|
207
|
-
'ORANGE'
|
|
208
|
-
when 75..100
|
|
209
|
-
'RED'
|
|
210
|
-
end
|
|
211
|
-
end
|
|
212
|
-
highlight_color ||= 'GRAY'
|
|
213
|
-
entry[:highlight] = highlight_color
|
|
214
|
-
|
|
215
|
-
entry.delete(:request)
|
|
216
|
-
entry.delete(:response)
|
|
217
|
-
entry.delete(:http_service)
|
|
218
|
-
|
|
219
|
-
update_proxy_history(
|
|
220
|
-
burp_obj: burp_obj,
|
|
221
|
-
entry: entry
|
|
222
|
-
)
|
|
223
|
-
end
|
|
224
|
-
sleep 10
|
|
225
|
-
end
|
|
226
|
-
rescue Errno::ECONNREFUSED
|
|
227
|
-
puts 'BurpSuite Proxy History AI Introspection Thread Terminating...'
|
|
228
|
-
rescue StandardError => e
|
|
229
|
-
puts "BurpSuite Proxy History AI Introspection Thread Error: #{e}"
|
|
230
|
-
puts e.backtrace
|
|
231
|
-
raise e
|
|
232
|
-
end
|
|
233
|
-
|
|
234
|
-
burp_obj[:proxy_history_introspection_thread] = proxy_history_introspection
|
|
235
|
-
end
|
|
236
|
-
|
|
237
|
-
burp_obj
|
|
257
|
+
init_introspection_thread(burp_obj: burp_obj)
|
|
238
258
|
rescue StandardError => e
|
|
239
259
|
stop(burp_obj: burp_obj) unless burp_obj.nil?
|
|
240
260
|
raise e
|
|
@@ -906,70 +926,6 @@ module PWN
|
|
|
906
926
|
sitemap = opts[:sitemap] ||= {}
|
|
907
927
|
debug = opts[:debug] || false
|
|
908
928
|
|
|
909
|
-
request = Base64.strict_decode64(sitemap[:request])
|
|
910
|
-
response = Base64.strict_decode64(sitemap[:response])
|
|
911
|
-
|
|
912
|
-
http_request_response = PWN::Plugins::Char.force_utf8("#{request}\r\n\r\n#{response}")
|
|
913
|
-
|
|
914
|
-
system_role_content = '
|
|
915
|
-
Your expertise lies in dissecting HTTP request/response pairs to identify high-impact vulnerabilities, including but not limited to XSS (reflected, stored, DOM-based), CSRF, SSRF, IDOR, open redirects, CORS misconfigurations, authentication bypasses, SQLi/NoSQLi, command/code injection, business logic flaws, and API abuse. You prioritize zero-days and novel chains, always focusing on exploitability, impact (e.g., account takeover, data exfiltration, RCE), and reproducibility.
|
|
916
|
-
|
|
917
|
-
When analyzing HTTP request/response pairs:
|
|
918
|
-
|
|
919
|
-
1. **Parse and Contextualize Traffic**:
|
|
920
|
-
- Break down every element: HTTP method, URI (path, query parameters), headers (e.g., Host, User-Agent, Cookies, Authorization, Referer, Origin, Content-Type), request body (e.g., form data, JSON payloads), response status code, response headers, and response body (HTML, JSON, XML, etc.).
|
|
921
|
-
- Identify dynamic elements: User-controlled inputs (e.g., query params, POST data, headers like X-Forwarded-For), server-side echoes, redirects, and client-side processing.
|
|
922
|
-
- Trace data flow: Map how inputs propagate from request to response, including any client-side JavaScript execution where exploitation may be possible in the client without communicating with the server (e.g. DOM-XSS).
|
|
923
|
-
|
|
924
|
-
2. **Vulnerability Hunting Framework**:
|
|
925
|
-
- **Input Validation & Sanitization**: Check for unescaped/lack of encoding in outputs (e.g., HTML context for XSS, URL context for open redirects).
|
|
926
|
-
- **XSS Focus**: Hunt for sinks like innerHTML/outerHTML, document.write, eval, setTimeout/setInterval with strings, location.href/assign/replace, and history.pushState. Test payloads like <script>alert(1)</script>, javascript:alert(1), and polyglots. For DOM-based, simulate client-side execution.
|
|
927
|
-
- **JavaScript Library Analysis**: If JS is present (e.g., in response body or referenced scripts), deobfuscate and inspect:
|
|
928
|
-
- Objects/properties that could clobber DOM (e.g., window.name, document.cookie manipulation leading to prototype pollution).
|
|
929
|
-
- DOM XSS vectors: Analyze event handlers, querySelector, addEventListener with unsanitized data from location.hash/search, postMessage, or localStorage.
|
|
930
|
-
- Third-party libs (e.g., jQuery, React): Flag known sink patterns like .html(), dangerouslySetInnerHTML, or eval-like functions.
|
|
931
|
-
- **Server-Side Issues**: Probe for SSRF (e.g., via URL params fetching internal resources), IDOR (e.g., manipulating IDs in paths/bodies), rate limiting bypass, and insecure deserialization (e.g., in JSON/PHP objects).
|
|
932
|
-
- **Headers & Misc**: Examine for exposed sensitive info (e.g., debug headers, stack traces), misconfigured security headers (CSP, HSTS), and upload flaws (e.g., file extension bypass).
|
|
933
|
-
- **Chaining Opportunities**: Always consider multi-step exploits, like XSS leading to CSRF token theft or SSRF to internal metadata endpoints.
|
|
934
|
-
|
|
935
|
-
3. **PoC Generation**:
|
|
936
|
-
- Produce concise, step-by-step PoCs in a standardized format:
|
|
937
|
-
- **Description**: Clear vuln summary, CVSS-like severity, and impact.
|
|
938
|
-
- **Steps to Reproduce**: Numbered HTTP requests (use curl or Burp syntax, e.g., `curl -X POST -d "param=<payload>" https://target.com/endpoint`).
|
|
939
|
-
- **Payloads**: Provide working, minimal payloads with variations for evasion (e.g., encoded, obfuscated).
|
|
940
|
-
- **Screenshots/Evidence**: Suggest what to capture (e.g., alert popup for XSS, response diff for IDOR).
|
|
941
|
-
- **Mitigation Advice**: Recommend fixes (e.g., output encoding, input validation).
|
|
942
|
-
- Ensure PoCs are ethical: Target only in-scope assets, avoid DoS, and emphasize disclosure via proper channels (e.g., HackerOne, Bugcrowd).
|
|
943
|
-
- If no vuln found, explain why and suggest further tests (e.g., fuzzing params).
|
|
944
|
-
4. Risk Score:
|
|
945
|
-
For each analysis generate a risk score between 0% - 100% based on exploitability and impact. This should be reflected as { "risk_score": "nnn%" } in the final output JSON.
|
|
946
|
-
|
|
947
|
-
Analyze provided HTTP request/response pairs methodically: Start with a high-level overview, then dive into specifics, flag potential issues with evidence from the traffic, and end with PoC if applicable. Be verbose in reasoning but concise in output. Prioritize high-severity findings. If data is incomplete, request clarifications.
|
|
948
|
-
'
|
|
949
|
-
|
|
950
|
-
ai_analysis = PWN::AI::Introspection.reflect_on(
|
|
951
|
-
system_role_content: system_role_content,
|
|
952
|
-
request: http_request_response,
|
|
953
|
-
spinner: true
|
|
954
|
-
)
|
|
955
|
-
sitemap[:comment] = ai_analysis unless ai_analysis.nil?
|
|
956
|
-
# Extract score and assign color highlight based on severity
|
|
957
|
-
if ai_analysis =~ /"risk_score":\s*"(\d{1,3})%"/
|
|
958
|
-
score = Regexp.last_match(1).to_i
|
|
959
|
-
highlight_color = case score
|
|
960
|
-
when 0..24
|
|
961
|
-
'GREEN'
|
|
962
|
-
when 25..49
|
|
963
|
-
'YELLOW'
|
|
964
|
-
when 50..74
|
|
965
|
-
'ORANGE'
|
|
966
|
-
when 75..100
|
|
967
|
-
'RED'
|
|
968
|
-
end
|
|
969
|
-
end
|
|
970
|
-
highlight_color ||= 'GRAY'
|
|
971
|
-
sitemap[:highlight] = highlight_color
|
|
972
|
-
|
|
973
929
|
rest_client = rest_browser::Request
|
|
974
930
|
response = rest_client.execute(
|
|
975
931
|
method: :post,
|
|
@@ -1826,16 +1782,15 @@ module PWN
|
|
|
1826
1782
|
|
|
1827
1783
|
public_class_method def self.stop(opts = {})
|
|
1828
1784
|
burp_obj = opts[:burp_obj]
|
|
1785
|
+
|
|
1829
1786
|
browser_obj = burp_obj[:mitm_browser]
|
|
1830
1787
|
rest_browser = burp_obj[:rest_browser]
|
|
1831
1788
|
mitm_rest_api = burp_obj[:mitm_rest_api]
|
|
1832
|
-
|
|
1833
|
-
|
|
1789
|
+
introspection_thread = burp_obj[:introspection_thread]
|
|
1790
|
+
introspection_thread.kill unless introspection_thread.nil?
|
|
1834
1791
|
|
|
1835
|
-
proxy_intruder_thread.kill unless proxy_intruder_thread.nil?
|
|
1836
1792
|
PWN::Plugins::TransparentBrowser.close(browser_obj: browser_obj)
|
|
1837
1793
|
rest_browser.post("http://#{mitm_rest_api}/shutdown", '')
|
|
1838
|
-
# Process.kill('TERM', burp_pid)
|
|
1839
1794
|
|
|
1840
1795
|
burp_obj = nil
|
|
1841
1796
|
rescue StandardError => e
|
data/lib/pwn/version.rb
CHANGED