pwn 0.5.805 → 0.5.806

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.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -7
  3. data/documentation/AI-Integration.md +27 -1
  4. data/documentation/Contributing.md +1 -1
  5. data/documentation/Diagrams.md +1 -1
  6. data/documentation/General-PWN-Usage.md +1 -1
  7. data/documentation/Home.md +2 -2
  8. data/documentation/How-PWN-Works.md +1 -1
  9. data/documentation/Mission-Cancellation.md +4 -3
  10. data/documentation/Persistence.md +1 -1
  11. data/documentation/Plugins.md +3 -2
  12. data/documentation/Runtime-Source-Protection.md +20 -2
  13. data/documentation/Skills-Memory-Learning.md +8 -1
  14. data/documentation/What-is-PWN.md +1 -1
  15. data/documentation/diagrams/dot/plugin-ecosystem.dot +1 -1
  16. data/documentation/diagrams/plugin-ecosystem.svg +1 -1
  17. data/etc/default_skills/pwn/ai/agent/submission/SKILL.md +23 -0
  18. data/etc/default_skills/pwn/ai/sandbox/SKILL.md +59 -0
  19. data/lib/pwn/ai/agent/confirmation.rb +1 -1
  20. data/lib/pwn/ai/agent/dispatch.rb +1 -1
  21. data/lib/pwn/ai/agent/learning.rb +7 -3
  22. data/lib/pwn/ai/agent/loop.rb +386 -249
  23. data/lib/pwn/ai/agent/mission_namespace.rb +26 -10
  24. data/lib/pwn/ai/agent/open_goal.rb +36 -9
  25. data/lib/pwn/ai/agent/policy.rb +37 -10
  26. data/lib/pwn/ai/agent/prompt_builder.rb +15 -8
  27. data/lib/pwn/ai/agent/request_runtime.rb +99 -13
  28. data/lib/pwn/ai/agent/submission.rb +367 -0
  29. data/lib/pwn/ai/agent/swarm.rb +2 -2
  30. data/lib/pwn/ai/agent/task_dag.rb +1 -1
  31. data/lib/pwn/ai/agent/task_summarizer.rb +47 -13
  32. data/lib/pwn/ai/agent/tools/ruby_eval.rb +1 -1
  33. data/lib/pwn/ai/agent/tools/shell.rb +1 -1
  34. data/lib/pwn/ai/agent/tools/skills.rb +5 -5
  35. data/lib/pwn/ai/agent/turn_finalizer.rb +659 -27
  36. data/lib/pwn/ai/agent.rb +1 -0
  37. data/lib/pwn/ai/cli.rb +2 -0
  38. data/lib/pwn/ai/grok.rb +106 -1
  39. data/lib/pwn/{plugins/ai_sandbox.rb → ai/sandbox.rb} +116 -32
  40. data/lib/pwn/ai.rb +1 -0
  41. data/lib/pwn/config.rb +36 -32
  42. data/lib/pwn/plugins/log.rb +15 -1
  43. data/lib/pwn/plugins/repl/ai.rb +3 -7
  44. data/lib/pwn/plugins/repl/ai_console.rb +89 -31
  45. data/lib/pwn/plugins/repl/ai_swarm.rb +1 -1
  46. data/lib/pwn/plugins.rb +0 -1
  47. data/lib/pwn/sessions.rb +9 -1
  48. data/lib/pwn/version.rb +1 -1
  49. data/pwn_upgrade-aarch64.txt +9533 -0
  50. data/spec/integration/controller_spill_spec.rb +8 -2
  51. data/spec/integration/harness_evaluation_spec.rb +1 -1
  52. data/spec/integration/harness_package_spec.rb +17 -6
  53. data/spec/integration/mission_cancel_spec.rb +2 -2
  54. data/spec/integration/reinforced_feedback_loop_spec.rb +1 -1
  55. data/spec/landlock_capability_spec.rb +23 -0
  56. data/spec/lib/pwn/ai/agent/chat_deliverable_spec.rb +188 -0
  57. data/spec/lib/pwn/ai/agent/dispatch_spec.rb +2 -2
  58. data/spec/lib/pwn/ai/agent/loop_artifacts_spec.rb +102 -1
  59. data/spec/lib/pwn/ai/agent/loop_partial_delivery_spec.rb +62 -0
  60. data/spec/lib/pwn/ai/agent/loop_permission_spec.rb +152 -0
  61. data/spec/lib/pwn/ai/agent/loop_spec.rb +100 -23
  62. data/spec/lib/pwn/ai/agent/loop_submission_spec.rb +271 -0
  63. data/spec/lib/pwn/ai/agent/mission_namespace_spec.rb +76 -3
  64. data/spec/lib/pwn/ai/agent/provider_window_timing_spec.rb +63 -0
  65. data/spec/lib/pwn/ai/agent/request_runtime_spec.rb +142 -1
  66. data/spec/lib/pwn/ai/agent/reward_dispatch_review_spec.rb +1 -1
  67. data/spec/lib/pwn/ai/agent/solve_spec.rb +1 -1
  68. data/spec/lib/pwn/ai/agent/submission_spec.rb +81 -0
  69. data/spec/lib/pwn/ai/agent/task_summarizer_spec.rb +29 -0
  70. data/spec/lib/pwn/ai/agent/tools/skills_spec.rb +23 -0
  71. data/spec/lib/pwn/ai/agent/turn_finalizer_spec.rb +384 -1
  72. data/spec/lib/pwn/ai/cli_spec.rb +17 -0
  73. data/spec/lib/pwn/ai/grok_spec.rb +153 -0
  74. data/spec/lib/pwn/ai/sandbox_boundary_review_spec.rb +231 -0
  75. data/spec/lib/pwn/{plugins/ai_sandbox_spec.rb → ai/sandbox_spec.rb} +29 -14
  76. data/spec/lib/pwn/ai_spec.rb +5 -0
  77. data/spec/lib/pwn/config_skills_regression_spec.rb +78 -20
  78. data/spec/lib/pwn/plugins/android_review_fixes_spec.rb +1 -2
  79. data/spec/lib/pwn/plugins/log_spec.rb +95 -0
  80. data/spec/lib/pwn/plugins/plugins_b_operational_regression_spec.rb +1 -1
  81. data/spec/lib/pwn/plugins/repl/ai_console_spec.rb +250 -39
  82. data/spec/lib/pwn/plugins/repl/ai_legacy_containment_spec.rb +25 -10
  83. data/spec/lib/pwn/sessions_lifecycle_supplement_spec.rb +50 -0
  84. data/spec/support/harness/controller_spill.rb +2 -2
  85. data/spec/support/harness/controller_state.rb +3 -3
  86. data/spec/support/harness/evaluate.rb +21 -15
  87. data/spec/support/harness/mission_dispatch.rb +2 -2
  88. data/spec/support/harness/mission_job_lifetime.rb +2 -2
  89. data/spec/support/harness/mission_normal_exit.rb +1 -1
  90. data/spec/support/harness/mission_unsupported.rb +2 -2
  91. data/spec/support/harness/package_acceptance.rb +25 -4
  92. data/spec/support/harness/package_sandbox_rejection.rb +21 -0
  93. data/spec/support/harness/swarm_control.rb +5 -5
  94. data/spec/support/landlock.rb +23 -0
  95. data/spec/support/sandbox.rb +4 -0
  96. data/third_party/pwn_rdoc.jsonl +126 -48
  97. metadata +32 -20
  98. data/etc/default_skills/pwn/plugins/ai_sandbox/SKILL.md +0 -52
  99. data/spec/lib/pwn/plugins/ai_sandbox_boundary_review_spec.rb +0 -57
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4c49ea1e0a11b6e4a590478793cccfcded7c6bc35e6c350aea35d4d70105068b
4
- data.tar.gz: 5728257760ae7f42005b438f2cfcb164c9fb1da71e1653d6d283f6dbd37a4d66
3
+ metadata.gz: 7a95e323c5607d2e2721e2f18947a5e1034668f55f5d37981e697011555ebe23
4
+ data.tar.gz: 086eaaf93277868851706478bf4d1ba86a634934e05c90aadda5d9e3a5250c80
5
5
  SHA512:
