diff --git a/apps/worker/prompts/sast-enrichment-auth.txt b/apps/worker/prompts/sast-enrichment-auth.txt new file mode 100644 index 00000000..ece5df4b --- /dev/null +++ b/apps/worker/prompts/sast-enrichment-auth.txt @@ -0,0 +1,13 @@ +@include(shared/exploitation/_sast-enrichment-procedure.txt) + +These findings are authentication vulnerabilities. + +CRITICAL RULES: +- exploitation_hypothesis must describe what an attacker ACHIEVES, not just confirm the vulnerability exists. +- suggested_exploit_technique must be an actionable attack the exploitation agent can execute against a live application. +- source_endpoint: infer the HTTP method and path from the code context (route definitions, handler functions). +- For hard-coded credentials (CWE-798): exploitation_hypothesis should specify using the found credentials. +- For CSRF (CWE-352): include the state-changing action that can be forged. +- _sastId MUST be copied exactly from the input finding. It is the join key — never invent, renumber, or omit it. + +SAST FINDINGS: diff --git a/apps/worker/prompts/sast-enrichment-authz.txt b/apps/worker/prompts/sast-enrichment-authz.txt new file mode 100644 index 00000000..7618f1aa --- /dev/null +++ b/apps/worker/prompts/sast-enrichment-authz.txt @@ -0,0 +1,12 @@ +@include(shared/exploitation/_sast-enrichment-procedure.txt) + +These findings are authorization vulnerabilities. + +CRITICAL RULES: +- Horizontal: same role accessing another user's data. Vertical: lower role accessing higher role's functions. Context_Workflow: bypassing a required step/state. Mass_Assignment: adding privileged fields (role, isAdmin, permissions) to request body that the server binds without filtering. +- If a proof-of-concept exists in the SAST data, use its inputs to craft a specific minimal_witness. +- guard_evidence must describe what's MISSING, not what exists. +- side_effect must be a concrete unauthorized action (e.g., "read other user's medical records"), not vague ("unauthorized access"). +- _sastId MUST be copied exactly from the input finding. It is the join key — never invent, renumber, or omit it. + +SAST FINDINGS: diff --git a/apps/worker/prompts/sast-enrichment-injection.txt b/apps/worker/prompts/sast-enrichment-injection.txt new file mode 100644 index 00000000..511ac4f0 --- /dev/null +++ b/apps/worker/prompts/sast-enrichment-injection.txt @@ -0,0 +1,16 @@ +@include(shared/exploitation/_sast-enrichment-procedure.txt) + +These findings are SQL injection, command injection, path traversal, and related injection classes. Each finding must be transformed into a vulnerability object matching the schema. + +CRITICAL RULES: +- witness_payload MUST be tailored to the actual sink code. If the sink is `db.query("SELECT * FROM users WHERE name LIKE '%" + input + "%'")`, use `%' OR '%'='` not a generic `' OR 1=1--`. +- slot_type MUST reflect the actual SQL/command/file context from the code snippet. +- If dataflow path is provided, use it to build an accurate `path` field. +- If sanitization functions appear in the path, list them in `sanitization_observed` and explain in `mismatch_reason` why they're insufficient. +- Set externally_exploitable=true only if the source is user-controlled input (HTTP params, headers, request body, cookies). +- _sastId MUST be copied exactly from the input finding. It is the join key — never invent, renumber, or omit it. +- For XML injection (CWE-91): slot_type is XML-element or XML-attribute depending on where user input lands in the XML structure. +- For prompt injection (CWE-1427): slot_type is PROMPT-instruction. witness_payload should demonstrate instruction override, not generic text. +- For prototype pollution (CWE-1321): slot_type is PROTO-property. witness_payload should use __proto__ or constructor.prototype paths specific to the sink. + +SAST FINDINGS: diff --git a/apps/worker/prompts/sast-enrichment-miscellaneous.txt b/apps/worker/prompts/sast-enrichment-miscellaneous.txt new file mode 100644 index 00000000..7b92b157 --- /dev/null +++ b/apps/worker/prompts/sast-enrichment-miscellaneous.txt @@ -0,0 +1,14 @@ +@include(shared/exploitation/_sast-enrichment-procedure.txt) + +These findings are weaknesses that fall outside the injection, XSS, authentication, authorization and SSRF classes. They share no family: session lifetime, error-message disclosure, sensitive logging, cleartext storage, request forgery, redirection, framing, algorithmic complexity, race conditions. + +CRITICAL RULES: +- vulnerability_type is the weakness's own name, taken from the CWE on the finding (e.g. 'Insecure Randomness', 'Use of Hard-coded Cryptographic Key'). There is no fixed list to pick from, and it must not be forced into another class's vocabulary. +- proof_criterion is the field the exploitation agent works from: state the concrete observation that would settle whether this specific weakness is real. These findings carry no per-class proof ladder, so an unusable criterion leaves the agent nothing to aim at. +- observable_signal must be something visible from outside the application, not a restatement of the source code. +- exploitation_hypothesis must describe what an attacker ACHIEVES, not just confirm the weakness exists. +- suggested_exploit_technique must be an actionable attack the exploitation agent can execute against a live application. +- cwe carries the id from the finding, e.g. CWE-330. +- _sastId MUST be copied exactly from the input finding. It is the join key — never invent, renumber, or omit it. + +SAST FINDINGS: diff --git a/apps/worker/prompts/sast-enrichment-ssrf.txt b/apps/worker/prompts/sast-enrichment-ssrf.txt new file mode 100644 index 00000000..77b9f193 --- /dev/null +++ b/apps/worker/prompts/sast-enrichment-ssrf.txt @@ -0,0 +1,11 @@ +@include(shared/exploitation/_sast-enrichment-procedure.txt) + +These findings are Server-Side Request Forgery vulnerabilities. + +CRITICAL RULES: +- vulnerability_type must match the sink pattern: HTTP client → URL_Manipulation, redirect function → Redirect_Abuse, webhook registration → Webhook_Injection. +- exploitation_hypothesis should reference likely internal targets (cloud metadata, internal APIs, admin panels) based on code context. +- suggested_exploit_technique must be actionable — the exploitation agent will actually attempt this against the live app. +- _sastId MUST be copied exactly from the input finding. It is the join key — never invent, renumber, or omit it. + +SAST FINDINGS: diff --git a/apps/worker/prompts/sast-enrichment-xss.txt b/apps/worker/prompts/sast-enrichment-xss.txt new file mode 100644 index 00000000..99dc5440 --- /dev/null +++ b/apps/worker/prompts/sast-enrichment-xss.txt @@ -0,0 +1,11 @@ +@include(shared/exploitation/_sast-enrichment-procedure.txt) + +These findings are Cross-Site Scripting vulnerabilities. + +CRITICAL RULES: +- Determine vulnerability_type from the source: HTTP request param → Reflected, database read → Stored, client-side only → DOM-based. +- render_context MUST be inferred from the actual sink code. `innerHTML` → HTML_BODY, `setAttribute('href', ...)` → HTML_ATTRIBUTE, template literal in