@abdulr7man/pensieve 0.0.0-stage → 1.2.2

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 (179) hide show
  1. package/LICENSE +684 -0
  2. package/README.md +180 -2
  3. package/VERSION +1 -0
  4. package/agents/README.md +16 -0
  5. package/agents/pensieve-code-auditor.md +58 -0
  6. package/agents/pensieve-mapper.md +46 -0
  7. package/agents/pensieve-planner.md +67 -0
  8. package/agents/pensieve-reconner.md +76 -0
  9. package/agents/pensieve-reporter.md +61 -0
  10. package/agents/pensieve-roe-checker.md +46 -0
  11. package/agents/pensieve-scoper.md +77 -0
  12. package/agents/pensieve-tester.md +83 -0
  13. package/agents/pensieve-validator.md +62 -0
  14. package/bin/pensieve +452 -0
  15. package/bin/pensieve-installer.cjs +5 -0
  16. package/commands/pensieve-close.md +6 -0
  17. package/commands/pensieve-map.md +6 -0
  18. package/commands/pensieve-new-engagement.md +6 -0
  19. package/commands/pensieve-pause.md +15 -0
  20. package/commands/pensieve-plan.md +6 -0
  21. package/commands/pensieve-progress.md +34 -0
  22. package/commands/pensieve-quick.md +8 -0
  23. package/commands/pensieve-recon.md +6 -0
  24. package/commands/pensieve-report.md +6 -0
  25. package/commands/pensieve-resume.md +6 -0
  26. package/commands/pensieve-retest.md +10 -0
  27. package/commands/pensieve-scope.md +49 -0
  28. package/commands/pensieve-surface.md +8 -0
  29. package/commands/pensieve-test.md +6 -0
  30. package/commands/pensieve-validate.md +6 -0
  31. package/docker/Dockerfile.pensieve-toolbox +75 -0
  32. package/docker/compose.pensieve-net.yml +37 -0
  33. package/docker/squid.conf.template +21 -0
  34. package/package.json +39 -4
  35. package/packs/ad/ad-killchain/checklist.md +64 -0
  36. package/packs/ad/ad-killchain/pack.yaml +19 -0
  37. package/packs/cloud/cloud-cis/checklist.md +66 -0
  38. package/packs/cloud/cloud-cis/pack.yaml +20 -0
  39. package/packs/fintech/practice-core/checklist.md +33 -0
  40. package/packs/fintech/practice-core/learnings.md +5 -0
  41. package/packs/fintech/practice-core/pack.yaml +18 -0
  42. package/packs/infra/ptes-infra/checklist.md +22 -0
  43. package/packs/infra/ptes-infra/pack.yaml +19 -0
  44. package/packs/mobile/owasp-masvs/checklist.md +80 -0
  45. package/packs/mobile/owasp-masvs/pack.yaml +20 -0
  46. package/packs/owasp-api-v4/checklist.md +85 -0
  47. package/packs/owasp-api-v4/learnings.md +6 -0
  48. package/packs/owasp-api-v4/pack.yaml +23 -0
  49. package/packs/owasp-api-v4/runbooks/API1/SKILL.md +66 -0
  50. package/packs/owasp-api-v4/runbooks/API10/SKILL.md +67 -0
  51. package/packs/owasp-api-v4/runbooks/API2/SKILL.md +129 -0
  52. package/packs/owasp-api-v4/runbooks/API3/SKILL.md +55 -0
  53. package/packs/owasp-api-v4/runbooks/API4/SKILL.md +59 -0
  54. package/packs/owasp-api-v4/runbooks/API5/SKILL.md +60 -0
  55. package/packs/owasp-api-v4/runbooks/API6/SKILL.md +63 -0
  56. package/packs/owasp-api-v4/runbooks/API7/SKILL.md +70 -0
  57. package/packs/owasp-api-v4/runbooks/API8/SKILL.md +72 -0
  58. package/packs/owasp-api-v4/runbooks/API9/SKILL.md +66 -0
  59. package/packs/thickclient/thickclient-core/checklist.md +60 -0
  60. package/packs/thickclient/thickclient-core/pack.yaml +24 -0
  61. package/packs/web/asvs-l2/checklist.md +50 -0
  62. package/packs/web/asvs-l2/learnings.md +6 -0
  63. package/packs/web/asvs-l2/pack.yaml +19 -0
  64. package/packs/web/asvs-l2/runbooks/V2-AUTH-ENUM/SKILL.md +75 -0
  65. package/packs/web/asvs-l2/runbooks/V2-AUTH-LIVE/SKILL.md +78 -0
  66. package/packs/web/asvs-l2/runbooks/V2-AUTH-MFA/SKILL.md +76 -0
  67. package/packs/web/asvs-l2/runbooks/V2-AUTH-RATE/SKILL.md +72 -0
  68. package/packs/web/owasp-testing-checklist/checklist.md +52 -0
  69. package/packs/web/owasp-testing-checklist/learnings.md +47 -0
  70. package/packs/web/owasp-testing-checklist/pack.yaml +21 -0
  71. package/packs/web/unauth-perimeter/checklist.md +72 -0
  72. package/packs/web/unauth-perimeter/pack.yaml +18 -0
  73. package/packs/web/unauth-perimeter/runbooks/PERIM-01/SKILL.md +60 -0
  74. package/packs/web/unauth-perimeter/runbooks/PERIM-02/SKILL.md +63 -0
  75. package/packs/web/unauth-perimeter/runbooks/PERIM-03/SKILL.md +62 -0
  76. package/packs/web/unauth-perimeter/runbooks/PERIM-04/SKILL.md +75 -0
  77. package/packs/web/unauth-perimeter/runbooks/PERIM-05/SKILL.md +66 -0
  78. package/packs/web/unauth-perimeter/runbooks/PERIM-06/SKILL.md +59 -0
  79. package/packs/web/unauth-perimeter/runbooks/PERIM-07/SKILL.md +56 -0
  80. package/packs/web/unauth-perimeter/runbooks/PERIM-08/SKILL.md +57 -0
  81. package/packs/web/unauth-perimeter/runbooks/PERIM-09/SKILL.md +62 -0
  82. package/packs/web/unauth-perimeter/runbooks/PERIM-10/SKILL.md +60 -0
  83. package/packs/whitebox/code-audit-core/checklist.md +36 -0
  84. package/packs/whitebox/code-audit-core/learnings.md +6 -0
  85. package/packs/whitebox/code-audit-core/pack.yaml +14 -0
  86. package/prompts/orchestrator-core.md +52 -0
  87. package/reference/attack-playbooks.md +57 -0
  88. package/reference/otp-relay.md +98 -0
  89. package/reference/param-profiles.md +48 -0
  90. package/reference/templates/FINDING.md +97 -0
  91. package/reference/tool-selection.md +64 -0
  92. package/reference/vulnerability-finding-standard.md +80 -0
  93. package/runtimes/hermes/hooks/injection-scan.py +290 -0
  94. package/runtimes/hermes/hooks/scope-guard.py +136 -0
  95. package/skills/pensieve/SKILL.md +134 -0
  96. package/skills/pensieve-close/SKILL.md +31 -0
  97. package/skills/pensieve-map/SKILL.md +25 -0
  98. package/skills/pensieve-new-engagement/SKILL.md +28 -0
  99. package/skills/pensieve-pause/SKILL.md +22 -0
  100. package/skills/pensieve-plan/SKILL.md +39 -0
  101. package/skills/pensieve-progress/SKILL.md +35 -0
  102. package/skills/pensieve-quick/SKILL.md +47 -0
  103. package/skills/pensieve-recon/SKILL.md +30 -0
  104. package/skills/pensieve-report/SKILL.md +46 -0
  105. package/skills/pensieve-resume/SKILL.md +33 -0
  106. package/skills/pensieve-retest/SKILL.md +35 -0
  107. package/skills/pensieve-scope/SKILL.md +35 -0
  108. package/skills/pensieve-surface/SKILL.md +36 -0
  109. package/skills/pensieve-test/SKILL.md +35 -0
  110. package/skills/pensieve-validate/SKILL.md +28 -0
  111. package/skills/pensieve-wiki/SKILL.md +39 -0
  112. package/src/installer/cli.cjs +209 -0
  113. package/src/installer/home.cjs +155 -0
  114. package/src/installer/runtimes.cjs +276 -0
  115. package/src/installer/uninstall.cjs +342 -0
  116. package/src/pensieve-sdk/bin/pensieve-sdk.cjs +1045 -0
  117. package/src/pensieve-sdk/lib/agent-translate.cjs +50 -0
  118. package/src/pensieve-sdk/lib/approvals.cjs +408 -0
  119. package/src/pensieve-sdk/lib/audit.cjs +290 -0
  120. package/src/pensieve-sdk/lib/checklist.cjs +337 -0
  121. package/src/pensieve-sdk/lib/clientlist.cjs +814 -0
  122. package/src/pensieve-sdk/lib/close.cjs +133 -0
  123. package/src/pensieve-sdk/lib/config.cjs +156 -0
  124. package/src/pensieve-sdk/lib/cvss.cjs +91 -0
  125. package/src/pensieve-sdk/lib/env.cjs +272 -0
  126. package/src/pensieve-sdk/lib/evidence.cjs +217 -0
  127. package/src/pensieve-sdk/lib/findings.cjs +1096 -0
  128. package/src/pensieve-sdk/lib/frontmatter.cjs +178 -0
  129. package/src/pensieve-sdk/lib/graph.cjs +607 -0
  130. package/src/pensieve-sdk/lib/ids.cjs +63 -0
  131. package/src/pensieve-sdk/lib/init.cjs +79 -0
  132. package/src/pensieve-sdk/lib/liveness.cjs +176 -0
  133. package/src/pensieve-sdk/lib/loop.cjs +619 -0
  134. package/src/pensieve-sdk/lib/migrate.cjs +57 -0
  135. package/src/pensieve-sdk/lib/monitor.cjs +69 -0
  136. package/src/pensieve-sdk/lib/pack.cjs +607 -0
  137. package/src/pensieve-sdk/lib/paths.cjs +73 -0
  138. package/src/pensieve-sdk/lib/pdf.cjs +291 -0
  139. package/src/pensieve-sdk/lib/recon.cjs +296 -0
  140. package/src/pensieve-sdk/lib/renderers/__pycache__/formal_report.cpython-314.pyc +0 -0
  141. package/src/pensieve-sdk/lib/renderers/formal_report.py +608 -0
  142. package/src/pensieve-sdk/lib/report.cjs +1135 -0
  143. package/src/pensieve-sdk/lib/runbook.cjs +124 -0
  144. package/src/pensieve-sdk/lib/sarif.cjs +154 -0
  145. package/src/pensieve-sdk/lib/scope.cjs +621 -0
  146. package/src/pensieve-sdk/lib/security.cjs +61 -0
  147. package/src/pensieve-sdk/lib/skills.cjs +193 -0
  148. package/src/pensieve-sdk/lib/state.cjs +610 -0
  149. package/src/pensieve-sdk/lib/subagent.cjs +658 -0
  150. package/src/pensieve-sdk/lib/target.cjs +149 -0
  151. package/src/pensieve-sdk/lib/tools.cjs +66 -0
  152. package/src/pensieve-sdk/lib/vault.cjs +122 -0
  153. package/src/pensieve-sdk/lib/vendor/cvss40.LICENSE +22 -0
  154. package/src/pensieve-sdk/lib/vendor/cvss40.js +1208 -0
  155. package/src/pensieve-sdk/package.json +11 -0
  156. package/templates/ACCOUNTS.md +35 -0
  157. package/templates/ATTACK-SURFACE.md +30 -0
  158. package/templates/FINDING.md +43 -0
  159. package/templates/PLAN.md +33 -0
  160. package/templates/PROJECT.md +29 -0
  161. package/templates/ROE.md +50 -0
  162. package/templates/RUN-LOG.md +19 -0
  163. package/templates/SCOPE.md +32 -0
  164. package/templates/VALIDATION.md +62 -0
  165. package/templates/report/REPORT.md +49 -0
  166. package/workflows/close.md +34 -0
  167. package/workflows/map.md +39 -0
  168. package/workflows/new-engagement.md +37 -0
  169. package/workflows/plan.md +45 -0
  170. package/workflows/progress.md +28 -0
  171. package/workflows/quick.md +67 -0
  172. package/workflows/recon.md +87 -0
  173. package/workflows/report.md +51 -0
  174. package/workflows/resume.md +26 -0
  175. package/workflows/retest.md +53 -0
  176. package/workflows/scope.md +47 -0
  177. package/workflows/surface.md +29 -0
  178. package/workflows/test.md +95 -0
  179. package/workflows/validate.md +34 -0
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: pensieve-progress
3
+ description: Status from files, never memory; outputs the exact next action.
4
+ ---
5
+
6
+ # /pensieve-progress
7
+
8
+ Follow workflows/progress.md exactly.
9
+
10
+ ## Pending adaptive candidates (LOOP-04)
11
+
12
+ After the standard status read, surface every pending ADAPTIVE plan
13
+ candidate so the owner sees them without reading raw dirs. A pending
14
+ candidate is a `plans/PLAN-*.md` with frontmatter `origin: adaptive` and NO
15
+ recorded approval — the count rides the STATE.md digest as
16
+ `adaptive candidates awaiting approval: N` (absent when N=0). The
17
+ candidates were emitted by `pensieve-sdk loop.candidates --engagement <dir>
18
+ --emit` (the deterministic derivation over engagement state).
19
+
20
+ Report, for each pending candidate:
21
+
22
+ - the plan id (e.g. `PLAN-003`) and that it is UNAPPROVED;
23
+ - its rationale source — the plan's `rationale` frontmatter, one of
24
+ `new-host <host>` (a newly recorded in-scope host enabled uncovered
25
+ pack items), `objective-edge <from>-><to> (<CWE>)` (an unpursued edge on
26
+ the shortest foothold→objective path), or
27
+ `clientlist-row <row>` (an uncovered, now-testable client checklist row);
28
+ - the record-approval command when the owner wants it to run:
29
+ `pensieve-sdk approve --engagement <dir> --artifact plan:<id> --by <name>`.
30
+
31
+ Pending candidates do NOT stall the swarm (owner decision 2026-11-20):
32
+ waves CONTINUE approved-only while candidates pend — no hard-stop, no
33
+ auto-approval. The approve verb is the only path into a wave; until then
34
+ the candidate stays visible here and counted in the digest.
@@ -0,0 +1,8 @@
1
+ ---
2
+ name: pensieve-quick
3
+ description: Fast lane — one ad-hoc in-scope test with full evidence+validation guarantees.
4
+ ---
5
+
6
+ # /pensieve-quick
7
+
8
+ Follow workflows/quick.md exactly.
@@ -0,0 +1,6 @@
1
+ ---
2
+ name: pensieve-recon
3
+ description: see workflows/recon.md
4
+ ---
5
+
6
+ Follow workflows/recon.md exactly. Its success_criteria define done.
@@ -0,0 +1,6 @@
1
+ ---
2
+ name: pensieve-report
3
+ description: see workflows/report.md
4
+ ---
5
+
6
+ Follow workflows/report.md exactly. Its success_criteria define done.
@@ -0,0 +1,6 @@
1
+ ---
2
+ name: pensieve-resume
3
+ description: see workflows/resume.md
4
+ ---
5
+
6
+ Follow workflows/resume.md exactly. Its success_criteria define done.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: pensieve-retest
3
+ description: see workflows/retest.md
4
+ ---
5
+
6
+ Follow workflows/retest.md exactly. Its success_criteria define done.
7
+
8
+ Gate order is fixed: the recon.fingerprint-diff gate runs FIRST — drift
9
+ aborts the retest before any replay (re-fingerprint + redo guidance in the
10
+ workflow).
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: pensieve-scope
3
+ description: see workflows/scope.md
4
+ ---
5
+
6
+ Follow workflows/scope.md exactly. Its success_criteria define done.
7
+
8
+ ## Checklist selection (the MANDATORY interview step)
9
+
10
+ The scoping interview MUST ask: **which checklist(s) will this engagement
11
+ run?** Present every option, then record the answer BEFORE scope approval
12
+ (`## SCOPE READY FOR APPROVAL`):
13
+
14
+ 1. **Built-in packs** — `pensieve-sdk pack.list` rows with `root: repo`;
15
+ filter by `applies_to` vs the engagement methodology (web/api/…) where
16
+ applicable.
17
+ 2. **User-root / custom packs** — the same `pack.list` rows with
18
+ `root: user` (`$PENSIEVE_HOME/packs` — the client's or your org's own
19
+ packs; they resolve identically to built-ins).
20
+ 3. **The client's own workbook** — a csv/xlsx tracker the client supplied.
21
+ Offer the import: the rows are hash-frozen at import and verdicts are
22
+ written back per `CR-<sheet>-<position>` id (the clientlist lane).
23
+ 4. **Nothing fits? Author a new one NOW** — `pensieve-sdk pack.scaffold
24
+ <area>/<name>` mints a valid-as-is skeleton in the user root; pause the
25
+ interview while the scoper fills in the real checks, then select it.
26
+
27
+ Record the selection — built-ins + user-root packs, plus the client
28
+ workbook when given — with ONE command:
29
+
30
+ pensieve-sdk scope.set-checklists --engagement <dir> \
31
+ --packs web/unauth-perimeter,custom/my-checks \
32
+ [--client-workbook <client-tracker.csv|xlsx>]
33
+
34
+ The verb is validate-then-write: every slug must resolve across BOTH pack
35
+ roots (unknown slug → `ok:false` naming the searched roots; a slug in both
36
+ roots → the pack-collision refusal naming both paths), and the workbook
37
+ imports only after full validation — NO partial state on any refusal. On
38
+ success it enables the packs (config.yaml `enabled_packs`, merged — never
39
+ clobbered), imports the workbook (clientlist snapshot, source sha256
40
+ returned), and writes the `## Checklists` section into SCOPE.md (each pack:
41
+ slug, root, version from pack.yaml; the snapshot slug + sha256). Re-running
42
+ it replaces the section and re-syncs `enabled_packs` deterministically
43
+ (idempotent).
44
+
45
+ **The single scope approval covers the checklist selection** — nothing new
46
+ to approve. The selection lands in SCOPE.md's `## Checklists` section, the
47
+ existing approved artifact, so record it via `scope.set-checklists` BEFORE
48
+ scope approval and the scope checkpoint (ai-approve / approve
49
+ `--artifact scope`) covers it.
@@ -0,0 +1,8 @@
1
+ ---
2
+ name: pensieve-surface
3
+ description: List, enable, or disable methodology packs for this engagement.
4
+ ---
5
+
6
+ # /pensieve-surface
7
+
8
+ Follow workflows/surface.md exactly.
@@ -0,0 +1,6 @@
1
+ ---
2
+ name: pensieve-test
3
+ description: see workflows/test.md
4
+ ---
5
+
6
+ Follow workflows/test.md exactly. Its success_criteria define done.
@@ -0,0 +1,6 @@
1
+ ---
2
+ name: pensieve-validate
3
+ description: see workflows/validate.md
4
+ ---
5
+
6
+ Follow workflows/validate.md exactly. Its success_criteria define done.
@@ -0,0 +1,75 @@
1
+ # PENSIEVE toolbox image (M0)
2
+ # Base decision from spike 002d: pentest-toolbox:full carries the full web/API
3
+ # toolset (nuclei, ffuf, httpx, sqlmap, git, dig). pentest-toolbox:latest was
4
+ # rejected (missing most of those).
5
+ # Pin note: this base is a LOCAL image (no registry digest). If it is ever
6
+ # pushed, replace the FROM with repo@sha256 pinning. Local image ID at build
7
+ # time: sha256:71c47ddfffde8b983643b2f5fa3f0ebd9b9e63b850ddc65d306835163e4969fe
8
+ FROM pentest-toolbox:full
9
+
10
+ # M0 toolset contract: fail the BUILD if any required tool is missing
11
+ # (image drift must break loudly, not during an engagement).
12
+ # 36-02 / TD-08: katana, arjun, gau, unzip, zip join the contract (git, dig
13
+ # and jq were already REQUIRED) — the release-test toolset gap. The pinned
14
+ # installs below were proven by the live incremental rebuild (2026-12-03,
15
+ # image pensieve-toolbox:local from pensieve-toolbox:2026-09-15-drifted; the
16
+ # contract base pentest-toolbox:full was no longer on the host — when it is
17
+ # available again a fresh build from THIS file must satisfy the same gate).
18
+ ARG KATANA_VERSION=1.9.0
19
+ ARG KATANA_SHA256=143281b738bfc745469447930529c085ac84122cf5c94ed25ed54542f1a8f59f
20
+ ARG FFUF_VERSION=2.3.0
21
+ ARG FFUF_SHA256=b2a3c725fcb9da175159682f54d6e9149f2905b00d84d155e7efc5d599975ceb
22
+ ARG GAU_VERSION=2.2.4
23
+ ARG GAU_SHA256=10e2e248c37cafb0be3f6d2931125296b95cd4186066d596d47fa417237529a9
24
+ RUN set -eux; cd /tmp \
25
+ && apt-get update && apt-get install -y --no-install-recommends unzip zip python3-pip \
26
+ && rm -rf /var/lib/apt/lists/* \
27
+ && curl -sSLo katana.zip "https://github.com/projectdiscovery/katana/releases/download/v${KATANA_VERSION}/katana_${KATANA_VERSION}_linux_amd64.zip" \
28
+ && curl -sSLo ffuf.tgz "https://github.com/ffuf/ffuf/releases/download/v${FFUF_VERSION}/ffuf_${FFUF_VERSION}_linux_amd64.tar.gz" \
29
+ && curl -sSLo gau.tgz "https://github.com/lc/gau/releases/download/v${GAU_VERSION}/gau_${GAU_VERSION}_linux_amd64.tar.gz" \
30
+ && echo "${KATANA_SHA256} katana.zip" | sha256sum -c - \
31
+ && echo "${FFUF_SHA256} ffuf.tgz" | sha256sum -c - \
32
+ && echo "${GAU_SHA256} gau.tgz" | sha256sum -c - \
33
+ && unzip -o -j katana.zip katana -d /usr/local/bin/ \
34
+ && tar xzf ffuf.tgz -C /usr/local/bin/ ffuf \
35
+ && tar xzf gau.tgz -C /usr/local/bin/ gau \
36
+ && rm -f katana.zip ffuf.tgz gau.tgz \
37
+ && python3 -m pip install --no-cache-dir arjun sqlmap \
38
+ || python3 -m pip install --no-cache-dir --break-system-packages arjun sqlmap
39
+ RUN for t in curl nmap nuclei ffuf httpx sqlmap python3 git dig jq katana arjun gau unzip zip; do \
40
+ command -v "$t" >/dev/null 2>&1 || { echo "MISSING REQUIRED TOOL: $t"; exit 1; }; \
41
+ done
42
+
43
+ # httpx FLAVOR fix (live M2 finding): the base image's /usr/local/bin/httpx
44
+ # is the PYTHON httpx CLI (a 152-byte pip shim) — packs' httpx lane
45
+ # (-tech-detect etc.) silently degraded. Replace with pinned
46
+ # projectdiscovery httpx, zip checksum-verified per digest-pin convention.
47
+ ARG PD_HTTPX_VERSION=1.12.0
48
+ ARG PD_HTTPX_SHA256=9d8439e8b6c9aa7d1e2314817a392e00d5178da3af5652f7475f88868f418f76
49
+ RUN set -eux; \
50
+ curl -sSL -o /tmp/httpx.zip \
51
+ "https://github.com/projectdiscovery/httpx/releases/download/v${PD_HTTPX_VERSION}/httpx_${PD_HTTPX_VERSION}_linux_amd64.zip"; \
52
+ echo "${PD_HTTPX_SHA256} /tmp/httpx.zip" | sha256sum -c -; \
53
+ cd /tmp && unzip -o httpx.zip httpx; \
54
+ install -m 0755 /tmp/httpx /usr/local/bin/httpx; \
55
+ rm -f /tmp/httpx.zip /tmp/httpx; \
56
+ httpx -version 2>&1 | grep -q "Current Version: v" \
57
+ || { echo "httpx is NOT the projectdiscovery build"; exit 1; }
58
+
59
+ # M2 hardening (ADR-015): unprivileged runtime user. The compose template runs
60
+ # the container as uid 1000; give that uid a passwd entry and a writable home
61
+ # (sqlmap/nuclei scratch). Runtime stays non-root; ADR-014 provisioning windows
62
+ # exec as -u 0 explicitly.
63
+ RUN id -u pensieve >/dev/null 2>&1 || useradd -m -u 1000 -s /bin/bash pensieve
64
+
65
+ # Update cadence (ADR-015): rebuild this image monthly AND at engagement start
66
+ # when the base changed — tools version-pin at build time (see apt/pip logs);
67
+ # `docker build --pull` refreshes the base. Image drift must break loudly
68
+ # (the contract above), never silently mid-engagement.
69
+
70
+ # Knowledge bases land here (cloned by installers/update tooling, never baked):
71
+ # /kb/wstg /kb/owasp-cheat-sheets /kb/payloads /kb/secLists
72
+ RUN mkdir -p /kb
73
+
74
+ WORKDIR /work
75
+ ENTRYPOINT ["sleep", "infinity"]
@@ -0,0 +1,37 @@
1
+ # docker/compose.pensieve-net.yml — REFERENCE template.
2
+ # Per-engagement compose files are GENERATED by `pensieve-sdk env.render`
3
+ # into <engagement>/.pentest/env/ (they carry absolute paths + the
4
+ # engagement's allowlist). This file documents the topology; do not run
5
+ # it directly — run the generated one.
6
+ #
7
+ # Topology validated in spikes/002-pensieve-net (8/8 probes):
8
+ # pensieve-net = docker internal network (NO route out, no external DNS)
9
+ # outbound = normal bridge (internet)
10
+ # egress = the ONLY container attached to both (squid allowlist proxy)
11
+ # toolbox = attached to pensieve-net ONLY — all testing runs here
12
+ name: pensieve-REFERENCE
13
+ services:
14
+ egress:
15
+ image: ubuntu/squid:latest
16
+ # ubuntu/squid entrypoint.sh mangles args (spike 002) — bypass it:
17
+ entrypoint: ["squid", "-N", "-f", "/etc/squid/squid.conf"]
18
+ volumes:
19
+ - ./squid.conf.template:/etc/squid/squid.conf:ro
20
+ - ./allowlist.txt:/etc/squid/allowlist.txt:ro # generated from SCOPE.md
21
+ networks:
22
+ - pensieve-net
23
+ - outbound
24
+ toolbox:
25
+ image: pensieve-toolbox:local # built from docker/Dockerfile.pensieve-toolbox
26
+ entrypoint: ["sleep", "infinity"]
27
+ networks:
28
+ - pensieve-net
29
+ environment:
30
+ http_proxy: http://egress:3128
31
+ https_proxy: http://egress:3128
32
+ HTTP_PROXY: http://egress:3128
33
+ HTTPS_PROXY: http://egress:3128
34
+ networks:
35
+ pensieve-net:
36
+ internal: true
37
+ outbound: {}
@@ -0,0 +1,21 @@
1
+ # PENSIEVE egress proxy — reference config (spike-002 validated).
2
+ # Generated per-engagement by `pensieve-sdk env.render` (Safe_ports from SCOPE.md).
3
+ # Lessons baked in: no stdio access_log (fatal under dropped privileges),
4
+ # default-deny allowlist, CONNECT restricted to SSL ports.
5
+ http_port 3128
6
+
7
+ acl allowed_sites dstdomain "/etc/squid/allowlist.txt"
8
+
9
+ acl Safe_ports port 80
10
+ acl Safe_ports port 443
11
+ # additional Safe_ports lines are generated from SCOPE.md asset ports
12
+ acl SSL_ports port 443
13
+ acl CONNECT method CONNECT
14
+
15
+ http_access deny !Safe_ports
16
+ http_access deny CONNECT !SSL_ports
17
+ http_access allow allowed_sites
18
+ http_access deny all
19
+
20
+ cache deny all
21
+ visible_hostname pensieve-egress
package/package.json CHANGED
@@ -1,6 +1,41 @@
1
1
  {
2
2
  "name": "@abdulr7man/pensieve",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.2.2",
4
+ "description": "AI agents run penetration tests. PENSIEVE keeps them in scope and makes them prove what they claim.",
5
+ "license": "AGPL-3.0-only",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/abdulr7mann/pensieve.git"
9
+ },
10
+ "author": "abdulr7man",
11
+ "bin": {
12
+ "pensieve": "bin/pensieve-installer.cjs"
13
+ },
14
+ "engines": {
15
+ "node": ">=22"
16
+ },
17
+ "files": [
18
+ "bin/pensieve-installer.cjs",
19
+ "bin/pensieve",
20
+ "src/installer/",
21
+ "src/pensieve-sdk/bin/",
22
+ "src/pensieve-sdk/lib/",
23
+ "src/pensieve-sdk/package.json",
24
+ "skills/",
25
+ "commands/",
26
+ "agents/",
27
+ "workflows/",
28
+ "packs/",
29
+ "prompts/",
30
+ "reference/",
31
+ "templates/",
32
+ "runtimes/hermes/hooks/",
33
+ "docker/",
34
+ "VERSION",
35
+ "README.md",
36
+ "LICENSE"
37
+ ],
38
+ "scripts": {
39
+ "test": "node --test 'tests/pensieve-sdk/**/*.test.cjs' 'tests/installer/**/*.test.cjs'"
40
+ }
41
+ }
@@ -0,0 +1,64 @@
1
+ # Active Directory — killchain checklist
2
+
3
+ | ID | Category | Status | Finding |
4
+ |----|----------|--------|---------|
5
+ | AD1 | Initial access (credential phishing / pass-the-hash) | | |
6
+ | AD2 | Discovery (domain, hosts, users, groups, GPO) | | |
7
+ | AD3 | Execution (lateral, scheduled tasks, WMI, PsExec) | | |
8
+ | AD4 | Persistence (GPO, scheduled task, service, registry) | | |
9
+ | AD5 | Privilege escalation (DCSync, DCSRB, token impersonation) | | |
10
+ | AD6 | Defense evasion (kerberos, signed binary, LSASS) | | |
11
+ | AD7 | Credential access (LSASS, DCSync, golden ticket) | | |
12
+ | AD8 | Lateral movement (pass-the-hash, pass-the-ticket, SMB) | | |
13
+
14
+ ## AD1 — Initial access (credential phishing / pass-the-hash)
15
+
16
+ - test: valid accounts with weak or reused passwords (per PROJECT.md intensity limits, never mass brute force) → report as finding class
17
+ - test: pass-the-hash on a captured NTLM/NTLM-v1 credential (hashcat/ntlm-cred flow) against the domain — confirms whether hash-accepted logon is enabled
18
+ - test: MFA bypass vectors on admin login — phishing-resilient MFA (FIDO2) vs. push/SMS; verify no legacy non-MFA admin path
19
+
20
+ ## AD2 — Discovery (domain, users, groups, GPO)
21
+
22
+ - test: domain trust, domain controller, schema, and forest enumeration (nltest / netdom / lmquery) — record every domain, trust, and forest
23
+ - test: user, group, and computer inventory via enumerate (BloodHound export or dirsrv) — save to WORK/data for the plan
24
+ - test: GPO enumeration (gpresult / gpo enumeration) — flag any GPO with admin-privileged or writable settings on a host in scope
25
+ - test: trust relationships and cross-forest delegation — name every trust in the finding if lateral is possible
26
+
27
+ ## AD3 — Execution (lateral, scheduled tasks, WMI, PsExec)
28
+
29
+ - test: PsExec / smbexec / winrs lateral movement from a foothold host to an in-scope host
30
+ - test: WMI remote execution (win32 process / scheduled task) — verify WMI is reachable and can run on a target
31
+ - test: scheduled-task persistence channel: create a hidden task that fires on logon or at a fixed interval (within engagement blackout window)
32
+
33
+ ## AD4 — Persistence (GPO, scheduled task, service, registry)
34
+
35
+ - test: GPO-based persistence — write a logon script or registry run key via a writable GPO
36
+ - test: scheduled-task persistence — hidden task surviving reboot; verify it fires and clears traces
37
+ - test: service persistence — install a test service that survives reboot and report whether it is logged
38
+
39
+ ## AD5 — Privilege escalation (DCSync, DCSRB, token impersonation)
40
+
41
+ - test: DCSync against a domain controller — extract the KRBTGT and report if a DC is reachable and unpatched
42
+ - test: DCSRB / golden-ticket issuance from a KRBTGT or DC sync artifact
43
+ - test: token impersonation — steal a high-value process token (LSASS or a privileged service) and elevate
44
+ - test: Kerberos pre-authentication bypass (AS-REQ / ASREPT) if the account is in scope
45
+
46
+ ## AD6 — Defense evasion (kerberos, signed binary, LSASS)
47
+
48
+ - test: signed-binary execution on a DC or domain-joined host (if in scope)
49
+ - test: LSASS protection bypasses (procmon, dump, protect-process) — verify whether LSASS is protected by PP and whether a bypass is possible
50
+ - test: Kerberos ticket manipulation (ticket replay, ticket forging) to confirm whether ticket binding is enforced or skipped
51
+
52
+ ## AD7 — Credential access (LSASS, DCSync, golden ticket)
53
+
54
+ - test: LSASS credential extraction on a domain-joined host (in scope) — report any plaintext password, hash, or ticket
55
+ - test: DCSync against the DC to confirm the full credential store is reachable
56
+ - test: golden-ticket creation from the KRBTGT (if DCSync succeeded) — verify acceptance
57
+
58
+ ## AD8 — Lateral movement (pass-the-hash, pass-the-ticket, SMB)
59
+
60
+ - test: pass-the-hash to an in-scope host via SMB
61
+ - test: pass-the-ticket to an in-scope host via SMB (Kerberos)
62
+ - test: RDP / SSH / WinRM lateral movement (where in scope) and whether MFA is enforced on the admin path
63
+
64
+ ## Engagement learnings
@@ -0,0 +1,19 @@
1
+ name: Active Directory Killchain
2
+ slug: ad/ad-killchain
3
+ version: "1.0"
4
+ tier: DEEP
5
+ applies_to:
6
+ - black
7
+ - gray
8
+ - white
9
+ source: https://attack.mitre.org/tactics/TA0009/ + https://github.com/spiffy/BloodHound
10
+ license: CC-BY-4.0 (Mitre/ATT&CK, The Hacker Recipes, BloodHound); structure adapted for PENSIEVE
11
+ tools:
12
+ - nmap|A|builtin|nmap
13
+ - bloodhound|A|pip|bloodhound
14
+ - netexec|A|pip|netexec
15
+ - impacket|A|pip|impacket
16
+ - smbclient|A|apt|smbclient
17
+ - crackmapexec|A|apt|crackmapexec
18
+ checklist: checklist.md
19
+ notes: "AD lane (ATT&CK-mapped): enum, kerberos, ADCS ESCx, BloodHound paths, lateral. DEEP enabled explicitly for regulated and bank work. Name the CWE and the ATT&CK technique ID in each finding."
@@ -0,0 +1,66 @@
1
+ # Cloud CIS Foundations + IAM / Metadata / Storage — checklist
2
+
3
+ | ID | Category | Status | Finding |
4
+ |----|----------|--------|---------|
5
+ | CLOUD1 | IAM (roles, policies, federation, MFA) | | |
6
+ | CLOUD2 | Identity and access management (cross-account, roles) | | |
7
+ | CLOUD3 | Metadata services (SSM, EC2 metadata, GCE metadata) | | |
8
+ | CLOUD4 | Storage (S3, GCS, B2, blob) | | |
9
+ | CLOUD5 | Networking (VPC, SG, NSG, firewall, DNS) | | |
10
+ | CLOUD6 | Compute (EC2, GCE, VMs) | | |
11
+ | CLOUD7 | Secrets and key management (KMS, secrets) | | |
12
+ | CLOUD8 | Logging and monitoring (CloudTrail, GCS audit) | | |
13
+
14
+ ## CLOUD1 — IAM (roles, policies, federation)
15
+
16
+ - test: IAM roles with admin or wildcard action (e.g., `s3:*`, `*`) — enumerate and report every role that can read/write data outside the target app's scope
17
+ - test: MFA on admin users and break-glass accounts — name any account without MFA
18
+ - test: long-lived credentials (access keys / service accounts) with no rotation; report if present
19
+ - test: wildcard / over-permissive policy (e.g., `Resource: *`) — name the policy and the affected resource
20
+
21
+ ## CLOUD2 — Identity and access management (cross-account, roles)
22
+
23
+ - test: cross-account roles and external IAM identities — enumerate every trust relationship and report any that grant access outside the target account
24
+ - test: federated identity providers (Okta, Azure AD, etc.) — verify the mapping and whether any federation grants more than needed
25
+ - test: service roles with no explicit deny; report any role that can read the target's data but is not the app's own identity
26
+
27
+ ## CLOUD3 — Metadata services (SSM, EC2 metadata, GCE metadata)
28
+
29
+ - test: EC2 / GCE metadata endpoint accessibility — check whether IMDSv2 is required (v1 vs v2); report if v1 is reachable from the container or VM
30
+ - test: SSM parameter store / GCP secret manager — enumerate parameters and report any that store secrets or credentials
31
+ - test: metadata token binding — confirm whether the metadata endpoint requires a one-time token and whether it is enforced
32
+
33
+ ## CLOUD4 — Storage (S3, GCS, B2, blob)
34
+
35
+ - test: public storage buckets (any object publicly readable/writable) — enumerate buckets and report any that are publicly accessible
36
+ - test: storage permissions — report any bucket with a policy that grants `s3:GetObject` / `storage.objects.get` to an external principal
37
+ - test: server-side encryption at rest — verify whether buckets are encrypted with KMS and whether keys are customer-managed
38
+ - test: lifecycle / versioning — report if versioning is disabled on a bucket that stores sensitive data
39
+
40
+ ## CLOUD5 — Networking (VPC, SG, NSG, firewall, DNS)
41
+
42
+ - test: security groups / NSGs / firewalls — enumerate every ingress/egress rule and report any that allow access from `0.0.0.0/0` to a management port
43
+ - test: public IP exposure — report any instance that is internet-reachable on a non-standard port
44
+ - test: DNS / route tables — verify that the VPC route table does not point to an external resolver that could exfiltrate
45
+ - test: cross-VPC / cross-account peering — name every peering and report any that exposes a private subnet to a public route
46
+
47
+ ## CLOUD6 — Compute (EC2, GCE, VMs)
48
+
49
+ - test: instance metadata / user data — verify that user-data scripts do not leak secrets to a public endpoint
50
+ - test: running processes on instances — enumerate processes and report any that are running as root with a secret in an environment variable
51
+ - test: containerized workloads — verify that the container runs as non-root and that the underlying node is not root-accessible
52
+ - test: patch level — report any instance that is not patched to the latest stable release (if in scope)
53
+
54
+ ## CLOUD7 — Secrets and key management (KMS, secrets)
55
+
56
+ - test: KMS / secret manager — enumerate keys and report any that are not customer-managed or that have no key policy restriction
57
+ - test: hardcoded secrets in code / config — grep the repo for `AKIA`, `secret_key`, `password=`, and report any that are present
58
+ - test: secret rotation — report if a secret has not been rotated within the policy window (if the policy is documented)
59
+
60
+ ## CLOUD8 — Logging and monitoring (CloudTrail, GCS audit)
61
+
62
+ - test: CloudTrail / GCS audit — verify that the trail covers the target account and that it is retained for the required period
63
+ - test: log integrity — report if the trail can be deleted or modified by a non-admin
64
+ - test: monitoring alerts — report any missing alert for a critical action (e.g., `IAM policy change`, `S3 public bucket`)
65
+
66
+ ## Engagement learnings
@@ -0,0 +1,20 @@
1
+ name: Cloud CIS Foundations + IAM / Metadata / Storage
2
+ slug: cloud/cloud-cis
3
+ version: "1.0"
4
+ tier: DEEP
5
+ applies_to:
6
+ - cloud
7
+ - api
8
+ - gray
9
+ - white
10
+ source: https://www.cisecurity.org/
11
+ license: CIS Controls (per-provider license); structure adapted for PENSIEVE
12
+ tools:
13
+ - nmap|A|builtin|nmap
14
+ - curl|A|builtin|curl
15
+ - jq|A|builtin|jq
16
+ - awscli|A|pip|awscli
17
+ - gcloud|A|apt|google-cloud-cli
18
+ - azurecli|A|apt|azure-cli
19
+ checklist: checklist.md
20
+ notes: "Cloud lane: CIS Foundations per provider plus IAM, metadata-service, and storage attack paths. DEEP for regulated cloud work. Name the cloud provider, CIS control ID, and CWE in each finding. All CLI calls are scoped to the target account only."
@@ -0,0 +1,33 @@
1
+ # Fintech Practice Core — Checklist
2
+
3
+ Status: `-` untested · `~` in progress · `x` tested-clean · `F-NNN` finding
4
+
5
+ | ID | Test | Status | Notes |
6
+ |----|------|--------|-------|
7
+ | FIN-OTP-01 | OTP brute-force: no rate limit / lockout on verify | - | |
8
+ | FIN-OTP-02 | OTP predictability: sequential, short, time-window reuse | - | |
9
+ | FIN-OTP-03 | OTP bypass: response manipulation, empty/null OTP, type juggling | - | |
10
+ | FIN-OTP-04 | OTP enumeration via differential responses/timing | - | |
11
+ | FIN-TXN-01 | Amount tampering: negative, zero, overflow, currency confusion | - | |
12
+ | FIN-TXN-02 | Beneficiary tampering: BOLA on accounts/cards/wallets | - | |
13
+ | FIN-TXN-03 | Race condition: double-spend / limit bypass via parallel requests | - | |
14
+ | FIN-TXN-04 | Idempotency-key reuse/replay across transactions | - | |
15
+ | FIN-TXN-05 | Balance/limit checks enforced server-side (not client) | - | |
16
+ | FIN-AUTH-01 | Password reset token: entropy, expiry, single-use, host injection | - | |
17
+ | FIN-AUTH-02 | Session: fixation, no rotation on auth/priv change, concurrent rules | - | |
18
+ | FIN-AUTH-03 | Step-up auth missing on sensitive ops (payout, beneficiary add) | - | |
19
+ | FIN-FRAUD-01 | Velocity rules absent: card testing, credential stuffing tolerance | - | |
20
+ | FIN-FRAUD-02 | Anti-fraud signals client-controlled (device id, geo header spoof) | - | |
21
+ | FIN-API-01 | Mass assignment on KYC/profile fields (role, limits, verified) | - | |
22
+ | FIN-API-02 | Webhook signature: missing/weak/replayable on payment callbacks | - | |
23
+
24
+ ## Per-item guidance
25
+
26
+ - FIN-TXN-03: ≥20 parallel identical requests; check balance invariant after.
27
+ - FIN-TXN-04: replay same idempotency key with DIFFERENT payload; must reject.
28
+ - FIN-OTP-03: try `"000000"`, `null`, `true`, array, float — type confusion.
29
+ - FIN-API-02: unsigned/mis-signed webhook must be rejected; replay valid one twice.
30
+
31
+ ## Engagement learnings
32
+
33
+ - test: Fintech captcha lane: treat captcha/OTP tokens as a money-flow control — verify the token is bound to the originating session/IP, has a short TTL, and cannot be replayed or forged from a leaked signing key. Source: captcha-bound-tokens-20260929 (F-001).
@@ -0,0 +1,5 @@
1
+ # Engagement learnings — candidate pool
2
+
3
+ _appended by pensieve-sdk pack.learn; promoted into the checklist by the pack author (ADR-022)_
4
+
5
+ - L-001 [promoted] (2026-09-30) Fintech captcha lane: treat captcha/OTP tokens as a money-flow control — verify the token is bound to the originating session/IP, has a short TTL, and cannot be replayed or forged from a leaked signing key. Source: captcha-bound-tokens-20260929 (F-001).
@@ -0,0 +1,18 @@
1
+ name: Fintech Practice Core
2
+ slug: fintech/practice-core
3
+ version: "1.0"
4
+ tier: DEFAULT
5
+ applies_to:
6
+ - api
7
+ - web
8
+ - gray
9
+ - black
10
+ source: practice-internal (enrich from engagement notes)
11
+ license: internal
12
+ tools:
13
+ - curl|A|builtin|curl
14
+ - jq|A|builtin|jq
15
+ - python3|A|builtin|python3
16
+ - httpie|A|pip|httpie
17
+ checklist: checklist.md
18
+ notes: Fintech-heavy practice pack — OTP, transaction, anti-fraud, idempotency lanes. Seed checklist; enrich from practice notes over time. CWE-named findings mandatory.
@@ -0,0 +1,22 @@
1
+ # PTES Infrastructure — Checklist
2
+
3
+ Status: `-` untested · `~` in progress · `x` tested-clean · `F-NNN` finding
4
+
5
+ | ID | Test | Status | Notes |
6
+ |----|------|--------|-------|
7
+ | PTES-INT-01 | OSINT/external footprint: DNS, whois, cert transparency, ASN | - | |
8
+ | PTES-INT-02 | Service enumeration: tcp/udp top ports, version detection | - | |
9
+ | PTES-INT-03 | Default/vendor credentials on exposed services | - | |
10
+ | PTES-INT-04 | Anonymous access: FTP, SMB, NFS, SNMP v1/v2 public | - | |
11
+ | PTES-VUL-01 | Known-CVE sweep on identified versions (nuclei) | - | |
12
+ | PTES-VUL-02 | TLS: weak protocol/cipher, expired/mismatched certs | - | |
13
+ | PTES-VUL-03 | Management interfaces exposed (ssh banners, ipmi, rdp, vnc) | - | |
14
+ | PTES-EXP-01 | Validate exploitable paths (PoC, evidence, no persistence) | - | |
15
+ | PTES-EXP-02 | Privilege boundary: service user vs root/admin exposure | - | |
16
+ | PTES-POST-01 | Lateral movement potential (documented, NOT executed by default) | - | |
17
+
18
+ ## Per-item guidance
19
+
20
+ - PTES-INT-02: `nmap -sV --top-ports 1000` SYN via proxy is impossible — connect scans only in lane A; SYN scans are lane-B (ADR-013), declare them.
21
+ - PTES-VUL-01: version → CVE mapping first, template match second; never fire exploit templates without plan approval.
22
+ - PTES-POST-01: default dial is no lateral movement; requires explicit scope line.
@@ -0,0 +1,19 @@
1
+ name: PTES Infrastructure
2
+ slug: infra/ptes-infra
3
+ version: "1.0"
4
+ tier: DEFAULT
5
+ applies_to:
6
+ - infra
7
+ - black
8
+ - gray
9
+ source: http://www.pentest-standard.org/index.php/Main_Page
10
+ license: CC-BY (methodology); structure adapted for PENSIEVE
11
+ tools:
12
+ - nmap|A|builtin|nmap
13
+ - nuclei|A|builtin|nuclei
14
+ - dig|A|builtin|dig
15
+ - curl|A|builtin|curl
16
+ - smbclient|A|apt|smbclient
17
+ - snmpwalk|A|apt|snmp
18
+ checklist: checklist.md
19
+ notes: Infrastructure lane (PTES-structured). Raw-socket scans are lane-B (ADR-013) unless the toolbox network allows; declare in the plan.