6
- metadata.gz: ab00b67b6f6e1f8dd1961e1656fd96fd0617589e2234244918e0e30141b773100e115296b74ca7aaf67d956feaf298bd6fd53a8498fff9c39601d53342cc3397
7
- data.tar.gz: 28e0c26e8e1755f1e205783bb82940cbc19cc9fdec9b467dc3b51990a358185446a7dcd0be00d61cc211e09851f945a0805a43ed210bfe74a0959721e9f38496
6
+ metadata.gz: 5628e5027bcefc1ff6578567bbfc9b8453d87d711e9c72ff5c9933ebe3332079a3136cdf22609a79cc385ec8dc77957dc473d6f7f697b9117f999dd9d9584a0f
7
+ data.tar.gz: 8c606e8d81881423be272debcba20c74173f354cc060efc0e4e49f61dec60bcd2e235e1745d109f8715999d6008616d84c63366b817f6b516ef3f01ee3638abb
data/Gemfile CHANGED
@@ -19,8 +19,8 @@ gem 'barby', '0.7.0'
19
19
  gem 'base32', '0.3.4'
20
20
  gem 'bitcoin-ruby', '0.0.20'
21
21
  gem 'brakeman', '8.1.1'
22
- gem 'bson', '5.2.0'
23
- gem 'bundler', '>=4.1.0'
22
+ gem 'bson', '5.2.1'
23
+ gem 'bundler', '>=4.1.1'
24
24
  gem 'bundler-audit', '>=0.9.3'
25
25
  gem 'bunny', '3.6.0'
26
26
  gem 'colorize', '1.1.0'
@@ -30,7 +30,7 @@ gem 'diffy', '3.4.4'
30
30
  gem 'eventmachine', '1.2.7'
31
31
  gem 'executable-hooks', '1.7.1'
32
32
  gem 'faker', '3.8.0'
33
- gem 'faye-websocket', '0.13.0'
33
+ gem 'faye-websocket', '0.13.1'
34
34
  gem 'ffi', '1.17.4'
35
35
  # gem 'fftw3', '0.3'
36
36
  gem 'gdb', '1.0.0'
@@ -50,7 +50,7 @@ gem 'libusb', '0.8.0'
50
50
  gem 'luhn', '3.0.0'
51
51
  gem 'mail', '2.9.1'
52
52
  gem 'mcp', '1.11.0'
