T09 · Insecure Skill Coding Practices
- Location
agent_verifier/verifier.py:252- Finding
Semantic Verification Can Be Bypassed Through Prompt Injection and Fail-Open Response Parsing
- Content
View full analysis
Vulnerability Details
File Location:
agent_verifier/verifier.py, lines 79–123 and 252–310
Vulnerability Type: Prompt injection and fail-open security validation
Risk Level: HighVulnerable Code
python _DEFAULT_PROMPT = """You are reviewing a draft outbound message before it goes to a human recipient. Recipient: {recipient} Campaign: {campaign} Subject: {subject} Body: {body} Do THREE things: 1. **Atomic-claim decomposition.** Break the body into 1–10 atomic claims — small units of fact or intent that could be independently true or false. ... Return ONLY a JSON object with this exact shape (no markdown fences): {{ "atomic_claims": [ {{"claim": "<verbatim or close paraphrase>", "status": "verified|unverifiable|failed", "reason": "<one sentence>"}} ], "confidential": {{"severity": "PASS|WARN|BLOCK", "reason": "<short>"}}, "clarity": {{"severity": "PASS|WARN|BLOCK", "reason": "<short>"}}, "could_not_verify": "<one sentence, or empty string>", "needs_from_user": "<one sentence, or empty string>" }}"""python prompt = self._prompt.format( recipient=recipient, campaign=campaign, subject=subject, body=body[:self._max_body], ) try: raw = self._llm(prompt) except Exception as e: return (CheckResult("WARN", "llm", f"LLM call failed ({e!r}); defaulting to WARN"), *empty_extras) text = (raw or "").strip() if text.startswith("```"): text = text.split("```", 2)[1] if text.lower().startswith("json"): text = text[4:] text = text.rsplit("```", 1)[0].strip() try: verdict = json.loads(text) except Exception: return (CheckResult("WARN", "llm", "LLM returned non-JSON; defaulting to WARN"), *empty_extras) # Atomic claims — bias toward unverifiable when the model is silent. ...[truncated 3856 chars]- Remediation
View remediation
Remediation Suggestions
- Validate LLM responses against a strict schema before calculating a verdict. Require:
atomic_claimsto be an array.confidentialandclarityto be objects.- Both holistic axes to contain a recognized
PASS,WARN, orBLOCKseverity. - All required feedback fields to have their documented types.
- Fail closed when required fields are missing, malformed, or have unexpected types. A malformed security verdict should produce
BLOCK, or at minimumWARN, rather thanPASS. - Use provider-supported structured-output or JSON-schema enforcement where available.
- Separate trusted verifier instructions from untrusted message data using system/user message roles when supported by the LLM provider.
- Place untrusted fields in explicit structured delimiters and state that text inside those fields is data, not instructions. This reduces but does not eliminate prompt-injection risk.
- Consider applying independent deterministic checks to model output and requiring an explicit, complete attestation before permitting a semantic
PASS. - Add adversarial tests covering:
- A body requesting an empty JSON response.
- Missing
confidentialorclarityaxes. - Empty objects and arrays.
- Invalid severity values.
- Wrong field types.
- Attempts to place forged JSON or prompt instructions in every interpolated field.
- Validate LLM responses against a strict schema before calculating a verdict. Require:
