penthera 1.1.0
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.
- package/CHANGELOG.md +168 -0
- package/LICENSE +21 -0
- package/README.md +561 -0
- package/SECURITY.md +31 -0
- package/bin/penthera.js +3 -0
- package/bin/scan.js +11 -0
- package/docs/index.md +60 -0
- package/docs/owasp-wstg-coverage.md +79 -0
- package/lib/adaptive-probes.js +334 -0
- package/lib/attack-surface.js +149 -0
- package/lib/audit-loop.js +170 -0
- package/lib/blackbox/adaptive-scan.js +137 -0
- package/lib/blackbox/client-auth.js +60 -0
- package/lib/blackbox/email-dns.js +135 -0
- package/lib/blackbox/headers.js +91 -0
- package/lib/blackbox/idor.js +113 -0
- package/lib/blackbox/jwt.js +73 -0
- package/lib/blackbox/oauth.js +50 -0
- package/lib/blackbox/openapi.js +227 -0
- package/lib/compliance/incident.js +169 -0
- package/lib/compliance/index.js +163 -0
- package/lib/compliance/policy-pack.js +293 -0
- package/lib/compliance/questionnaire.js +113 -0
- package/lib/compliance/readiness.js +229 -0
- package/lib/compliance/self-assessment.js +66 -0
- package/lib/crawler.js +257 -0
- package/lib/fuzzer.js +233 -0
- package/lib/injections.js +676 -0
- package/lib/jurisdictions/nl.json +48 -0
- package/lib/knowledge-graph.js +232 -0
- package/lib/machine.js +814 -0
- package/lib/nuclei-loader.js +283 -0
- package/lib/owasp-wstg.js +204 -0
- package/lib/params.js +235 -0
- package/lib/plugins.js +70 -0
- package/lib/provenance.js +82 -0
- package/lib/recon.js +193 -0
- package/lib/remediation/index.js +219 -0
- package/lib/retirejs.js +239 -0
- package/lib/supply-chain.js +131 -0
- package/lib/templates.js +364 -0
- package/lib/tls.js +145 -0
- package/lib/whitebox/frameworks.js +139 -0
- package/lib/whitebox/sbom.js +144 -0
- package/lib/whitebox/secrets.js +111 -0
- package/package.json +76 -0
- package/pentest.config.example.js +82 -0
- package/scripts/package-skill.sh +16 -0
- package/skills/penthera/SKILL.md +272 -0
- package/skills/penthera/references/authorization.md +36 -0
- package/skills/penthera/references/output-and-ci.md +109 -0
- package/skills/penthera/references/profiles-and-flags.md +74 -0
- package/skills/penthera/references/remediation.md +267 -0
- package/skills/penthera/references/reporting.md +113 -0
- package/skills/penthera/references/secure-defaults.md +41 -0
- package/skills/penthera/references/troubleshooting.md +100 -0
- package/skills/penthera/scripts/preflight.sh +66 -0
- package/skills/penthera/scripts/validate-report.mjs +53 -0
- package/skills/penthera/scripts/validate-report.sh +8 -0
- package/src/cli/ansi.js +70 -0
- package/src/cli/baseline.js +37 -0
- package/src/cli/merge-results.js +71 -0
- package/src/cli/onboarding.js +216 -0
- package/src/cli/profiles.js +53 -0
- package/src/cli/prompt.js +64 -0
- package/src/cli/run-scan.js +152 -0
- package/src/cli.js +536 -0
- package/src/report/markdown.js +182 -0
- package/src/reporter.js +512 -0
- package/src/scan-repo.js +205 -0
- package/src/scan-url.js +563 -0
- package/src/utils/auth.js +13 -0
- package/src/utils/http.js +38 -0
- package/src/utils/url.js +54 -0
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: penthera
|
|
3
|
+
description: >
|
|
4
|
+
Runs authorized security scans on live URLs and local repos using the Penthera CLI
|
|
5
|
+
(TLS, headers, OpenAPI, auth hardening, secret scanning, optional injection probes),
|
|
6
|
+
then applies framework-aware fixes and re-scans to verify them. Use when the user asks
|
|
7
|
+
to scan, audit, harden, fix, pentest, or review security of their own app, staging URL,
|
|
8
|
+
localhost, or repo; apply security best practices; generate SARIF for GitHub; diff
|
|
9
|
+
against a baseline; or find hardcoded secrets before deploy. Do NOT use for targets
|
|
10
|
+
without explicit authorization.
|
|
11
|
+
license: MIT
|
|
12
|
+
compatibility: Node.js 18+, network access to target, Penthera CLI (npm link or node bin/penthera.js from repo). macOS only for --machine.
|
|
13
|
+
allowed-tools: "Bash(node:*) Bash(npm:*) Bash(penthera:*) Read Write Edit"
|
|
14
|
+
metadata:
|
|
15
|
+
author: danoszz
|
|
16
|
+
version: 1.1.0
|
|
17
|
+
category: security
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# Penthera Security Scanner
|
|
21
|
+
|
|
22
|
+
Lightweight security scanner for URLs, local repos, and (macOS) machine audits. Always run the authorization gate before any scan.
|
|
23
|
+
|
|
24
|
+
## Critical: Authorization gate
|
|
25
|
+
|
|
26
|
+
**Do not run Penthera until authorization is confirmed.**
|
|
27
|
+
|
|
28
|
+
Before the first scan in a session, ask the user to confirm ONE of:
|
|
29
|
+
|
|
30
|
+
1. They **own** the target (app, server, project).
|
|
31
|
+
2. They have **written authorization** from the system owner.
|
|
32
|
+
3. The target is **localhost** or a private lab they control.
|
|
33
|
+
|
|
34
|
+
If the user requests scanning a third-party domain (e.g. `google.com`, `example.com`) without claiming ownership or authorization, **stop and refuse**. When in doubt, do not scan.
|
|
35
|
+
|
|
36
|
+
For full policy, see [references/authorization.md](references/authorization.md).
|
|
37
|
+
|
|
38
|
+
## Preflight
|
|
39
|
+
|
|
40
|
+
Run before the first scan:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
bash skills/penthera/scripts/preflight.sh [URL]
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
From repo root. Pass the target URL to warn on non-localhost targets. Fix any errors before proceeding.
|
|
47
|
+
|
|
48
|
+
## Resolve CLI command
|
|
49
|
+
|
|
50
|
+
Use whichever is available:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
penthera --version # after npm link
|
|
54
|
+
node bin/penthera.js --version # from repo root
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
All examples below use `penthera`; substitute `node bin/penthera.js` when needed.
|
|
58
|
+
|
|
59
|
+
## Decision tree
|
|
60
|
+
|
|
61
|
+
| User intent | Command pattern |
|
|
62
|
+
|-------------|-----------------|
|
|
63
|
+
| First-time / unsure | `penthera` (interactive wizard, TTY) or `penthera-scan` |
|
|
64
|
+
| Scan a live URL | `penthera <url> --profile standard -o reports/scan.json` |
|
|
65
|
+
| Scan repo only (secrets, routes) | `penthera --repo . -o reports/repo-scan.json` |
|
|
66
|
+
| URL + source combined | `penthera <url> --repo . -o reports/scan.json --sarif reports/scan.sarif` |
|
|
67
|
+
| Scan and fix my app | Run a scan, then **Workflow 4** (apply fixes from [references/remediation.md](references/remediation.md), re-scan to verify) |
|
|
68
|
+
| Compare to previous scan | `penthera <url> -o reports/scan.json --baseline reports/previous.json` |
|
|
69
|
+
| Authenticated endpoints | Add `--auth-cookie` or `--auth-bearer` / `PENTHERA_*` env |
|
|
70
|
+
| macOS machine audit | `penthera --machine` |
|
|
71
|
+
|
|
72
|
+
## Default safe behavior
|
|
73
|
+
|
|
74
|
+
- Always use `--profile standard` unless the user explicitly requests deeper testing.
|
|
75
|
+
- Write reports to `reports/` (gitignored), never inside `skills/penthera/`.
|
|
76
|
+
- After scan, read the companion `.md` report and summarize findings by severity with fix recommendations.
|
|
77
|
+
|
|
78
|
+
## Destructive mode gate
|
|
79
|
+
|
|
80
|
+
These flags send **attack payloads**. Require explicit user confirmation before use:
|
|
81
|
+
|
|
82
|
+
- `--deep`, SQLi, SSTI, SSRF, XSS, CMDi probes
|
|
83
|
+
- `--fuzz`, property-based API fuzzing
|
|
84
|
+
- `--all`, enables recon + deep + fuzz
|
|
85
|
+
- `--profile deep`, maximum coverage
|
|
86
|
+
|
|
87
|
+
If user asks for "full pentest" or "deep scan", confirm they own the target and accept payload-based testing.
|
|
88
|
+
|
|
89
|
+
## Workflow 1: Pre-release audit
|
|
90
|
+
|
|
91
|
+
**Triggers:** "scan my staging app", "security audit before deploy", "check my app for vulnerabilities"
|
|
92
|
+
|
|
93
|
+
1. Confirm authorization (see gate above).
|
|
94
|
+
2. Run preflight.
|
|
95
|
+
3. Execute:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
mkdir -p reports
|
|
99
|
+
penthera https://staging.example.com --profile standard -o reports/scan.json
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
4. Read `reports/scan.md`, summarize critical/high/medium findings.
|
|
103
|
+
5. Recommend concrete fixes per finding.
|
|
104
|
+
6. Note exit code: `0` = no critical/high; `1` = critical/high found; `2` = scan failed.
|
|
105
|
+
|
|
106
|
+
## Workflow 2: Repo + live combined
|
|
107
|
+
|
|
108
|
+
**Triggers:** "scan my Next.js app and staging", "black-box and white-box scan"
|
|
109
|
+
|
|
110
|
+
1. Confirm authorization for the URL.
|
|
111
|
+
2. Run preflight with URL.
|
|
112
|
+
3. Execute:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
mkdir -p reports
|
|
116
|
+
penthera https://staging.example.com --repo . --profile standard \
|
|
117
|
+
-o reports/scan.json --sarif reports/scan.sarif
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
4. Summarize URL findings (headers, TLS, CORS, auth) and repo findings (secrets, API routes, trust boundaries).
|
|
121
|
+
5. Offer to upload SARIF via GitHub Actions (see [references/output-and-ci.md](references/output-and-ci.md)).
|
|
122
|
+
|
|
123
|
+
## Workflow 3: CI / baseline regression
|
|
124
|
+
|
|
125
|
+
**Triggers:** "compare to last scan", "only new findings", "regression check"
|
|
126
|
+
|
|
127
|
+
1. Confirm authorization and that `reports/previous.json` exists (or ask user for baseline path).
|
|
128
|
+
2. Execute:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
mkdir -p reports
|
|
132
|
+
penthera https://staging.example.com --profile standard \
|
|
133
|
+
-o reports/scan.json --baseline reports/previous.json
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
3. Report: new findings count, resolved count, unchanged count (printed to stderr during scan).
|
|
137
|
+
4. Focus summary on **new** findings only.
|
|
138
|
+
|
|
139
|
+
## Workflow 4: Scan and fix
|
|
140
|
+
|
|
141
|
+
**Triggers:** "scan and fix", "find and fix security issues", "harden my app", "fix the security headers", "apply security best practices"
|
|
142
|
+
|
|
143
|
+
The detect -> fix -> verify loop. Penthera detects; you (the agent) fix the user's code using the playbook; Penthera re-scans to prove it is resolved.
|
|
144
|
+
|
|
145
|
+
1. Confirm authorization (gate above). Read the **Fix-mode gate** below first.
|
|
146
|
+
2. Scan and read the findings:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
mkdir -p reports
|
|
150
|
+
penthera <url> --repo . --profile standard -o reports/scan.json
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
3. Detect the framework: check `package.json` / imports (`next`, `express`, `fastify`, `hono`) or `requirements.txt` (`fastapi`, `flask`).
|
|
154
|
+
4. For each finding, **highest severity first**, look it up by `category` in [references/remediation.md](references/remediation.md) and propose the framework-specific fix **as a diff**.
|
|
155
|
+
5. Apply each fix only after the user approves it.
|
|
156
|
+
6. **Re-scan to verify**: `penthera <url> --repo . -o reports/scan-after.json --baseline reports/scan.json`. A fix is done only when its finding no longer appears.
|
|
157
|
+
7. Report what is resolved and what remains.
|
|
158
|
+
|
|
159
|
+
To build secure-by-default so issues never appear, use [references/secure-defaults.md](references/secure-defaults.md).
|
|
160
|
+
|
|
161
|
+
## Fix-mode gate
|
|
162
|
+
|
|
163
|
+
Applying fixes **modifies the user's code**. Before editing:
|
|
164
|
+
|
|
165
|
+
- Show the diff for each fix and get explicit approval. Never blind-apply.
|
|
166
|
+
- Start with critical and high severity findings.
|
|
167
|
+
- Re-scan after each fix (or batch) to confirm it actually resolved the finding.
|
|
168
|
+
- Never apply fixes against a production system; work in the repo or a branch.
|
|
169
|
+
- Rotating an exposed secret and renewing a TLS certificate are **user actions**, not code edits, flag them clearly rather than attempting them.
|
|
170
|
+
|
|
171
|
+
## Workflow 5: Owner reports & questionnaire responses
|
|
172
|
+
|
|
173
|
+
**Triggers:** "answer this security questionnaire", "turn the scan into a report", "draft a remediation plan", "NIS2 evidence", "prefill the vendor questionnaire"
|
|
174
|
+
|
|
175
|
+
Turn a scan into documents the owner can act on and send. Full method and templates: [references/reporting.md](references/reporting.md).
|
|
176
|
+
|
|
177
|
+
1. Confirm authorization, then scan with JSON + framework mapping:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
mkdir -p reports
|
|
181
|
+
penthera <url> --repo . --framework nis2 -o reports/scan.json
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
2. Read `reports/scan.json`, use `actionPlan`, `compliance`, `emailAuth`, `findings`, and `executedProbes`.
|
|
185
|
+
3. Generate the requested document(s): a remediation plan, a security-questionnaire response, or a NIS2 duty-of-care evidence summary.
|
|
186
|
+
4. **Ground every answer in scan evidence.** Mark anything the scan can't support as `NEEDS HUMAN INPUT`, all organisational controls (incident process, backups, training). Never invent a control or imply certification.
|
|
187
|
+
5. Write drafts to `reports/` and end by listing every `NEEDS HUMAN INPUT` item so the owner knows what only they can answer.
|
|
188
|
+
|
|
189
|
+
## Authenticated scans
|
|
190
|
+
|
|
191
|
+
Only after authorization gate passes:
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
# Bearer token
|
|
195
|
+
PENTHERA_BEARER=eyJ... penthera https://myapp.com --profile standard -o reports/scan.json
|
|
196
|
+
|
|
197
|
+
# Session cookie
|
|
198
|
+
penthera https://myapp.com --auth-cookie "session=abc123" -o reports/scan.json
|
|
199
|
+
|
|
200
|
+
# Explicit flags
|
|
201
|
+
penthera https://myapp.com --auth-bearer "eyJ..." -o reports/scan.json
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Env vars: `PENTHERA_BEARER`, `PENTHERA_COOKIE`.
|
|
205
|
+
|
|
206
|
+
## Repo-only secret scan
|
|
207
|
+
|
|
208
|
+
**Triggers:** "find hardcoded secrets", "scan this repo for keys"
|
|
209
|
+
|
|
210
|
+
No URL authorization needed for local repo analysis:
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
penthera --repo . -o reports/repo-scan.json
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Summarize secret findings; remind user to rotate any exposed credentials.
|
|
217
|
+
|
|
218
|
+
## Examples
|
|
219
|
+
|
|
220
|
+
**Example 1: Localhost quick check**
|
|
221
|
+
|
|
222
|
+
User: "Scan my localhost app on port 3000"
|
|
223
|
+
|
|
224
|
+
Actions:
|
|
225
|
+
1. Confirm localhost, authorization satisfied.
|
|
226
|
+
2. `bash skills/penthera/scripts/preflight.sh http://localhost:3000`
|
|
227
|
+
3. `penthera http://localhost:3000 --profile quick -o reports/scan.json`
|
|
228
|
+
4. Summarize `reports/scan.md`.
|
|
229
|
+
|
|
230
|
+
**Example 2: Staging before deploy**
|
|
231
|
+
|
|
232
|
+
User: "Audit staging.myapp.com before we ship"
|
|
233
|
+
|
|
234
|
+
Actions:
|
|
235
|
+
1. Ask: "Do you own or have written authorization for staging.myapp.com?"
|
|
236
|
+
2. On confirmation, run standard profile scan with JSON + markdown output.
|
|
237
|
+
3. List critical/high items first with remediation steps.
|
|
238
|
+
|
|
239
|
+
**Example 3: Unauthorized target (must refuse)**
|
|
240
|
+
|
|
241
|
+
User: "Scan google.com for vulnerabilities"
|
|
242
|
+
|
|
243
|
+
Actions:
|
|
244
|
+
1. Do **not** run Penthera.
|
|
245
|
+
2. Explain that scanning third-party systems without authorization is not permitted.
|
|
246
|
+
3. Offer to scan their own app or localhost instead.
|
|
247
|
+
|
|
248
|
+
**Example 4: Scan and fix (localhost)**
|
|
249
|
+
|
|
250
|
+
User: "Scan my localhost:3000 and fix what you find"
|
|
251
|
+
|
|
252
|
+
Actions:
|
|
253
|
+
1. Confirm localhost, authorization satisfied. Run a standard scan with `--repo .`.
|
|
254
|
+
2. Detect the framework (e.g. Next.js from `package.json`).
|
|
255
|
+
3. For each finding, highest severity first, propose the fix from [references/remediation.md](references/remediation.md) as a diff; apply on approval.
|
|
256
|
+
4. Re-scan with `--baseline` to confirm each finding is resolved; report what is fixed and what remains.
|
|
257
|
+
|
|
258
|
+
## Do not use this skill for
|
|
259
|
+
|
|
260
|
+
- General coding help, weather, or unrelated tasks
|
|
261
|
+
- Scanning systems the user does not own or lacks permission to test
|
|
262
|
+
- Malicious exploitation or data exfiltration
|
|
263
|
+
|
|
264
|
+
## Additional resources
|
|
265
|
+
|
|
266
|
+
- Profiles and flags: [references/profiles-and-flags.md](references/profiles-and-flags.md)
|
|
267
|
+
- Output formats and CI: [references/output-and-ci.md](references/output-and-ci.md)
|
|
268
|
+
- Troubleshooting: [references/troubleshooting.md](references/troubleshooting.md)
|
|
269
|
+
- Authorization policy: [references/authorization.md](references/authorization.md)
|
|
270
|
+
- Remediation playbook (apply fixes): [references/remediation.md](references/remediation.md)
|
|
271
|
+
- Owner reports & questionnaire responses: [references/reporting.md](references/reporting.md)
|
|
272
|
+
- Secure defaults (build it right): [references/secure-defaults.md](references/secure-defaults.md)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Authorization and ethical use
|
|
2
|
+
|
|
3
|
+
Penthera sends HTTP requests to targets you specify. Some modes (`--deep`, `--fuzz`, `--all`) send **attack payloads** designed to find vulnerabilities. This is powerful tooling, treat it like a loaded instrument, not a toy.
|
|
4
|
+
|
|
5
|
+
## You may use Penthera when
|
|
6
|
+
|
|
7
|
+
- You **own** the target (your app, your server, your university project).
|
|
8
|
+
- You have **written authorization** from the system owner (email, ticket, signed scope document).
|
|
9
|
+
- You scan **localhost** or private lab environments you control.
|
|
10
|
+
- You use it for **defensive security**: research, coursework, CI hardening, pre-release audits.
|
|
11
|
+
|
|
12
|
+
## You must not use Penthera to
|
|
13
|
+
|
|
14
|
+
- Scan systems you do not own or lack explicit permission to test.
|
|
15
|
+
- Probe government, healthcare, financial, or third-party production systems without authorization.
|
|
16
|
+
- Attempt to exfiltrate data, disrupt services, or bypass access controls for malicious purposes.
|
|
17
|
+
- Use findings to attack, extort, or harm individuals or organizations.
|
|
18
|
+
|
|
19
|
+
## Legal notice
|
|
20
|
+
|
|
21
|
+
Unauthorized security testing may violate computer misuse laws (e.g. CFAA, UK Computer Misuse Act, EU national equivalents) and can result in **criminal prosecution**, **civil liability**, **IP blocking**, **account termination**, and **academic or professional penalties**.
|
|
22
|
+
|
|
23
|
+
**Penthera is provided for legitimate security research and defensive testing only.** The authors and contributors assume **no liability** for misuse. By using this tool, you accept full responsibility for ensuring your scans are authorized and lawful in your jurisdiction.
|
|
24
|
+
|
|
25
|
+
Penthera is a **research and hardening aid**, not a weapon. The goal is to find and fix weaknesses in systems you are responsible for, not to cause harm.
|
|
26
|
+
|
|
27
|
+
> Before scanning any URL that is not localhost, confirm you have permission. When in doubt, **do not scan**.
|
|
28
|
+
|
|
29
|
+
## Agent behavior
|
|
30
|
+
|
|
31
|
+
When acting as an agent with this skill:
|
|
32
|
+
|
|
33
|
+
1. Always ask for authorization confirmation before scanning non-localhost URLs.
|
|
34
|
+
2. Never assume permission from a bare URL in the user's message.
|
|
35
|
+
3. Refuse requests to scan well-known third-party domains without explicit ownership claim.
|
|
36
|
+
4. Require second confirmation before destructive modes (`--deep`, `--fuzz`, `--all`).
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Output formats and CI integration
|
|
2
|
+
|
|
3
|
+
## Output formats
|
|
4
|
+
|
|
5
|
+
| Format | Flag | Use |
|
|
6
|
+
|--------|------|-----|
|
|
7
|
+
| Terminal | *(default)* | Colored summary in the shell |
|
|
8
|
+
| **Markdown** | `--markdown file.md` or `-o file.json` | Human-readable report with executive summary, findings tables, recommended actions, companion `.md` written automatically when using `-o` with `.json` |
|
|
9
|
+
| JSON | `--json` or `-o file.json` | CI pipelines, baseline diffs, custom tooling |
|
|
10
|
+
| SARIF | `--sarif file.sarif` | GitHub Security / Code Scanning |
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
penthera https://myapp.com -o reports/scan.json
|
|
14
|
+
# → reports/scan.json (machine-readable)
|
|
15
|
+
# → reports/scan.md (human-readable)
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Reports should go in `reports/` (gitignored). Do not write scan artifacts into `skills/penthera/`.
|
|
19
|
+
|
|
20
|
+
## Exit codes
|
|
21
|
+
|
|
22
|
+
| Code | Meaning |
|
|
23
|
+
|------|---------|
|
|
24
|
+
| `0` | No critical or high findings |
|
|
25
|
+
| `1` | Critical or high findings detected |
|
|
26
|
+
| `2` | Scan failed (unreachable target, bad config) |
|
|
27
|
+
|
|
28
|
+
Use exit codes in CI to fail builds on severe findings:
|
|
29
|
+
|
|
30
|
+
```yaml
|
|
31
|
+
- run: node bin/penthera.js "$PENTEST_URL" --profile standard -o reports/scan.json
|
|
32
|
+
# Exit 1 fails the step when critical/high findings exist
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Baseline diff
|
|
36
|
+
|
|
37
|
+
Compare current scan against a previous JSON report:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
penthera https://myapp.com -o reports/scan.json --baseline reports/previous.json
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Output includes: new findings count, resolved count, unchanged count. Use for weekly regression checks.
|
|
44
|
+
|
|
45
|
+
## GitHub Actions
|
|
46
|
+
|
|
47
|
+
**Penthera CI** (`.github/workflows/ci.yml`) runs on every push:
|
|
48
|
+
|
|
49
|
+
1. Unit + mock server tests
|
|
50
|
+
2. Skill preflight check
|
|
51
|
+
3. Scan against the local mock API → JSON + SARIF
|
|
52
|
+
4. `validate-report.mjs` on the JSON output
|
|
53
|
+
5. SARIF upload to GitHub Security tab
|
|
54
|
+
|
|
55
|
+
For **your staging URL**, copy `.github/workflows/scan.example.yml` to `scan.yml`:
|
|
56
|
+
|
|
57
|
+
```yaml
|
|
58
|
+
name: Security Scan
|
|
59
|
+
|
|
60
|
+
on:
|
|
61
|
+
workflow_dispatch:
|
|
62
|
+
schedule:
|
|
63
|
+
- cron: "0 6 * * 1"
|
|
64
|
+
|
|
65
|
+
jobs:
|
|
66
|
+
penthera:
|
|
67
|
+
runs-on: ubuntu-latest
|
|
68
|
+
steps:
|
|
69
|
+
- uses: actions/checkout@v4
|
|
70
|
+
|
|
71
|
+
- uses: actions/setup-node@v4
|
|
72
|
+
with:
|
|
73
|
+
node-version: 20
|
|
74
|
+
cache: npm
|
|
75
|
+
|
|
76
|
+
- run: npm ci
|
|
77
|
+
|
|
78
|
+
- name: Scan staging URL
|
|
79
|
+
env:
|
|
80
|
+
PENTEST_URL: ${{ secrets.PENTEST_STAGING_URL }}
|
|
81
|
+
run: |
|
|
82
|
+
node bin/penthera.js "$PENTEST_URL" \
|
|
83
|
+
--profile standard \
|
|
84
|
+
-o reports/scan.json \
|
|
85
|
+
--sarif reports/scan.sarif
|
|
86
|
+
|
|
87
|
+
- uses: github/codeql-action/upload-sarif@v3
|
|
88
|
+
if: always()
|
|
89
|
+
with:
|
|
90
|
+
sarif_file: reports/scan.sarif
|
|
91
|
+
|
|
92
|
+
- uses: actions/upload-artifact@v4
|
|
93
|
+
if: always()
|
|
94
|
+
with:
|
|
95
|
+
name: penthera-reports
|
|
96
|
+
path: reports/
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Store `PENTEST_STAGING_URL` as a repository secret.
|
|
100
|
+
|
|
101
|
+
## Agent reporting workflow
|
|
102
|
+
|
|
103
|
+
After a scan:
|
|
104
|
+
|
|
105
|
+
1. Read `reports/scan.md` (or path from `-o` / `--markdown`).
|
|
106
|
+
2. Summarize by severity: critical → high → medium → low → info.
|
|
107
|
+
3. For each critical/high finding, suggest a concrete fix.
|
|
108
|
+
4. Mention exit code and whether CI would fail.
|
|
109
|
+
5. If baseline was used, highlight **new** findings only.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Profiles and scan flags
|
|
2
|
+
|
|
3
|
+
## Profiles
|
|
4
|
+
|
|
5
|
+
| Profile | Flag | Duration | What runs |
|
|
6
|
+
|---------|------|----------|-----------|
|
|
7
|
+
| **quick** | `--profile quick` | ~10s | Headers, OpenAPI, auth smoke tests; skips Retire.js and param discovery |
|
|
8
|
+
| **standard** | `--profile standard` | default | Full non-destructive scan: TLS, fingerprint, discovery, templates, CORS, cookies, Retire.js, param discovery, OpenAPI/auth |
|
|
9
|
+
| **deep** | `--profile deep` | longest | recon + injection probes + API fuzzing (requires authorization confirmation) |
|
|
10
|
+
|
|
11
|
+
## Individual mode flags
|
|
12
|
+
|
|
13
|
+
Override or extend profile defaults:
|
|
14
|
+
|
|
15
|
+
| Flag | Effect |
|
|
16
|
+
|------|--------|
|
|
17
|
+
| `--recon` | OSINT recon (subdomains, historical URLs) |
|
|
18
|
+
| `--deep` | Injection probes (SQLi, SSTI, SSRF, XSS, CMDi), sends attack payloads |
|
|
19
|
+
| `--fuzz` | Property-based API fuzzing |
|
|
20
|
+
| `--nuclei <path>` | Community Nuclei YAML templates |
|
|
21
|
+
| `--all` | Enable recon + deep + fuzz |
|
|
22
|
+
| `--machine` | macOS machine audit (keyloggers, trojans, rootkits) |
|
|
23
|
+
|
|
24
|
+
## Common options
|
|
25
|
+
|
|
26
|
+
| Flag | Description |
|
|
27
|
+
|------|-------------|
|
|
28
|
+
| `-r, --repo <path>` | Local repo for white-box analysis |
|
|
29
|
+
| `--api-root <path>` | API routes directory (default: auto-detect) |
|
|
30
|
+
| `-o, --output <file>` | JSON report (+ companion `.md` if `.json`) |
|
|
31
|
+
| `--markdown <file>` | Explicit Markdown report path |
|
|
32
|
+
| `--sarif <file>` | SARIF for GitHub Security tab |
|
|
33
|
+
| `--baseline <file>` | Compare against previous JSON report |
|
|
34
|
+
| `--auth-cookie <value>` | Cookie header for authenticated scans |
|
|
35
|
+
| `--auth-bearer <value>` | Bearer token for authenticated scans |
|
|
36
|
+
| `--json` | JSON to stdout |
|
|
37
|
+
| `--timeout <ms>` | Request timeout (default: 10000) |
|
|
38
|
+
| `--concurrency <n>` | Concurrent requests (default: 15) |
|
|
39
|
+
| `-v, --verbose` | Detailed output |
|
|
40
|
+
| `-q, --quiet` | Findings only |
|
|
41
|
+
|
|
42
|
+
## Auth environment variables
|
|
43
|
+
|
|
44
|
+
| Variable | Maps to |
|
|
45
|
+
|----------|---------|
|
|
46
|
+
| `PENTHERA_COOKIE` | Cookie header |
|
|
47
|
+
| `PENTHERA_BEARER` | Authorization Bearer token |
|
|
48
|
+
|
|
49
|
+
## URL scan coverage (black-box)
|
|
50
|
+
|
|
51
|
+
TLS, fingerprinting, endpoint discovery, built-in templates, CORS, cookies, Retire.js (JS CVEs), param discovery, OpenAPI/FastAPI probes, security headers, auth hardening, JWT probes.
|
|
52
|
+
|
|
53
|
+
## Repo scan coverage (white-box)
|
|
54
|
+
|
|
55
|
+
Next.js API route discovery, trust-boundary mapping, risky code patterns, hardcoded secrets (keys, tokens, private keys). Expanded route discovery in `routes/`, `api/`, `server/routes/`.
|
|
56
|
+
|
|
57
|
+
## Examples
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Safe default
|
|
61
|
+
penthera https://myapp.com --profile standard
|
|
62
|
+
|
|
63
|
+
# Fast smoke test
|
|
64
|
+
penthera http://localhost:3000 --profile quick -o reports/scan.json
|
|
65
|
+
|
|
66
|
+
# Maximum coverage (confirm authorization first)
|
|
67
|
+
penthera https://staging.myapp.com --profile deep -o reports/scan.json
|
|
68
|
+
|
|
69
|
+
# Repo secrets only
|
|
70
|
+
penthera --repo . -o reports/repo-scan.json
|
|
71
|
+
|
|
72
|
+
# Combined with Nuclei templates
|
|
73
|
+
penthera https://myapp.com --nuclei ~/nuclei-templates/http -o reports/scan.json
|
|
74
|
+
```
|