53
- gem 'meshtastic', '0.0.194'
53
+ gem 'meshtastic', '0.0.195'
54
54
  gem 'metasm', '1.0.6'
55
55
  gem 'mongo', '2.26.2'
56
56
  gem 'msfrpc-client', '1.1.2'
@@ -62,7 +62,7 @@ gem 'nexpose', '7.3.0'
62
62
  gem 'nokogiri', '1.19.7'
63
63
  gem 'nokogiri-diff', '0.3.0'
64
64
  gem 'oily_png', '1.2.1'
65
- gem 'open3', '0.3.0'
65
+ gem 'open3', '0.3.1'
66
66
  gem 'os', '1.1.4'
67
67
  gem 'ostruct', '0.6.3'
68
68
  gem 'packetfu', '2.0.0'
@@ -81,7 +81,7 @@ gem 'rmagick', '7.3.1'
81
81
  gem 'rqrcode', '3.2.0'
82
82
  gem 'rspec', '3.13.2'
83
83
  gem 'rtesseract', '3.1.4'
84
- gem 'rubocop', '1.92.3'
84
+ gem 'rubocop', '1.93.0'
85
85
  gem 'rubocop-rake', '0.7.1'
86
86
  gem 'rubocop-rspec', '3.10.2'
87
87
  gem 'ruby-audio', '1.6.1'
@@ -91,7 +91,7 @@ gem 'rvm', '1.11.3.9'
91
91
  gem 'savon', '2.18.1'
92
92
  gem 'selenium-devtools', '0.158.0'
93
93
  gem 'selenium-webdriver', '4.54.0'
94
- gem 'slack-ruby-client', '3.3.0'
94
+ gem 'slack-ruby-client', '3.4.0'
95
95
  gem 'socksify', '1.8.1'
96
96
  gem 'spreadsheet', '1.3.5'
97
97
  gem 'sqlite3', '2.10.2'
@@ -38,6 +38,18 @@ ai:
38
38
  PWN::Env[:ai][:active] = :ollama
39
39
  ```
40
40
 
41
+ ### Web search for Grok questions
42
+
43
+ To let Grok look up current information on a conversational turn, use the
44
+ `pwn-vault` REPL command and add `server_tools: [web_search]` under the existing
45
+ `ai` → `grok` section. The setting is opt-in: omitting it or setting it to `[]`
46
+ does not enable search. An explicit `ai.agent.toolsets: []` also disables it.
47
+
48
+ Grok runs the search on its Responses endpoint; pwn-ai does not run a local
49
+ browser or shell for it. Offering search is not proof that the model used it.
50
+ `auto_extrospect` records environment changes; turning it on does not enable
51
+ Grok web search.
52
+
41
53
  ## OpenAI OAuth enrollment and persistence
42
54
 
43
55
  To prefer subscription OAuth, set `ai.openai.oauth.enroll: true` through
@@ -82,7 +94,7 @@ The harness adapts to the *class* of engine, not the model name:
82
94
  | **PromptBuilder.budget** | full MEMORY / METRICS / MISTAKES / LEARNING / EXTRO blocks | tightened via `ai.ollama.prompt_budget` (extro off by default) |
83
95
  | **MEMORY ranking** | relevance-ranked when a local Ollama `embed_model` is reachable, else newest-first | relevance-ranked via `PWN::MemoryIndex` (`~/.pwn/memory.idx`) |
84
96
  | **Tool schemas shipped** | Loop normally requests core-only schemas; explicit Registry callers may request more | `CORE_TOOLS` + top-K keyword matches when `ai.agent.tool_router` is on (default on). Ties also honor `tool_preference`. |
85
- | **Pre-pass** | none | `plan_first` numbered tool plan before first dispatch |
97
+ | **Pre-pass** | Can run when `plan_first` is enabled or calibration or budget history calls for planning | `plan_first` defaults on when no value is configured |
86
98
  | **Intent route** | always | `request_intent` only (greeting / howto / recall cheap paths). There is no request type. Every other turn gets a TaskSummarizer compass and CORE_TOOLS. |
87
99
  | **Few-shot** | none | `Learning.exemplars_for(request)` splices a prior successful trace |
88
100
  | **Dispatch parsing** | strict | tolerant - Levenshtein tool-name repair + JSON5-ish arg cleanup, each repair fingerprinted into `Mistakes` |
@@ -90,6 +102,20 @@ The harness adapts to the *class* of engine, not the model name:
90
102
  | **Metrics bucket** | `metrics.json[:tools][name][:engines][:<engine>]` | same - the `TOOL EFFECTIVENESS` block is per-engine so local telemetry never blends with frontier |
91
103
  | **Prefix cache** | Anthropic `cache_control` · OpenAI `prompt_cache_key` · Grok `x-grok-conv-id` · Gemini `systemInstruction` split (`ai.agent.prompt_cache`, default on) | none - Ollama / Open WebUI have no prefix-cache request field |
92
104
 
105
+ The `TASK` card is a proposed outline, not a record of tool execution. When it
106
+ recognizes an explicit list in the request, it shows those steps without adding
107
+ a reporting step. If the provider rejects the planning request (HTTP 403), pwn-ai
108
+ stopped before dispatching the first local tool. The warning includes a
109
+ recognized provider error code and a supported request ID when available. Use
110
+ the ID or timestamp to look up the rejection in the provider's request log. A
111
+ 403 alone does not identify a model-access, account, or policy problem.
112
+
113
+ For Grok, if xAI says your subscription does not include the reasoning effort
114
+ sent with the request, pwn-ai names that effort in the warning. Use `/model grok`
115
+ to choose another effort. A model limitation is reported separately. If xAI
116
+ does not explain the denial, pwn-ai does not guess your subscription tier.
117
+ It does not print the raw error body or retry with a different setting.
118
+
93
119
  ## Teacher-student reflection
94
120
 
95
121
  `ai.reflect_engine` decouples *doing* from *learning-about-doing*:
@@ -6,7 +6,7 @@
6
6
  lib/pwn/ # all namespaces
7
7
  lib/pwn/setup.rb # PWN::Setup - doctor/provisioner data tables
8
8
  lib/pwn/migrate.rb # PWN::Migrate - ~/.pwn state doctor / auto-migrator
9
- lib/pwn/plugins/ # 108 top-level plugin autoloads
9
+ lib/pwn/plugins/ # 107 top-level plugin autoloads
10
10
  lib/pwn/ai/agent/ # agent core
11
11
  lib/pwn/ai/agent/tools/ # LLM tool registrations
12
12
  bin/ # 56 executables: 53 pwn_* drivers + pwn / pwn-ai / pwn-capd (incl. pwn_setup)
@@ -24,7 +24,7 @@ a dependency guarantee. External services/radios require separate live verificat
24
24
  [source](diagrams/dot/persistence-filesystem.dot) · doc: [Persistence](Persistence.md)
25
25
  ![persistence-filesystem](diagrams/persistence-filesystem.svg)
26
26
 
27
- ### Plugin Ecosystem (108 modules)
27
+ ### Plugin Ecosystem (107 modules)
28
28
  [source](diagrams/dot/plugin-ecosystem.dot) · doc: [Plugins](Plugins.md)
29
29
  ![plugin-ecosystem](diagrams/plugin-ecosystem.svg)
30
30
 
@@ -25,7 +25,7 @@ See [Installation](Installation.md) for every flag and the
25
25
 
26
26
  ```ruby
