Perseus Exploit (Phase 3 - Defensive Verification & PoC)
Context & Authorization
IMPORTANT: This skill performs vulnerability verification and proof-of-concept validation on the user's own codebase. This is defensive security verification designed to eliminate false positives and demonstrate real-world impact to software engineers.
- Defensive Mission: We confirm whether code weaknesses are practically exploitable without introducing risk or service instability.
- Safety Rule: Never perform destructive actions (no
DROP TABLE,rm -rf, file alteration, or system corruption). - Production Guardrail: In production environments, rely exclusively on static code trace proofs and non-invasive offline verification.
Overview
This skill executes the Verification Phase of the Perseus framework. Rather than reporting raw scanner alerts or unverified theories, Perseus subjects each candidate finding from perseus-audit to rigorous verification.
Goal: Filter false positives, prove exploitability with the smallest safe indicator, and determine accurate business severity.
Agent Execution Strategy (Dual-Mode)
When executing this skill, adapt to the runtime environment:
- Mode A — Subagents Available (Multi-Agent/Parallel):
If subagent tools (e.g. Task, Agent, invoke_subagent) are available, launch verification tasks across findings simultaneously.
- Mode B — Direct Execution (Single-Agent Fallback — UNIVERSAL):
If no subagent tool exists in your runtime, DO NOT attempt to call non-existent subagent tools. Systematically verify each finding from deliverables/audit_analysis.md sequentially in the current session.
Verification Methodology (Defensive PoC Engine)
Choose the verification technique permitted by the current Engagement Mode:
| Engagement Mode | Permitted Verification Techniques |
|-----------------|-----------------------------------|
| PRODUCTION_SAFE (Default) | Static Taint Proof & Mock Verification: Prove unconstrained dataflow through code AST, or construct benign offline unit tests. No live disruptive network payloads. |
| STAGING_ACTIVE | Controlled Active Probes: Targeted, throttled requests using benign canary values (e.g. harmless math expressions {{7*7}}, safe time delays sleep 0.1, benign UUID strings). |
| LAB_FULL / LAB_RED_TEAM | Dynamic Simulation: Broader payload mutation and chained workflow testing within isolated developer sandboxes. |
Three Verification Methods
Method 1: Static Code Trace Proof (Universal & 100% Safe)
Prove that untrusted input reaches the sink without being modified, sanitized, or validated:
- Document the exact function signature and input variable.
- Verify that type casting (e.g.
parseInt,Number()) does NOT occur. - Verify that the query or command execution engine receives the raw string.
- Construct the theoretical payload and demonstrate how the AST or SQL lexer would interpret it.
Method 2: Offline Unit Test / Script PoC
Synthesize a minimal, standalone script or test snippet reproducing the vulnerability logic:
// Example: Demonstrating NoSQL Operator Injection offline
const filter = { username: "admin", password: { "$ne": "" } };
// Shows how Mongoose/MongoDB evaluates this condition without live server disruption
Method 3: Non-Destructive Active Canary Verification
When testing active local or staging services:
- SQLi: Use boolean logic that returns identical data (e.g.
' AND '1'='1), harmless string concatenation, or sub-second time delays. - Command Injection: Use harmless output markers (
echo perseus_canary_$(date +%s)). - XSS: Use harmless script markers (
<script>/*perseus_canary*/</script>or checking HTML reflection without browser execution). - SSRF: Point requests to loopback addresses only if explicitly authorized, or check URL validation logic statically.
Kill-Switch Safety Thresholds
Immediately pause verification and mark findings as ABORTED-SAFETY if:
- Target server response time spikes significantly (> 2x baseline).
- Sustained HTTP 500 error rate exceeds baseline.
- Any unhandled exception indicates unintended state mutation.
Deliverables & Output Format
Ensure mkdir -p deliverables exists. Record all verification outcomes in deliverables/exploitation_report.md:
# Vulnerability Verification & Exploitation Report
## Verification Overview
- **Engagement Mode:** `PRODUCTION_SAFE`
- **Total Audit Findings Tested:** X
- **Verified Exploitable:** Y
- **False Positives Filtered:** Z
- **Potential / Prod-Blocked:** W
---
## Finding Verifications
### VERIFIED-001: SQL Injection in Order Sorting
- **Audit ID:** AUDIT-001
- **Severity:** Critical (9.4)
- **Status:** `VERIFIED`
- **Verification Method:** Static Code Trace Proof & AST analysis
#### Evidence of Exploitability
1. In `src/controllers/orderController.ts:34`, `req.query.sort` is accepted without whitelist validation.
2. In `src/services/orderService.ts:112`, the query string is constructed via:
`"SELECT * FROM orders ORDER BY " + sort`
3. If input is `(CASE WHEN (1=1) THEN id ELSE created_at END)`, the database engine executes the subquery directly.
4. No ORM parameterization or column name whitelist is applied.
#### Safe Proof of Concept (Curl / Request Representation)
GET /api/orders?sort=id;-- HTTP/1.1
Host: localhost:3000
Authorization: Bearer <test_token>
#### Verification Result
- **Result:** `VERIFIED`
- **Confidence:** High
- **Production Impact:** High (Data exfiltration, database structure disclosure)
Next Step: Proceed to perseus-report to generate the executive report and unified remediation patches.