pwn 0.5.538 → 0.5.539
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/ai/agent/burp_suite.rb +81 -0
- data/lib/pwn/ai/agent.rb +21 -0
- data/lib/pwn/ai.rb +1 -0
- data/lib/pwn/plugins/burp_suite.rb +6 -48
- data/lib/pwn/version.rb +1 -1
- data/spec/lib/pwn/ai/agent/burp_suite_spec.rb +20 -0
- data/spec/lib/pwn/ai/agent_spec.rb +10 -0
- metadata +5 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 28e2d9f826bd3fdd281a2fb31c794596390e7a8c933503c16d4af32862b1584a
|
|
4
|
+
data.tar.gz: b3aa66dd40f8c2bba18b9ac1a9192dde92e906962fad90ae9d063e78e8a8d5a7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bc3dc9ce7e3ff1cb2b83e65e352efaf0d2fc838f34cb606e810deae54c6b5e9b2fc70b2d0f254b7a797d737abdf2381342a5bda71e8b53eeaabea36d8466bb97
|
|
7
|
+
data.tar.gz: cd0a2c06cf19d4d4c432bb8a45b9b910f07d575af9290658e7abe2934431256e966c904051ee2b372e861259a6a54d0753050b04386258b03ed0637274d7adc3
|
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.539]:001 >>> PWN.help
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
[](https://youtu.be/G7iLUY4FzsI)
|
|
@@ -52,7 +52,7 @@ $ rvm use ruby-4.0.1@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.539]: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-4.0.1@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.539]: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:
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module PWN
|
|
4
|
+
module AI
|
|
5
|
+
module Agent
|
|
6
|
+
# This module is an AI agent designed to analyze HTTP request/response pairs and WebSocket messages for high-impact vulnerabilities, with a focus on XSS and related issues. It provides detailed analysis and generates PoCs for identified vulnerabilities.
|
|
7
|
+
module BurpSuite
|
|
8
|
+
# Supported Method Parameters::
|
|
9
|
+
# ai_analysis = PWN::AI::Agent::BurpSuite.analyze(
|
|
10
|
+
# request: 'required HTTP request/response pair or WebSocket message as a string'
|
|
11
|
+
# )
|
|
12
|
+
|
|
13
|
+
public_class_method def self.analyze(opts = {})
|
|
14
|
+
request = opts[:request]
|
|
15
|
+
raise 'ERROR: request parameter is required' if request.nil? || request.empty?
|
|
16
|
+
|
|
17
|
+
system_role_content = '
|
|
18
|
+
Your expertise lies in dissecting HTTP request/response pairs and WebSocket messages 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, race conditions, and API abuse. You prioritize zero-days and novel chains, always focusing on exploitability, impact (e.g., account takeover, data exfiltration, RCE), and reproducibility.
|
|
19
|
+
|
|
20
|
+
During analysis:
|
|
21
|
+
|
|
22
|
+
1. **Parse and Contextualize Traffic**:
|
|
23
|
+
- 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.).
|
|
24
|
+
- 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.
|
|
25
|
+
- 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).
|
|
26
|
+
|
|
27
|
+
2. **Vulnerability Hunting Framework**:
|
|
28
|
+
- **Input Validation & Sanitization**: Check for unescaped/lack of encoding in outputs (e.g., HTML context for XSS, URL context for open redirects).
|
|
29
|
+
- **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.
|
|
30
|
+
- **JavaScript Library Analysis**: If JS is present (e.g., in response body or referenced scripts), deobfuscate and inspect:
|
|
31
|
+
- Objects/properties that could clobber DOM (e.g., window.name, document.cookie manipulation leading to prototype pollution).
|
|
32
|
+
- DOM XSS vectors: Analyze event handlers, querySelector, addEventListener with unsanitized data from location.hash/search, postMessage, or localStorage.
|
|
33
|
+
- Third-party libs (e.g., jQuery, React): Flag known sink patterns like .html(), dangerouslySetInnerHTML, or eval-like functions.
|
|
34
|
+
- **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).
|
|
35
|
+
- **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).
|
|
36
|
+
- **Chaining Opportunities**: Always consider multi-step exploits, like XSS leading to CSRF token theft or SSRF to internal metadata endpoints.
|
|
37
|
+
|
|
38
|
+
3. **PoC Generation**:
|
|
39
|
+
- Produce concise, step-by-step PoCs in a standardized format:
|
|
40
|
+
- **Description**: Clear vuln summary, CVSS-like severity, and impact.
|
|
41
|
+
- **Steps to Reproduce**: Numbered HTTP requests (use curl or Burp syntax, e.g., `curl -X POST -d "param=<payload>" https://target.com/endpoint`).
|
|
42
|
+
- **Payloads**: Provide working, minimal payloads with variations for evasion (e.g., encoded, obfuscated).
|
|
43
|
+
- **Screenshots/Evidence**: Suggest what to capture (e.g., alert popup for XSS, response diff for IDOR).
|
|
44
|
+
- **Mitigation Advice**: Recommend fixes (e.g., output encoding, input validation).
|
|
45
|
+
- Ensure PoCs are ethical: Target only in-scope assets, avoid DoS, and emphasize disclosure via proper channels (e.g., HackerOne, Bugcrowd).
|
|
46
|
+
- If no vuln found, explain why and suggest further tests (e.g., fuzzing params).
|
|
47
|
+
4. Risk Score:
|
|
48
|
+
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.
|
|
49
|
+
|
|
50
|
+
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.
|
|
51
|
+
'
|
|
52
|
+
|
|
53
|
+
PWN::AI::Introspection.reflect_on(
|
|
54
|
+
system_role_content: system_role_content,
|
|
55
|
+
request: request,
|
|
56
|
+
suppress_pii_warning: true
|
|
57
|
+
)
|
|
58
|
+
rescue StandardError => e
|
|
59
|
+
raise e.backtrace
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Author(s):: 0day Inc. <support@0dayinc.com>
|
|
63
|
+
|
|
64
|
+
public_class_method def self.authors
|
|
65
|
+
"AUTHOR(S):
|
|
66
|
+
0day Inc. <support@0dayinc.com>
|
|
67
|
+
"
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Display Usage for this Module
|
|
71
|
+
|
|
72
|
+
public_class_method def self.help
|
|
73
|
+
puts "USAGE:
|
|
74
|
+
|
|
75
|
+
#{self}.authors
|
|
76
|
+
"
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
data/lib/pwn/ai/agent.rb
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module PWN
|
|
4
|
+
# This file, using the autoload directive loads SAST modules
|
|
5
|
+
# into memory only when they're needed. For more information, see:
|
|
6
|
+
# http://www.rubyinside.com/ruby-techniques-revealed-autoload-1652.html
|
|
7
|
+
module AI
|
|
8
|
+
# Collection of Agentic AI Modules. These modules are designed to perform specific tasks autonomously, such as interacting with APIs, performing reconnaissance, or automating exploitation steps. Each module is designed to be used within an agentic AI framework, allowing for the creation of intelligent agents that can perform complex tasks without human intervention. The Agent module serves as a namespace for all agentic AI modules, providing a structured way to organize and access these functionalities. By using autoload, we ensure that each module is only loaded into memory when it's actually needed, optimizing resource usage and improving performance.
|
|
9
|
+
module Agent
|
|
10
|
+
# Agentic AI Modules
|
|
11
|
+
autoload :BurpSuite, 'pwn/ai/agent/burp_suite'
|
|
12
|
+
autoload :SAST, 'pwn/ai/agent/sast'
|
|
13
|
+
|
|
14
|
+
# Display a List of Every PWN::AI Module
|
|
15
|
+
|
|
16
|
+
public_class_method def self.help
|
|
17
|
+
constants.sort
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
data/lib/pwn/ai.rb
CHANGED
|
@@ -5,6 +5,7 @@ module PWN
|
|
|
5
5
|
# into memory only when they're needed. For more information, see:
|
|
6
6
|
# http://www.rubyinside.com/ruby-techniques-revealed-autoload-1652.html
|
|
7
7
|
module AI
|
|
8
|
+
autoload :Agent, 'pwn/ai/agent'
|
|
8
9
|
autoload :Grok, 'pwn/ai/grok'
|
|
9
10
|
autoload :Introspection, 'pwn/ai/introspection'
|
|
10
11
|
autoload :Ollama, 'pwn/ai/ollama'
|
|
@@ -67,42 +67,6 @@ module PWN
|
|
|
67
67
|
if PWN::Env[:ai][:introspection]
|
|
68
68
|
introspection_thread_arr = burp_obj[:introspection_threads] ||= []
|
|
69
69
|
introspection_thread = Thread.new do
|
|
70
|
-
system_role_content = '
|
|
71
|
-
Your expertise lies in dissecting HTTP request/response pairs and WebSocket messages 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, race conditions, and API abuse. You prioritize zero-days and novel chains, always focusing on exploitability, impact (e.g., account takeover, data exfiltration, RCE), and reproducibility.
|
|
72
|
-
|
|
73
|
-
During analysis:
|
|
74
|
-
|
|
75
|
-
1. **Parse and Contextualize Traffic**:
|
|
76
|
-
- 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.).
|
|
77
|
-
- 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.
|
|
78
|
-
- 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).
|
|
79
|
-
|
|
80
|
-
2. **Vulnerability Hunting Framework**:
|
|
81
|
-
- **Input Validation & Sanitization**: Check for unescaped/lack of encoding in outputs (e.g., HTML context for XSS, URL context for open redirects).
|
|
82
|
-
- **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.
|
|
83
|
-
- **JavaScript Library Analysis**: If JS is present (e.g., in response body or referenced scripts), deobfuscate and inspect:
|
|
84
|
-
- Objects/properties that could clobber DOM (e.g., window.name, document.cookie manipulation leading to prototype pollution).
|
|
85
|
-
- DOM XSS vectors: Analyze event handlers, querySelector, addEventListener with unsanitized data from location.hash/search, postMessage, or localStorage.
|
|
86
|
-
- Third-party libs (e.g., jQuery, React): Flag known sink patterns like .html(), dangerouslySetInnerHTML, or eval-like functions.
|
|
87
|
-
- **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).
|
|
88
|
-
- **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).
|
|
89
|
-
- **Chaining Opportunities**: Always consider multi-step exploits, like XSS leading to CSRF token theft or SSRF to internal metadata endpoints.
|
|
90
|
-
|
|
91
|
-
3. **PoC Generation**:
|
|
92
|
-
- Produce concise, step-by-step PoCs in a standardized format:
|
|
93
|
-
- **Description**: Clear vuln summary, CVSS-like severity, and impact.
|
|
94
|
-
- **Steps to Reproduce**: Numbered HTTP requests (use curl or Burp syntax, e.g., `curl -X POST -d "param=<payload>" https://target.com/endpoint`).
|
|
95
|
-
- **Payloads**: Provide working, minimal payloads with variations for evasion (e.g., encoded, obfuscated).
|
|
96
|
-
- **Screenshots/Evidence**: Suggest what to capture (e.g., alert popup for XSS, response diff for IDOR).
|
|
97
|
-
- **Mitigation Advice**: Recommend fixes (e.g., output encoding, input validation).
|
|
98
|
-
- Ensure PoCs are ethical: Target only in-scope assets, avoid DoS, and emphasize disclosure via proper channels (e.g., HackerOne, Bugcrowd).
|
|
99
|
-
- If no vuln found, explain why and suggest further tests (e.g., fuzzing params).
|
|
100
|
-
4. Risk Score:
|
|
101
|
-
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.
|
|
102
|
-
|
|
103
|
-
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.
|
|
104
|
-
'
|
|
105
|
-
|
|
106
70
|
get_highlight_color = lambda do |opts = {}|
|
|
107
71
|
ai_analysis = opts[:ai_analysis]
|
|
108
72
|
|
|
@@ -169,10 +133,8 @@ module PWN
|
|
|
169
133
|
response = Base64.strict_decode64(response)
|
|
170
134
|
|
|
171
135
|
http_request_response = PWN::Plugins::Char.force_utf8("#{request}\r\n\r\n#{response}")
|
|
172
|
-
ai_analysis = PWN::AI::
|
|
173
|
-
|
|
174
|
-
request: http_request_response,
|
|
175
|
-
suppress_pii_warning: true
|
|
136
|
+
ai_analysis = PWN::AI::Agent::BurpSuite.analyze(
|
|
137
|
+
request: http_request_response
|
|
176
138
|
)
|
|
177
139
|
|
|
178
140
|
next if ai_analysis.nil? || ai_analysis.strip.empty?
|
|
@@ -225,10 +187,8 @@ module PWN
|
|
|
225
187
|
request = Base64.strict_decode64(request)
|
|
226
188
|
response = Base64.strict_decode64(response)
|
|
227
189
|
http_request_response = PWN::Plugins::Char.force_utf8("#{request}\r\n\r\n#{response}")
|
|
228
|
-
ai_analysis = PWN::AI::
|
|
229
|
-
|
|
230
|
-
request: http_request_response,
|
|
231
|
-
suppress_pii_warning: true
|
|
190
|
+
ai_analysis = PWN::AI::Agent::BurpSuite.analyze(
|
|
191
|
+
request: http_request_response
|
|
232
192
|
)
|
|
233
193
|
|
|
234
194
|
next if ai_analysis.nil? || ai_analysis.strip.empty?
|
|
@@ -259,10 +219,8 @@ module PWN
|
|
|
259
219
|
|
|
260
220
|
payload = Base64.strict_decode64(payload)
|
|
261
221
|
websocket_req = PWN::Plugins::Char.force_utf8("WebSocket ID: #{web_socket_id}\nDirection: #{direction}\nPayload:\n#{payload}")
|
|
262
|
-
ai_analysis = PWN::AI::
|
|
263
|
-
|
|
264
|
-
request: websocket_req,
|
|
265
|
-
suppress_pii_warning: true
|
|
222
|
+
ai_analysis = PWN::AI::Agent::BurpSuite.analyze(
|
|
223
|
+
request: websocket_req
|
|
266
224
|
)
|
|
267
225
|
|
|
268
226
|
next if ai_analysis.nil? || ai_analysis.strip.empty?
|
data/lib/pwn/version.rb
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
describe PWN::AI::Agent::BurpSuite do
|
|
6
|
+
it 'scan method should exist' do
|
|
7
|
+
scan_response = PWN::AI::Agent::BurpSuite
|
|
8
|
+
expect(scan_response).to respond_to :scan
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it 'should display information for authors' do
|
|
12
|
+
authors_response = PWN::AI::Agent::BurpSuite
|
|
13
|
+
expect(authors_response).to respond_to :authors
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it 'should display information for existing help method' do
|
|
17
|
+
help_response = PWN::AI::Agent::BurpSuite
|
|
18
|
+
expect(help_response).to respond_to :help
|
|
19
|
+
end
|
|
20
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pwn
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.539
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- 0day Inc.
|
|
@@ -1758,6 +1758,8 @@ files:
|
|
|
1758
1758
|
- install.sh
|
|
1759
1759
|
- lib/pwn.rb
|
|
1760
1760
|
- lib/pwn/ai.rb
|
|
1761
|
+
- lib/pwn/ai/agent.rb
|
|
1762
|
+
- lib/pwn/ai/agent/burp_suite.rb
|
|
1761
1763
|
- lib/pwn/ai/grok.rb
|
|
1762
1764
|
- lib/pwn/ai/introspection.rb
|
|
1763
1765
|
- lib/pwn/ai/ollama.rb
|
|
@@ -2118,6 +2120,8 @@ files:
|
|
|
2118
2120
|
- packer/provisioners/zzuf.sh
|
|
2119
2121
|
- pwn.gemspec
|
|
2120
2122
|
- reinstall_gemset.sh
|
|
2123
|
+
- spec/lib/pwn/ai/agent/burp_suite_spec.rb
|
|
2124
|
+
- spec/lib/pwn/ai/agent_spec.rb
|
|
2121
2125
|
- spec/lib/pwn/ai/grok_spec.rb
|
|
2122
2126
|
- spec/lib/pwn/ai/introspection_spec.rb
|
|
2123
2127
|
- spec/lib/pwn/ai/ollama_spec.rb
|