27
27
  PWN.help # top-level help
28
- PWN::Plugins.constants.sort # list all 108 plugins
28
+ PWN::Plugins.constants.sort # list all 107 plugins
29
29
  PWN::Plugins::NmapIt.help # per-plugin usage
30
30
  PWN::Setup.check # capability doctor from inside the REPL
31
31
  PWN::Migrate.status # ~/.pwn state-file compatibility rows
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **PWN** (/pōn/) - an open-source offensive-security automation framework and
4
4
  > continuous-security-integration platform written in Ruby.
5
- > 108 plugins · 48 SAST modules · 85 AWS wrappers · 22 WWW drivers · 56 CLI
5
+ > 107 plugins · 48 SAST modules · 85 AWS wrappers · 22 WWW drivers · 56 CLI
6
6
  > executables · 6 LLM engines · a self-improving multi-agent AI · one REPL.
7
7
 
8
8
  **Repo root:** `/opt/pwn` · **This wiki:** `/opt/pwn/documentation/` ·
@@ -51,7 +51,7 @@
51
51
 
52
52
  | | |
53
53
  |---|---|
54
- | [Plugins (108)](Plugins.md) | Every `PWN::Plugins::*` module by category |
54
+ | [Plugins (107)](Plugins.md) | Every `PWN::Plugins::*` module by category |
55
55
  | &nbsp;&nbsp;↳ [BurpSuite](BurpSuite.md) ⭐ | Preferred web proxy / scanner |
56
56
  | &nbsp;&nbsp;↳ [TransparentBrowser](Transparent-Browser.md) | Headless / visible browser automation |
57
57
  | &nbsp;&nbsp;↳ [NmapIt](NmapIt.md) | Network discovery |
@@ -44,7 +44,7 @@ call, and [Reinforcement Learning](Reinforcement-Learning.md) for how
44
44
 
45
45
  ## L3 - Capability namespaces (`lib/pwn/*`)
46
46
 
47
- `Plugins` (108) · `SAST` (48) · `WWW` (22) · `AWS` (85) · `SDR` · `Blockchain` ·
47
+ `Plugins` (107) · `SAST` (48) · `WWW` (22) · `AWS` (85) · `SDR` · `Blockchain` ·
48
48
  `Bounty` · `Reports` · `FFI` · `Banner` · **`Setup`** · **`Migrate`**. First launch also seeds bundled skills from `etc/default_skills/`. Each is
49
49
  a plain module of `public_class_method def self.x(opts = {})` methods -
50
50
  callable the same way from the REPL, from `pwn_eval`, or from a driver.
@@ -34,8 +34,9 @@ skill metadata and routing context travel as typed JSON over inherited private
34
34
  sockets, never in argv or plaintext staging files. RequestRuntime's tool-worker
35
35
  snapshot excludes locks and caller cancellation callbacks; the enclosing owner
36
36
  provides cancellation. Replies and events remain JSON with generation fencing.
