Exploit

From kaivyy/perseus · View interactive version

Exploit is an AI agent skill from the GitHub repository kaivyy/perseus. Use when verifying vulnerabilities with Dynamic Exploit Generation (Phase 3)

How to use this skill

Skill file

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.


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:

If subagent tools (e.g. Task, Agent, invoke_subagent) are available, launch verification tasks across findings simultaneously.

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:

  1. Document the exact function signature and input variable.
  2. Verify that type casting (e.g. parseInt, Number()) does NOT occur.
  3. Verify that the query or command execution engine receives the raw string.
  4. 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:


Kill-Switch Safety Thresholds

Immediately pause verification and mark findings as ABORTED-SAFETY if:


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.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.