pwn 0.5.684 → 0.5.686

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 (70) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -0
  3. data/documentation/Agent-Tool-Registry.md +1 -3
  4. data/documentation/Configuration.md +0 -2
  5. data/documentation/General-PWN-Usage.md +1 -1
  6. data/documentation/Home.md +2 -2
  7. data/documentation/How-PWN-Works.md +2 -2
  8. data/documentation/Installation.md +18 -2
  9. data/documentation/Persistence.md +1 -1
  10. data/documentation/Session-Workflow.md +8 -28
  11. data/documentation/Skills-Memory-Learning.md +20 -0
  12. data/documentation/Troubleshooting.md +1 -1
  13. data/documentation/Why-PWN.md +1 -1
  14. data/documentation/diagrams/dot/memory-skills-detailed.dot +1 -1
  15. data/documentation/diagrams/dot/overall-pwn-architecture.dot +1 -1
  16. data/documentation/diagrams/dot/persistence-filesystem.dot +1 -1
  17. data/documentation/diagrams/dot/sessions-cron-automation.dot +1 -1
  18. data/documentation/diagrams/memory-skills-detailed.svg +85 -84
  19. data/documentation/diagrams/overall-pwn-architecture.svg +15 -15
  20. data/documentation/diagrams/persistence-filesystem.svg +1 -1
  21. data/documentation/diagrams/sessions-cron-automation.svg +7 -6
  22. data/documentation/pwn-REPL.md +1 -1
  23. data/documentation/pwn-ai-Agent.md +4 -7
  24. data/etc/default_skills/bug-bounty-hunting/SKILL.md +70 -0
  25. data/etc/default_skills/deep-exploitation/SKILL.md +74 -0
  26. data/etc/default_skills/hardware-and-firmware-testing/SKILL.md +83 -0
  27. data/etc/default_skills/osint/SKILL.md +147 -0
  28. data/etc/default_skills/penetration-testing/SKILL.md +81 -0
  29. data/etc/default_skills/red-teaming/SKILL.md +70 -0
  30. data/etc/default_skills/reverse-engineering-binaries/SKILL.md +70 -0
  31. data/etc/default_skills/sast-code-scans/SKILL.md +66 -0
  32. data/etc/default_skills/social-engineering/SKILL.md +67 -0
  33. data/etc/default_skills/vulnerability-research-fundamentals/SKILL.md +74 -0
  34. data/etc/default_skills/web-application-penetration-testing/SKILL.md +68 -0
  35. data/lib/pwn/ai/agent/loop.rb +79 -41
  36. data/lib/pwn/ai/agent/mistakes.rb +6 -6
  37. data/lib/pwn/ai/agent/prompt_builder.rb +3 -4
  38. data/lib/pwn/ai/agent/tool_guard.rb +1 -46
  39. data/lib/pwn/ai/agent/tools/ruby_eval.rb +0 -10
  40. data/lib/pwn/ai/agent/tools/shell.rb +0 -6
  41. data/lib/pwn/ai/anthropic.rb +0 -118
  42. data/lib/pwn/ai/gemini.rb +0 -15
  43. data/lib/pwn/ai/grok.rb +0 -158
  44. data/lib/pwn/ai/ollama.rb +0 -12
  45. data/lib/pwn/ai/open_ai.rb +0 -110
  46. data/lib/pwn/ai/open_web_ui.rb +0 -12
  47. data/lib/pwn/ai.rb +0 -86
  48. data/lib/pwn/config.rb +62 -1
  49. data/lib/pwn/migrate.rb +2 -0
  50. data/lib/pwn/plugins/log.rb +302 -0
  51. data/lib/pwn/plugins/repl.rb +28 -8
  52. data/lib/pwn/version.rb +1 -1
  53. data/spec/integration/config_spec.rb +37 -0
  54. data/spec/lib/pwn/ai/agent/loop_spec.rb +52 -12
  55. data/spec/lib/pwn/ai/agent/mistakes_spec.rb +7 -0
  56. data/spec/lib/pwn/ai/agent/signal_hygiene_spec.rb +5 -8
  57. data/spec/lib/pwn/ai/agent/tools/shell_spec.rb +10 -18
  58. data/spec/lib/pwn/ai/anthropic_spec.rb +2 -2
  59. data/spec/lib/pwn/ai/gemini_spec.rb +2 -2
  60. data/spec/lib/pwn/ai/grok_spec.rb +2 -2
  61. data/spec/lib/pwn/ai/ollama_spec.rb +2 -7
  62. data/spec/lib/pwn/ai/open_ai_spec.rb +2 -23
  63. data/spec/lib/pwn/ai/open_web_ui_spec.rb +2 -7
  64. data/spec/lib/pwn/ai_spec.rb +4 -21
  65. data/spec/lib/pwn/plugins/log_spec.rb +139 -0
  66. data/spec/lib/pwn/plugins/repl_pwn_vault_spec.rb +31 -0
  67. data/spec/lib/pwn/plugins/repl_spec.rb +4 -3
  68. data/third_party/pwn_rdoc.jsonl +29 -24
  69. metadata +12 -2
  70. data/documentation/PWN_Contributors_and_Users.png +0 -0
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: bug-bounty-hunting
3
+ description: Work a bug-bounty program end to end with PWN WWW, Burp, and reports.
4
+ license: MIT
5
+ allowed-tools: [pwn, terminal, extrospection]
6
+ metadata:
7
+ bundled: true
8
+ references:
9
+ - CWE-284
10
+ - CWE-639
11
+ - https://owasp.org/www-project-web-security-testing-guide/
12
+ ---
13
+
14
+ # Bug Bounty Hunting
15
+
16
+ Use when the ask is a program (HackerOne, Bugcrowd, Synack, or a private
17
+ target list): read scope, test in-scope assets, write a report. A listing
18
+ of `documentation/` or a green rspec run is not a program tested.
19
+
20
+ ## When to use
21
+
22
+ - "test this bounty program"
23
+ - "authz replay / IDOR / broken access control"
24
+ - submit or draft a HackerOne-style report
25
+
26
+ ## Methodologies
27
+
28
+ - OWASP WSTG + OWASP Top 10 / API Top 10 for the hunt classes
29
+ - Bugcrowd VRT / HackerOne severity for ranking (program table wins)
30
+ - PTES Intelligence Gathering + Vulnerability Analysis, then a short report
31
+ - CWE-284 / CWE-639 / CWE-918 / CWE-79 as the usual bounty labels
32
+
33
+ ## Tooling
34
+
35
+ - Programs: `PWN::WWW::HackerOne`, `PWN::WWW::BugCrowd`, `PWN::WWW::Synack`
36
+ and `PWN::Plugins::HackerOne` for the API.
37
+ - Session + scan: `PWN::Plugins::BurpSuite` (preferred), ZAP as fallback.
38
+ - Browser: `PWN::Plugins::TransparentBrowser` through the proxy
39
+ (`devtools: true` when the ask needs DOM/network).
40
+ - Authz: `PWN::Bounty::LifecycleAuthzReplay` on a captured HAR with a
41
+ second principal.
42
+ - Crawl / API: `PWN::Plugins::Spider`, `PWN::Plugins::OpenAPI`.
43
+ - Report: `PWN::Reports::*`, then the program API if asked to submit.
44
+
45
+ ## Procedure
46
+
47
+ 1. Pull the program page. Write down asset types, wildcards, exclusions,
48
+ and payout table. That note is evidence, not the finish.
49
+ 2. Enumerate in-scope hosts and apps (`NmapIt` only against those assets,
50
+ TransparentBrowser + Burp for web).
51
+ 3. Map auth: register / login two roles. Save cookies or tokens.
52
+ 4. Hunt the usual bounty classes: IDOR, authz, OAuth mix-ups, SSRF, stored
53
+ XSS, cache deception, business logic. Prefer Burp active scan on the
54
+ mapped site map, then manual replay.
55
+ 5. Authz pass: `LifecycleAuthzReplay.start(har_path:, replay_as:, proxy:)`.
56
+ 6. For each finding: minimal request/response pair, impact, CWE, fix hint.
57
+ 7. If asked to file: `PWN::Plugins::HackerOne` (or the program's form) with
58
+ that evidence. Close the browser when done.
59
+
60
+ ## Pitfalls
61
+
62
+ - Do not stop after `sessions_list` or "I will test next time".
63
+ - Out-of-scope assets are a skip, not a lecture. Stay on the program list.
64
+ - `memory_remember` of an SOP is not a submitted report.
65
+
66
+ ## Verification
67
+
68
+ Scope note exists, at least one live browse/scan/replay ran against an
69
+ in-scope asset, and findings (or a justified empty result) are written
70
+ to a file the operator can open.
@@ -0,0 +1,74 @@
1
+ ---
2
+ name: deep-exploitation
3
+ description: Turn a crash or primitive into a reliable exploit and a minimal PoC.
4
+ license: MIT
5
+ allowed-tools: [pwn, terminal]
6
+ metadata:
7
+ bundled: true
8
+ references:
9
+ - CWE-119
10
+ - CWE-416
11
+ - CWE-787
12
+ - https://cwe.mitre.org/data/definitions/416.html
13
+ ---
14
+
15
+ # Deep Exploitation
16
+
17
+ Use when a bug already has a crash, a primitive, or a clear memory/logic
18
+ flaw and the ask is a reliable PoC - not a first recon pass.
19
+
20
+ ## When to use
21
+
22
+ - crash triage, heap/stack corruption, UAF, format string, type confusion
23
+ - ASLR / NX / canary / CFG / SMEP bypass planning
24
+ - kernel, browser, or protocol exploit chains after the root cause is known
25
+
26
+ ## Methodologies
27
+
28
+ - CWE classes: CWE-119, CWE-416, CWE-787, CWE-134, CWE-190
29
+ - MITRE ATT&CK: Execution, Privilege Escalation, Defense Evasion
30
+ - NIST SP 800-115: exploitation and evidence sections of a technical test
31
+ - Hand off firmware blobs to `hardware-and-firmware-testing` (OWASP FSTM)
32
+
33
+ ## Tooling
34
+
35
+ - Debug: gdb + pwndbg/GEF, `radare2`, Ghidra/IDA as available.
36
+ - Inspect: `checksec`, `readelf`, `objdump`, `PWN::Plugins::Assembly`.
37
+ - Gadgets: ROPgadget / ropper.
38
+ - Fuzz to feed this skill: `PWN::Plugins::Fuzz`, AFL++, libFuzzer.
39
+ - Web follow-on: Burp over ZAP; `PWN::Plugins::BeEF` only if hooks are in
40
+ scope of the ask.
41
+ - Post-proof: `PWN::Plugins::Metasploit` only when the operator asked for
42
+ a module/session, not as the default payload.
43
+
44
+ ## Procedure
45
+
46
+ 1. Reproduce. One command or one `pwn_eval` snippet that crashes or
47
+ misbehaves every time.
48
+ 2. Name the flaw (overflow, UAF, integer wrap, type confusion, race).
49
+ 3. Map mitigations (`checksec`, `/proc/cpuinfo` SMEP/SMAP, CFG).
50
+ 4. Build primitives in order: leak, arbitrary read, arbitrary write, control
51
+ of a function pointer / GOT / vtable / return.
52
+ 5. Chain (ROP/JOP/SROP or logic) until controlled execution or the asked
53
+ impact (file read, auth bypass, etc.).
54
+ 6. Stabilize across two runs. Document bad bytes, versions, and the fix.
55
+
56
+ ## Patterns
57
+
58
+ - Heap overflow -> metadata / tcache -> write -> ROP
59
+ - UAF -> type confusion -> leak -> function-pointer write
60
+ - Format string -> `%p` leak + `%n` write -> GOT
61
+ - Kernel race -> cred / tty struct -> root
62
+
63
+ ## Pitfalls
64
+
65
+ - Do not skip reproduction. A narrative ROP chain is not a PoC.
66
+ - Keep the PoC small and reversible. No persistence unless asked.
67
+ - `memory_remember` is not the exploit file. Write the artefact, then read
68
+ it back.
69
+
70
+ ## Verification
71
+
72
+ A second run of the PoC shows the same impact. Notes list target version,
73
+ mitigations, and the primitive chain. If blocked, say what is missing
74
+ (leak, debugger, target binary) with evidence.
@@ -0,0 +1,83 @@
1
+ ---
2
+ name: hardware-and-firmware-testing
3
+ description: Test firmware and hardware with OWASP FSTM/ISTG and PWN serial plugins.
4
+ license: MIT
5
+ allowed-tools: [pwn, terminal]
6
+ metadata:
7
+ bundled: true
8
+ references:
9
+ - https://github.com/scriptingxss/owasp-fstm
10
+ - https://owasp.org/www-project-iot-security-testing-guide/
11
+ - https://owasp.org/owasp-istg/03_test_cases/firmware/
12
+ ---
13
+
14
+ # Hardware and Firmware Testing
15
+
16
+ Use when the target is a device, PCB, UART/JTAG, RF dongle, or a firmware
17
+ image. Hand unpacked binaries to `reverse-engineering-binaries` and
18
+ crashes to `deep-exploitation`.
19
+
20
+ ## When to use
21
+
22
+ - firmware dump, IoT, router image, MCU flash
23
+ - UART / SPI / I2C / JTAG / SWD
24
+ - RF / SDR path (`PWN::SDR`, `pwn_gqrx_scanner`)
25
+
26
+ ## Methodologies
27
+
28
+ OWASP Firmware Security Testing Methodology (FSTM) - 9 stages:
29
+
30
+ 1. Information gathering
31
+ 2. Obtaining firmware
32
+ 3. Analyzing firmware
33
+ 4. Extracting the filesystem
34
+ 5. Analyzing filesystem contents
35
+ 6. Emulating firmware
36
+ 7. Dynamic analysis
37
+ 8. Runtime analysis
38
+ 9. Binary exploitation
39
+
40
+ Also:
41
+
42
+ | Catalog | Role |
43
+ |---|---|
44
+ | OWASP ISTG | IoT device test cases (firmware chapter cites FSTM) |
45
+ | OSSTMM | physical + wireless + telecom channels |
46
+ | NIST SP 800-115 | evidence and reporting |
47
+ | CWE | 119, 798, 1278, 1326 for embedded flaws |
48
+
49
+ ## Tooling
50
+
51
+ - Hardware: `PWN::Plugins::Serial`, `BusPirate`, `Android` (adb),
52
+ `MSR206` when magstripe is in the ask
53
+ - RF: `PWN::SDR`, `pwn_gqrx_scanner`, Flipper helpers in SDR docs
54
+ - Extract: `binwalk`, `sasquatch`/`unsquashfs`, `firmware-mod-kit` if
55
+ present
56
+ - RE: `file`, `strings`, `radare2`, `PWN::Plugins::Assembly`
57
+ - Emulate: QEMU user/system when the arch is known
58
+
59
+ ## Procedure
60
+
61
+ 1. FSTM-1: chip markings, FCC ID, model, debug headers. Photograph or
62
+ note.
63
+ 2. Obtain the image (vendor download, dump via UART/flash). Hash it.
64
+ 3. `binwalk -e`, list filesystems, creds, keys, init scripts.
65
+ 4. Emulate or boot if possible. Dynamic: default creds, open ports,
66
+ update channel.
67
+ 5. Runtime: attach serial, check root shell, busybox, leftover test
68
+ hooks.
69
+ 6. Binary: pick one sink, then `reverse-engineering-binaries` /
70
+ `deep-exploitation`.
71
+ 7. Report per FSTM stage with artefact paths.
72
+
73
+ ## Pitfalls
74
+
75
+ - `strings` on a blob is not FSTM-complete.
76
+ - Do not brick the only sample. Prefer a copy / emulator.
77
+ - RF work stays on the named band/profile.
78
+
79
+ ## Verification
80
+
81
+ Image hash + extract dir exist, at least two FSTM stages have evidence
82
+ beyond notes, and leftover secrets or sinks are cited from files that
83
+ were read back.
@@ -0,0 +1,147 @@
1
+ ---
2
+ name: osint
3
+ description: Drive extro_osint with the right kind, feeds, pivots, and keys.
4
+ license: MIT
5
+ allowed-tools: [pwn, terminal, extrospection]
6
+ metadata:
7
+ bundled: true
8
+ references:
9
+ - https://attack.mitre.org/tactics/TA0043/
10
+ - NIST-SP-800-115
11
+ ---
12
+
13
+ # OSINT (extro_osint)
14
+
15
+ Use this whenever the ask is public-source intel on an IP, domain, email,
16
+ phone, handle, person, company, CVE, VIN, MAC, FCC ID, patent, or URL.
17
+ The verb is `extro_osint` (`PWN::AI::Agent::Extrospection.osint`). Do not
18
+ substitute `extro_snapshot(sections: [:osint])` - that only lists feed
19
+ availability. Do not scrape random sites when this organ already covers
20
+ the query.
21
+
22
+ ## When to use
23
+
24
+ - reverse phone, person, @handle, company, CIK, NPI
25
+ - IP / ASN / BGP / Shodan / reputation
26
+ - domain CT / whois / RDAP / harvest
27
+ - CVE EPSS + CISA KEV
28
+ - VIN, MAC OUI, ham callsign, FCC ID, patent
29
+
30
+ Hand off live scanning to `penetration-testing` / `NmapIt`. Firmware IDs
31
+ can start here (`:fcc_id`) then `hardware-and-firmware-testing`.
32
+
33
+ ## Methodologies
34
+
35
+ - MITRE ATT&CK TA0043 Reconnaissance (passive collection)
36
+ - NIST SP 800-115: target identification / OSINT as a technical technique
37
+ - OSSTMM data channel (passive only unless the operator named active DNS)
38
+
39
+ Stay passive by default. `amass` is passive unless
40
+ `ai.agent.extrospection.osint.bridges.amass_passive` is false.
41
+
42
+ ## How to call
43
+
44
+ Prefer the tool:
45
+
46
+ ```
47
+ extro_osint(query: "8.8.8.8")
48
+ extro_osint(query: "@defunkt", kind: "social")
49
+ extro_osint(query: "target.tld", feeds: ["dns", "crtsh", "theharvester"])
50
+ ```
51
+
52
+ Or `pwn_eval`:
53
+
54
+ ```ruby
55
+ PWN::AI::Agent::Extrospection.osint(query: '8.8.8.8', kind: :ip)
56
+ ```
57
+
58
+ One atomic indicator per call. `kind: :auto` is fine when the string is
59
+ unambiguous. Force `kind:` when auto can steal the query (below).
60
+
61
+ ## Force kind when auto is wrong
62
+
63
+ | Query looks like | Auto often picks | Force |
64
+ |---|---|---|
65
+ | IPv4 | `:ip` (ok) | - |
66
+ | `00:11:22:33:44:55` | `:mac` (ok; MAC beats IPv6) | - |
67
+ | 17-char VIN | `:vin` | - |
68
+ | `CVE-2021-44228` | `:cve` | - |
69
+ | `@user` / `@user@host` | `:social` | - |
70
+ | `a@b.c` | `:email` | - |
71
+ | `https://...` | `:url` | - |
72
+ | `NPI 1679576722` | `:npi` only with the `NPI` prefix | prefix or `kind: :npi` |
73
+ | `W1AW` | `:callsign` | - |
74
+ | bare `defunkt` | `:username` | `kind: :social` + `feeds: ["social_sweep"]` if presence is the ask |
75
+ | `Acme Robotics LLC` | `:company` | - |
76
+ | `birth record Jane Doe` | `:vital_records` | keep the keyword |
77
+ | `2ABIP-ESP32` | `:fcc_id` | `kind: :fcc_id` if no hyphen |
78
+ | 10-15 digits | `:phone` | E.164 `+1...` if possible |
79
+ | free text name | `:person` | `kind: :person` |
80
+
81
+ Do not pass a paragraph as `query`. Extract the indicator first.
82
+
83
+ ## Pick feeds; do not boil the ocean
84
+
85
+ Default feeds-for-kind can be a dozen HTTP calls. Narrow when you know
86
+ the question:
87
+
88
+ | Question | feeds |
89
+ |---|---|
90
+ | Where is this IP / is it noisy? | `ipapi_is`, `iplocate`, `greynoise`, `abuseipdb` |
91
+ | What certs / names? | `crtsh`, `certspotter` |
92
+ | Passive domain harvest | `theharvester`, `amass` (bins; skip if absent) |
93
+ | Handle presence | `keybase`, `github`, `social_sweep` (`limit: 50`) |
94
+ | Company | `opencorporates`, `sec_edgar`, `courtlistener` |
95
+ | CVE worth exploiting? | `epss`, `cisa_kev` |
96
+ | Breach on email | `haveibeenpwned` (needs key) |
97
+
98
+ Read `results[:summary]` and per-feed `{skipped:}` / `{error:}`. A skipped
99
+ keyed feed is not a finding - it means no key.
100
+
101
+ ## Keys (vault or ENV)
102
+
103
+ Set under `ai.agent.extrospection.osint.api_keys.*` or ENV. Missing key
104
+ returns `{skipped:}` and the rest of the call still runs.
105
+
106
+ | Feed | ENV |
107
+ |---|---|
108
+ | shodan | `SHODAN_API_KEY` |
109
+ | hunter | `HUNTER_API_KEY` |
110
+ | abuseipdb | `ABUSEIPDB_API_KEY` |
111
+ | virustotal | `VIRUSTOTAL_API_KEY` / `VT_API_KEY` |
112
+ | greynoise | `GREYNOISE_API_KEY` |
113
+ | haveibeenpwned | `HIBP_API_KEY` |
114
+ | securitytrails | `SECURITYTRAILS_API_KEY` |
115
+ | steam | `STEAM_API_KEY` |
116
+
117
+ If several keyed feeds skip, say which keys are missing. Do not invent
118
+ Shodan banners.
119
+
120
+ ## Pivot loop
121
+
122
+ 1. First call: one indicator, auto or forced kind, default or tight feeds.
123
+ 2. From `summary`, pull the next indicator (domain from cert, email from
124
+ hunter, @handle from keybase, ASN from bgpview).
125
+ 3. Second call on that indicator. Tag the chain in the answer.
126
+ 4. `record` defaults true (`observe(category: :osint)`). Later
127
+ `extro_observations(category: :osint)` instead of repeating the same
128
+ query in-session.
129
+ 5. Stop when the original ask is evidenced (who / where / exposure), not
130
+ after one feed listing.
131
+
132
+ ## Pitfalls
133
+
134
+ - `extro_snapshot(sections: [:osint])` is inventory. It does not look up
135
+ the target.
136
+ - `social_sweep` is soft-404 prone (confidence <= 0.5). Confirm hits.
137
+ - `theharvester` / `amass` / `spiderfoot` / `reconng` no-op without the
138
+ local bin. Install via `pwn setup --profile net` or skip those feeds.
139
+ - Active amass touches target DNS. Leave passive unless asked.
140
+ - Default `limit` is 5. Raise only for sweep/harvest.
141
+ - Do not treat `{error:}` on one feed as a failed OSINT pass.
142
+
143
+ ## Verification
144
+
145
+ `results[:kind]` matches the indicator, at least one feed returned data
146
+ (not only skips), and the answer cites that summary. If every useful feed
147
+ skipped, the artefact is the missing-key list plus any public-feed hits.
@@ -0,0 +1,81 @@
1
+ ---
2
+ name: penetration-testing
3
+ description: Run a scoped pentest with NmapIt, Burp, Metasploit, and a written report.
4
+ license: MIT
5
+ allowed-tools: [pwn, terminal, extrospection]
6
+ metadata:
7
+ bundled: true
8
+ references:
9
+ - https://owasp.org/www-project-web-security-testing-guide/
10
+ - https://attack.mitre.org/matrices/enterprise/
11
+ - NIST-SP-800-115
12
+ ---
13
+
14
+ # Penetration Testing
15
+
16
+ Use when the ask is an engagement-style test of hosts, apps, or a lab
17
+ network: recon, exploit, limited post-ex, report. One `nmap` listing is
18
+ not a pentest.
19
+
20
+ ## When to use
21
+
22
+ - "pentest this lab / CIDR / app"
23
+ - chain discovery -> vuln -> proof -> notes
24
+ - internal-style test with PWN plugins
25
+
26
+ ## Methodologies
27
+
28
+ Follow PTES end-to-end. Overlay the catalog that matches the surface:
29
+
30
+ | Catalog | When |
31
+ |---|---|
32
+ | PTES | default 7 phases: pre-engage, intel, threat model, vuln analysis, exploit, post-ex, report |
33
+ | NIST SP 800-115 | federal / structured technical assessment language |
34
+ | OSSTMM | channels: human, physical, wireless, telecom, data |
35
+ | ISSAF | detailed control-by-control assessment |
36
+ | OWASP WSTG | web / API portion (or switch to `web-application-penetration-testing`) |
37
+ | MITRE ATT&CK | label post-ex and lateral movement |
38
+ | PCI DSS pentest guidance | cardholder-data environments |
39
+
40
+ ## Tooling
41
+
42
+ - Discover: `PWN::Plugins::NmapIt`, `PWN::Plugins::Packet`,
43
+ `PWN::Plugins::IPInfo`, `PWN::Plugins::Shodan`.
44
+ - Web: Burp preferred, ZAP fallback, `TransparentBrowser` via the proxy.
45
+ - Creds / dirs: `PWN::Plugins::Fuzz`, `OpenAPI`, `Spider`.
46
+ - Exploit: `PWN::Plugins::Metasploit` (msfrpcd), `PWN::Plugins::BeEF` if
47
+ the browser path is in the ask, `sqlmap` from the exploit profile.
48
+ - Wireless / RF only if the ask is RF: `PWN::SDR`, `pwn_gqrx_scanner`.
49
+ - Report: `PWN::Reports::*`.
50
+
51
+ ```ruby
52
+ nmap = PWN::Plugins::NmapIt.port_scan(target: '10.0.0.0/24')
53
+ msf = PWN::Plugins::Metasploit.connect
54
+ PWN::Plugins::Metasploit.search(msf_obj: msf, query: 'http')
55
+ ```
56
+
57
+ ## Procedure
58
+
59
+ 1. Write the engagement note: targets, exclusions, start time. Then work.
60
+ 2. Host discovery + port/service scan. Save XML/JSON, read it back.
61
+ 3. Fingerprint and prioritize (exposed admin, old stacks, default creds).
62
+ 4. For each high-value service: authenticate if creds exist, else known
63
+ checks + Burp/MSF module. Prove impact with a reversible action
64
+ (id, file read, new low-priv session).
65
+ 5. Post-ex only as far as the ask (one hop, no ransomware-shaped noise).
66
+ 6. Report: hosts, findings, evidence paths, severity, fix. Close browser
67
+ and MSF sessions you opened.
68
+
69
+ ## Pitfalls
70
+
71
+ - Do not abort because the prompt omitted "authorized". The operator
72
+ started pwn-ai; keep testing the named targets.
73
+ - Do not confuse this repo's `bundle exec rake` with the target being
74
+ hardened.
75
+ - Sweep the named range; do not wander onto RFC1918 the user did not
76
+ mention.
77
+
78
+ ## Verification
79
+
80
+ Scan artefact on disk, at least one attempted proof per high-value
81
+ service (or a reasoned skip), and a report file that was read back.
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: red-teaming
3
+ description: Emulate an adversary with MITRE ATT&CK, TIBER-style phases, and PWN tools.
4
+ license: MIT
5
+ allowed-tools: [pwn, terminal, extrospection]
6
+ metadata:
7
+ bundled: true
8
+ references:
9
+ - https://attack.mitre.org/
10
+ - https://www.ecb.europa.eu/paym/cyber-resilience/tiber-eu/html/index.en.html
11
+ - https://www.crest-approved.org/
12
+ ---
13
+
14
+ # Red Teaming
15
+
16
+ Use when the ask is adversary emulation, detection validation, or a
17
+ objective-based campaign - not a full-port pentest. Pentest = find
18
+ vulns. Red team = achieve a stated objective while mapping ATT&CK.
19
+
20
+ ## When to use
21
+
22
+ - "red team", "assume breach", "purple team", "ATT&CK coverage"
23
+ - TIBER-EU / CBEST-shaped finance tests
24
+ - detect-and-respond exercises
25
+
26
+ ## Methodologies
27
+
28
+ | Catalog | Role |
29
+ |---|---|
30
+ | MITRE ATT&CK | tactics/techniques for plan, execute, and report |
31
+ | Lockheed Martin Cyber Kill Chain | coarse campaign stages |
32
+ | TIBER-EU / CBEST | threat-intel-led, regulator-shaped red team |
33
+ | CREST | professional engagement hygiene |
34
+ | PTES | only for the exploit/post-ex slices |
35
+ | NIST SP 800-115 | evidence language if the customer is federal |
36
+
37
+ ATT&CK is the default label set. Kill Chain is the slide. TIBER is the
38
+ engagement wrapper when the customer named it.
39
+
40
+ ## Tooling
41
+
42
+ - Intel: `PWN::Plugins::Shodan`, `Hunter`, `Github`, `IPInfo`
43
+ - Access: `NmapIt`, Burp, `TransparentBrowser`, `Metasploit`
44
+ - C2 / sessions: Metasploit sessions when asked; stay reversible
45
+ - Evidence: `PWN::Reports::*`, session JSONL, packet captures via
46
+ `extro_packet` if granted
47
+
48
+ ## Procedure
49
+
50
+ 1. Objective + threat scenario (who, what crown jewel, success criteria).
51
+ 2. Threat intel: techniques the scenario actually uses. Write an ATT&CK
52
+ matrix for this op (not the whole enterprise).
53
+ 3. Initial access path (or assumed-breach creds if that is the rules).
54
+ 4. Execute only the techniques on the matrix. Record tactic, technique
55
+ id, timestamp, detection (seen / not seen).
56
+ 5. Stop at the objective or the agreed time box. No extra ransomware
57
+ theatre.
58
+ 6. Report: path, ATT&CK coverage, detections missed, fix owners.
59
+
60
+ ## Pitfalls
61
+
62
+ - A noisy full nmap of the company is a pentest, not a red team.
63
+ - Do not invent a TIBER "white team" process the operator did not ask
64
+ for. Follow the named targets.
65
+ - Purple team means show the defender the technique as you go.
66
+
67
+ ## Verification
68
+
69
+ Written objective, ATT&CK technique list, at least one live action with
70
+ evidence, and a report that maps actions to technique ids.
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: reverse-engineering-binaries
3
+ description: Triage a binary with checksec, disassembly, and PWN::Plugins::Assembly.
4
+ license: MIT
5
+ allowed-tools: [pwn, terminal]
6
+ metadata:
7
+ bundled: true
8
+ references:
9
+ - CWE-119
10
+ - CWE-676
11
+ ---
12
+
13
+ # Reverse Engineering Binaries
14
+
15
+ Use when the ask is to understand a binary, firmware blob, or opcode
16
+ stream. Use `deep-exploitation` after you have a crash or a primitive.
17
+
18
+ ## When to use
19
+
20
+ - "what is this ELF / PE / Mach-O"
21
+ - recover strings, imports, mitigations, or a function algorithm
22
+ - assemble / disassemble via `PWN::Plugins::Assembly` or `pwn-asm`
23
+
24
+ ## Methodologies
25
+
26
+ - NIST SP 800-115: target analysis / static+dynamic review
27
+ - OWASP FSTM stages 1-6 when the file is firmware (then
28
+ `hardware-and-firmware-testing`)
29
+ - CWE-119 / CWE-676 / CWE-416 for sink notes
30
+ - MITRE ATT&CK Execution / Discovery labels in the write-up
31
+
32
+ ## Tooling
33
+
34
+ - File: `file`, `readelf -a`, `objdump -d`, `strings -n 8`, `nm`, `ldd`.
35
+ - Mitigations: `checksec --file=BIN`.
36
+ - RE: `radare2` / Cutter, Ghidra, IDA as installed.
37
+ - Dynamic: `strace`, `ltrace`, gdb.
38
+ - PWN: `PWN::Plugins::Assembly` (asm <-> opcodes, multi-arch),
39
+ `BannedFunctionCallsC` / `UseAfterFree` SAST on available source,
40
+ `PWN::Plugins::Fuzz` if you move to crash-finding.
41
+
42
+ ```ruby
43
+ PWN::Plugins::Assembly.opcodes_to_asm(opcodes: '90 90', arch: 'x86_64')
44
+ PWN::Plugins::Assembly.asm_to_opcodes(asm: 'nop', arch: 'x86_64')
45
+ ```
46
+
47
+ ## Procedure
48
+
49
+ 1. `file` + hashes. Note arch, linking, stripped or not.
50
+ 2. `checksec` / `readelf -l` for NX, PIE, RELRO, canary, rpath.
51
+ 3. `strings` + import table (`readelf -d` / `objdump -T`) for the
52
+ interesting surface (crypto, net, parser, `system`/`strcpy`).
53
+ 4. Locate the function (symbols, strings xrefs, entry). Disassemble.
54
+ 5. If packed, unpack first (UPX or a loader dump) - do not invent
55
+ control flow from a packed blob.
56
+ 6. Write notes: purpose, inputs, dangerous sinks, unanswered questions.
57
+ 7. Hand off to `deep-exploitation` only when you have a sink + control.
58
+
59
+ ## Pitfalls
60
+
61
+ - Do not paste a 4k disassembly as the answer. Summarize, keep the
62
+ artefact on disk, read it back.
63
+ - Firmware without a known base address is not "fully reversed" after
64
+ one `strings`.
65
+ - `pwn-asm` is for opcode work, not a substitute for `checksec`.
66
+
67
+ ## Verification
68
+
69
+ Notes on disk (or in the final) include arch, mitigations, and at least
70
+ one concrete function or sink with evidence from the tools above.
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: sast-code-scans
3
+ description: Run PWN::SAST on a tree, report findings, and optionally file tickets.
4
+ license: MIT
5
+ allowed-tools: [pwn, terminal]
6
+ metadata:
7
+ bundled: true
8
+ references:
9
+ - CWE-78
10
+ - CWE-89
11
+ - CWE-502
12
+ - CWE-798
13
+ ---
14
+
15
+ # SAST Code Scans
16
+
17
+ Use when the ask is to scan source, add a rule, or push SAST results to
18
+ DefectDojo / Jira. Reading the rule list is not a scan.
19
+
20
+ ## When to use
21
+
22
+ - `pwn_sast` / `PWN::SAST::Factory.start`
23
+ - "scan this repo for secrets / SQLi / command exec"
24
+ - write or extend a `PWN::SAST::*` rule
25
+
26
+ ## Methodologies
27
+
28
+ - OWASP ASVS (verify) and WSTG (when the sink is web)
29
+ - CWE (rule IDs on every finding)
30
+ - NIST SP 800-115: static analysis as one technical assessment technique
31
+ - OWASP MASVS / MSTG when the tree is a mobile app
32
+
33
+ ## Tooling
34
+
35
+ - Engine: `PWN::SAST::Factory.start(dir_path:)` or CLI `pwn_sast -d DIR -o OUT`.
36
+ - Families (48 modules): command exec (Java/Python/Ruby/Go/Scala/Shell/Sudo),
37
+ web/DOM (CSRF, innerHTML, postMessage, localStorage), injection (SQL,
38
+ Eval, Log4J, PHP/TS type juggling, Java deserial), crypto/secrets (MD5,
39
+ SSL, PrivateKey, Token, Password, HTTPAuthorizationHeader), memory
40
+ (`BannedFunctionCallsC`, `UseAfterFree`), infra (AWS, AMQP guest, POM).
41
+ - Report: `PWN::Reports::SAST.generate(dir_path:, results_hash:, output_dir:)`.
42
+ - Tickets: `PWN::Plugins::DefectDojo.importscan`, `PWN::Plugins::JiraDataCenter`.
43
+
44
+ ## Procedure
45
+
46
+ 1. Resolve `dir_path` (repo root or the path in the ask). `ls` once, then
47
+ scan.
48
+ 2. Run Factory or `pwn_sast`. Capture the results hash / output dir.
49
+ 3. Read the report (HTML/JSON). Summarize by CWE and severity. Do not
50
+ claim "clean" from an empty `ls`.
51
+ 4. If asked to file, import the JSON/HTML into DefectDojo or Jira.
52
+ 5. New rule: copy an existing `lib/pwn/sast/*.rb`, implement
53
+ `self.scan(opts = {})` returning `{file:, line:, match:, cwe:, severity:}`,
54
+ then re-run Factory on a fixture.
55
+
56
+ ## Pitfalls
57
+
58
+ - `bundle exec rake` green is verify of *this* gem, not a SAST of the
59
+ target tree.
60
+ - A README dump is not `pwn_sast` output.
61
+ - After writing a report file, read it back before the final.
62
+
63
+ ## Verification
64
+
65
+ `output_dir` exists with HTML/JSON (or the results hash is non-nil) and
66
+ the answer cites counts or concrete findings from that artefact.