37
- Loaded Ruby skill scripts are required in the worker. Embedders with additional
38
- trusted plugin initializers can explicitly set
37
+ The worker receives skill metadata as data; it does not require Ruby from the
38
+ catalog. Embedders with trusted plugin initializers outside the writable skills
39
+ library can explicitly set
39
40
  `PWN::AI::Agent::MissionNamespace.bootstrap_requires = ['/absolute/plugin/bootstrap.rb']`.
40
41
  Arbitrary monkey patches, IO objects and Proc values are not serializable.
41
42
 
@@ -61,7 +62,7 @@ namespace. They can continue after the individual tool returns, but **not**
61
62
  after mission completion, cancellation, or namespace-owner death. Normal
62
63
  mission completion also tears down remaining detached descendants. This is
63
64
  intentionally different from cross-session durable jobs. A standalone
64
- `AISandbox.protect_call` without an enclosing mission creates its own namespace
65
+ `PWN::AI::Sandbox.protect_call` without an enclosing mission creates its own namespace
65
66
  and ends that lifetime when the call ends.
66
67
 
67
68
  Existing files and already-submitted remote operations are not rolled back.
@@ -34,7 +34,7 @@ external services and environment overrides can place evidence elsewhere.
34
34
  | `curriculum/` | `PWN::AI::Agent::Curriculum` | JSONL | rm -rf | self-play reproducers · train/gate A/B eval sets |
35
35
  | `curriculum_kpi.jsonl` | `PWN::AI::Agent::Curriculum.practice_kpi` | JSONL | rm | outer curriculum KPI snapshots (repeating-mistake trend) |
36
36
  | `finetune/*.jsonl` | `Learning.export_finetune` · `Reward.export_dpo` | ShareGPT / OpenAI / DPO JSONL | `rm` | supervised + preference datasets - feed to a LoRA over the local model |
37
- | `workspaces/runtime/` | `PWN::Plugins::AISandbox` · `SessionCleanup.temporary` | files | operator-managed | Unspecified `pwn-ai` writes, `TMPDIR`, and registered disposable inputs such as Festival speech. Another path is writable only when the original request names it. `/opt/pwn` stays read-only |
37
+ | `workspaces/runtime/` | `PWN::AI::Sandbox` · `SessionCleanup.temporary` | files | operator-managed | Unspecified `pwn-ai` writes, `TMPDIR`, and registered disposable inputs such as Festival speech. Another path is writable only when the original request names it. `/opt/pwn` stays read-only |
38
38
  | `backup/<generation>/` | `PWN::Backups` | shared generations | see [Backup Retention](Backup-Retention.md) | One store, seven generation folders total, for every recovery producer including migrate |
39
39
  | `quarantine/` | `PWN::Migrate` | quarantined originals | rm -rf | corrupt/incompatible state files moved aside so the owner re-seeds |
40
40
  | `pwn_history` | Pry / pwn-ai | text | operator-managed | Shared durable input history at `~/.pwn/pwn_history` |
@@ -1,7 +1,8 @@
1
- # `PWN::Plugins` - All 108 Modules
1
+ # `PWN::Plugins` - All 107 Modules
2
2
 
3
3
  Every plugin is a plain Ruby module of `public_class_method def self.x(opts = {})`
4
4
  methods with self-documenting `.help`. Source: `lib/pwn/plugins/*.rb`.
5
+ The pwn-ai worker is [PWN::AI::Sandbox](Runtime-Source-Protection.md), separate from `PWN::Plugins::Sandbox`.
5
6
 
6
7
  ![Plugin ecosystem](diagrams/plugin-ecosystem.svg)
7
8
 
@@ -98,6 +99,6 @@ show-source PWN::Plugins::Fuzz.http
98
99
 
99
100
  ## Full alphabetical list
100
101
 
101
- `AFLplusplus AISandbox Android ArtifactRegistry Assembly AuthenticationHelper BareSIP BasicAuth BeEF BinaryAnalysis BinaryParser BinWorkspace BlackDuckBinaryAnalysis BurpSuite BusPirate Capability CapabilityBroker Char CredentialAttack CreditCard DAOLDAP DAOMongo DAOPostgres DAOSQLite3 Debugger DefectDojo DetectOS Detonate EIN Emulator ExploitDB ExploitDev FileFu Findings Frida Fuzz GDB GDBMI GDBMi Ghidra GhidraHeadless Git Github GoogleWorkspace HackerOne Handler Httpx Hunter IPInfo IRC Jenkins JiraDataCenter Jobs JSONPathify K8s Log MailAgent Metasploit MethodCatalog MitmProxy MonkeyPatch MSR206 NessusCloud NexposeVulnScan NmapIt Nuclei OAuth2 OCR OpenAPI OpenVAS Packet PDFParse Pony PreflightChecker ProcessTube PS PWNLogger RabbitMQ Radare2 Recon REDB REPL ROP Sandbox SBOM ScannableCodes Semgrep Serial Shodan SlackClient Sock Spider Sqlmap SSN ThreadPool Tor TransparentBrowser TTYSpinner TwitterAPI URIScheme Vault VIN Voice Volatility Vsphere XXD YubiKey Zaproxy`
102
+ `AFLplusplus Android ArtifactRegistry Assembly AuthenticationHelper BareSIP BasicAuth BeEF BinaryAnalysis BinaryParser BinWorkspace BlackDuckBinaryAnalysis BurpSuite BusPirate Capability CapabilityBroker Char CredentialAttack CreditCard DAOLDAP DAOMongo DAOPostgres DAOSQLite3 Debugger DefectDojo DetectOS Detonate EIN Emulator ExploitDB ExploitDev FileFu Findings Frida Fuzz GDB GDBMI GDBMi Ghidra GhidraHeadless Git Github GoogleWorkspace HackerOne Handler Httpx Hunter IPInfo IRC Jenkins JiraDataCenter Jobs JSONPathify K8s Log MailAgent Metasploit MethodCatalog MitmProxy MonkeyPatch MSR206 NessusCloud NexposeVulnScan NmapIt Nuclei OAuth2 OCR OpenAPI OpenVAS Packet PDFParse Pony PreflightChecker ProcessTube PS PWNLogger RabbitMQ Radare2 Recon REDB REPL ROP Sandbox SBOM ScannableCodes Semgrep Serial Shodan SlackClient Sock Spider Sqlmap SSN ThreadPool Tor TransparentBrowser TTYSpinner TwitterAPI URIScheme Vault VIN Voice Volatility Vsphere XXD YubiKey Zaproxy`
102
103
 
103
104
  [← Home](Home.md) · [Diagrams](Diagrams.md)
@@ -11,7 +11,7 @@
11
11
  > so a new file can be created there. Source checkouts stay read-only
12
12
  > even if named. See [Mission-Cancellation](Mission-Cancellation.md).
13
13
 
14
- A pwn-ai RequestRuntime dispatch executes its registered handler in an AISandbox
14
+ A pwn-ai RequestRuntime dispatch executes its registered handler in a `PWN::AI::Sandbox`
15
15
  worker. This boundary is mandatory even when the optional `ai_sandbox` profile
16
16
  is `off`. It covers shell, Ruby evaluation, other registered handlers, nested
17
17
  Dispatch calls, and fork/exec descendants including durable Jobs supervisors.
@@ -38,6 +38,24 @@ Standard null/zero/random devices are available. Other filesystem writes fail
38
38
  closed. This bounded write set permits hardlink-alias exclusion without scanning
39
39
  all mounted filesystems or changing checkout permissions.
40
40
 
41
+ ### Writing skills and references
42
+
43
+ Name the destination in the request, for example: `Save the meeting notes skill
44
+ under ~/.pwn/skills` or `Write the template to
45
+ ~/.pwn/skills/meeting-notes/references/format.md`. The sandboxed `shell` and
46
+ skill tools write directly there. No separate home, `pwn_eval` fallback, or
47
+ permission change on `~/.pwn` is needed. Unnamed files still use the runtime
48
+ workspace.
49
+
50
+ Naming the library grants ordinary file and directory operations inside it;
51
+ naming a reference file grants its containing directory. Missing directories
52
+ are created without following symlinks. The grant supports same-directory
53
+ renames, but not creating symlinks, special files, or links across directories.
54
+ A directory that overlaps a mount inside the library or a protected store, or
55
+ contains a linked or special file, is not granted. A read-only request or a
56
+ delegated prompt does not grant skill writes. The catalog is data: discovery,
57
+ reload and worker startup do not execute Ruby from it.
58
+
41
59
  ## Fail-closed requirements and restrictions
42
60
 
43
61
  - Supported syscall ABIs are Linux x86_64 and aarch64; libseccomp is required.
@@ -104,7 +122,7 @@ through another otherwise writable directory.
104
122
  | Learning, Policy, Metrics, Reward, Mistakes, ToolGuard | Declared files/directories, learning and metrics subtrees; absent sibling staging paths cannot be planted |
105
123
  | Memory and MemoryIndex | Memory, archive and index files |
106
124
  | OpenGoal, Mission and TaskDAG | Goal file, missions and runs roots |
107
- | SkillReview and Curriculum | Ledger, curriculum/finetune roots, default/configured skill directories and loaded skill parents |
125
+ | SkillReview and Curriculum | Ledger, curriculum/finetune roots and catalog locations outside the explicitly writable skills library |
108
126
  | Provider credential persistence and local model configuration | Default vault/decryptor and configured driver paths |
109
127
  | Session redaction's Vault persistence | Engagements tree, legacy vault file and master-key path |
110
128
  | Log and Extrospection | Default logs and declared Extrospection stores |
@@ -15,7 +15,7 @@ of general improvement. See [Operability](Operability.md).
15
15
  | Store | File | Write tool | Read tool | Injected as |
16
16
  |---|---|---|---|---|
17
17
  | **Memory** | `memory.json` (+ `memory.idx`) | `memory_remember` | `memory_recall` · `PWN::MemoryIndex.recall_semantic` | `MEMORY` block - durable facts / prefs / lessons / env. **Relevance-ranked** for the current request via a local embedding index when `ai.ollama.embed_model` is available; falls back to newest-first otherwise. |
18
- | **Skills** | `skills/<name>/SKILL.md` | `skill_create` · `skill_migrate_legacy` · `learning_distill_skill` | `skill_list` · `skill_view` | `SKILLS` list - reusable procedures + `references:` (CWE/CVE/ATT&CK/NIST/URL) |
18
+ | **Skills** | `skills/<name>/SKILL.md` | `skill_create` · `skill_migrate_legacy` · `learning_distill_skill` | `skill_list` · `skill_view` · `skills_recall` | Catalog counts and bundled groups; local skill bodies and references are read on demand, not inserted as system instructions. |
19
19
  | **Policy** | `policy.json` + `policy_traj.jsonl` | Loop `begin_episode` / `observe_step` / `finish` | `policy_stats` · `policy_evaluate` · `policy_recommend` | `POLICY` block - live tabular Q / REINFORCE. Advisory rank only. Disable with `ai.agent.policy: false`. |
20
20
  | **Learning** | `learning.jsonl` | `learning_note_outcome` · `learning_reflect` | `learning_outcomes` · `learning_stats` · `Learning.exemplars_for` | `LEARNING` block - recent outcomes + success_rate. Prior *successful* traces are also spliced in as **few-shot exemplars** for local models. |
21
21
  | **Mistakes** | `mistakes.json` | `mistakes_record` · `mistakes_resolve` · *auto on failure* | `mistakes_list` | `KNOWN MISTAKES` + `KNOWN FIXES` blocks - do-NOT-repeat + do-THIS-instead |
@@ -84,6 +84,13 @@ The name is sanitised to `[a-z0-9-]{1,64}`. Front-matter **must** carry
84
84
  `name` + `description`; `metadata.references` and `allowed-tools` are
85
85
  optional.
86
86
 
87
+ To save a skill and its supporting files with the sandboxed shell, name the
88
+ destination in the request: `Save the meeting notes skill under ~/.pwn/skills`.
89
+ The library holds data, not startup code. Legacy `.rb` files remain available
90
+ as source; Ruby under `scripts/` is not automatically run on load, reload or
91
+ worker startup. Keep trusted application code outside the writable library.
92
+ See [Runtime source protection](Runtime-Source-Protection.md#writing-skills-and-references).
93
+
87
94
  ```markdown
88
95
  ---
89
96
  name: sqli-union-enum
@@ -12,7 +12,7 @@ with a **tool-calling AI agent** on top that can run the same methods.
12
12
 
13
13
  | Namespace | Count | What it is |
14
14
  |---|---|---|
15
- | `PWN::Plugins::*` | **108** | Wrappers for external and native tooling (Burp, Nmap, Metasploit, Shodan, browsers, serial, YubiKey, ...) |
15
+ | `PWN::Plugins::*` | **107** | Wrappers for external and native tooling (Burp, Nmap, Metasploit, Shodan, browsers, serial, YubiKey, ...) |
16
16
  | `PWN::SAST::*` | **48** | Static-analysis rules across C/Java/Go/Python/Ruby/Scala/PHP/TS |
17
17
  | `PWN::AWS::*` | **85** | One module per AWS service for cloud enumeration |
18
18
  | `PWN::WWW::*` | **22** | Site-specific browser automations (HackerOne, BugCrowd, GitHub, Google, LinkedIn, ...) |
@@ -1,6 +1,6 @@
1
1
  digraph "PWN_Plugins" {
2
2
  graph [
3
- label=<<B>PWN::Plugins - Selected categories from 108 plugin modules</B>>,
3
+ label=<<B>PWN::Plugins - Selected categories from 107 plugin modules</B>>,
4
4
  labelloc=t, fontsize=20, fontname="Helvetica",
5
5
  rankdir=LR, splines=spline, nodesep=0.25, ranksep=1.5,
6
6
  bgcolor="#0f172a", fontcolor="#e2e8f0", pad=0.6, newrank=true
@@ -9,7 +9,7 @@
9
9
  <g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(43.2 636.7)">
10
10
  <title>PWN_Plugins</title>
11
11
  <polygon fill="#0f172a" stroke="none" points="-43.2,43.2 -43.2,-636.7 634.45,-636.7 634.45,43.2 -43.2,43.2"/>
12
- <text xml:space="preserve" text-anchor="start" x="8" y="-571.5" font-family="sans-Serif" font-weight="bold" font-size="20.00" fill="#e2e8f0">PWN::Plugins &#45; Selected categories from 108 plugin modules</text>
12
+ <text xml:space="preserve" text-anchor="start" x="8" y="-571.5" font-family="sans-Serif" font-weight="bold" font-size="20.00" fill="#e2e8f0">PWN::Plugins &#45; Selected categories from 107 plugin modules</text>
13
13
  <g id="clust1" class="cluster">
14
14
  <title>cluster_cat</title>
15
15
  </g>
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: pwn-ai-agent-submission
3
+ description: Interpret submission outcomes and delivery receipts.
4
+ license: MIT
5
+ metadata:
6
+ bundled: true
7
+ preserve: true
8
+ module: PWN::AI::Agent::Submission
9
+ source: pwn/ai/agent/submission.rb
10
+ ---
11
+
12
+ # PWN::AI::Agent::Submission
13
+
14
+ Use `PWN::AI::Agent::Submission.stats` to inspect aggregate submission outcomes.
15
+ `by_stage` shows where requests ended. `by_delivery` reports whether the console
16
+ observed delivery. Neither says whether the answer was correct.
17
+
18
+ Only submissions with an independent check contribute to the false-block and
19
+ false-completion rates. A `nil` rate means there were no checked cases for that
20
+ rate, not that the rate was zero.
21
+
22
+ Receipt changes belong to the submitting controller, the presentation owner,
23
+ and the independent verifier. Do not change a receipt to complete a task.
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: pwn-ai-sandbox
3
+ description: Drive PWN::AI::Sandbox from pwn_eval.
4
+ license: MIT
5
+ allowed-tools: [pwn, pwn_eval]
6
+ metadata:
7
+ bundled: true
8
+ generated: true
9
+ module: PWN::AI::Sandbox
10
+ source: pwn/ai/sandbox.rb
11
+ ---
12
+
13
+ # PWN::AI::Sandbox
14
+
15
+ Forked worker for model-authored shell/Ruby with Landlock/seccomp profiles.
16
+
17
+ ## When to use
18
+
19
+ Call `PWN::AI::Sandbox` from `pwn_eval` when the task needs this module.
20
+ Do not reimplement it in shell.
21
+
22
+ ## Methodologies
23
+
24
+ Generated from `pwn/ai/sandbox.rb`. Prefer the public class methods below.
25
+ Class methods take `(opts = {})` and read `opts`.
26
+
27
+ ## How to call
28
+
29
+ ```ruby
30
+ PWN::AI::Sandbox.help
31
+ PWN::AI::Sandbox.required_bins(opts)
32
+ ```
33
+
34
+ ## Public methods
35
+
36
+ - `required_bins`
37
+ - `mode`
38
+ - `classify`
39
+ - `exec`
40
+ - `wrap_shell`
41
+ - `wrap_ruby`
42
+ - `control_directory`
43
+ - `protect_call`
44
+ - `swarm_control`
45
+ - `workspace`
46
+ - `task_directory`
47
+ - `prepare_write_roots`
48
+ - `protected_roots`
49
+ - `authors`
50
+ - `help`
51
+
52
+ ## Source
53
+
54
+ `pwn/ai/sandbox.rb`
55
+
56
+ ## Verification
57
+
58
+ `PWN::AI::Sandbox.respond_to?(:required_bins)` after the
59
+ module is loaded. Read the source for parameter names.
@@ -126,7 +126,7 @@ module PWN
126
126
  end
127
127
 
128
128
  private_class_method def self.payload_tier(opts = {})
129
- kind = PWN::Plugins::AISandbox.classify(payload: opts[:payload].to_s)
129
+ kind = PWN::AI::Sandbox.classify(payload: opts[:payload].to_s)
130
130
  case kind.to_s
131
131
  when 'write' then 'destructive'
132
132
  when 'network' then 'active_scan'
@@ -141,7 +141,7 @@ module PWN
141
141
  runtime = Thread.current[:pwn_request_runtime]
142
142
  result = if runtime
143
143
  runtime.execute_tool(name: entry.name, args: args, effect: effect(name: entry.name, args: args), action_id: tool_call[:id] || tool_call['id']) do
144
- PWN::Plugins::AISandbox.protect_call(handler: { name: entry.name, args: args }, runtime: runtime, workspace: runtime.contract[:cwd], write_roots: runtime.contract[:required_artifacts]) do
144
+ PWN::AI::Sandbox.protect_call(handler: { name: entry.name, args: args }, runtime: runtime, workspace: runtime.contract[:cwd], write_roots: runtime.contract[:required_artifacts]) do
145
145
  entry.handler.call(args)
146
146
  end
147
147
  end
@@ -635,7 +635,7 @@ module PWN
635
635
  contract_sha256: Digest::SHA256.hexdigest(JSON.generate(contract)), contract: contract }
636
636
  end
637
637
 
638
- public_class_method def self.stats
638
+ public_class_method def self.stats(opts = {})
639
639
  rows = outcomes(limit: 10_000)
640
640
  total = rows.length
641
641
  claims = rows.count { |row| row[:claimed_completion] == true }
@@ -659,6 +659,7 @@ module PWN
659
659
  heur_ok = heur.count { |r| r[:success] == true }
660
660
  {
661
661
  total_outcomes: total,
662
+ submissions: (Submission.optional { Submission.stats } if opts.fetch(:include_submissions, true)),
662
663
  completion_claims: claims,
663
664
  checked_completion_claims: checked_claims,
664
665
  false_completions: false_completions,
@@ -737,7 +738,7 @@ module PWN
737
738
  end
738
739
  line
739
740
  end
740
- s = stats
741
+ s = stats(include_submissions: false)
741
742
  jm = s[:judge_mean]
742
743
  d = s[:proxy_distrust].to_f
743
744
  rate = d > 0.05 ? s[:adjusted_success_rate] : s[:success_rate]
@@ -1164,6 +1165,7 @@ module PWN
1164
1165
  stages_run << :policy
1165
1166
  Policy.finish(
1166
1167
  session_id: session_id,
1168
+ close_role: Thread.current[TurnFinalizer::INLINE_KEY] ? :deferred : :learning,
1167
1169
  score: v[:training_score],
1168
1170
  attribution: v.dig(:verification, :runner_version) == 1 ? v.dig(:verification, :attribution) : nil,
1169
1171
  confidence: v[:confidence],
@@ -2527,7 +2529,9 @@ module PWN
2527
2529
  )
2528
2530
 
2529
2531
  # Run stats and return its result
2530
- #{self}.stats
2532
+ #{self}.stats(
2533
+ include_submissions: 'optional - include the private submission totals; false skips the receipt scan used only for reporting'
2534
+ )
2531
2535
 
2532
2536
  # Run to context and return its result
2533
2537
  #{self}.to_context(