T09 · Insecure Skill Coding Practices
- Location
assess.py:234- Finding
Prompt Injection Through Untrusted Claim and Evidence Content
- Content
View full analysis
Vulnerability Details
File Location:
assess.py:234-251
Vulnerability Type: Prompt injection caused by direct interpolation of untrusted content
Risk Level: MediumVulnerable Code
python prompt = f"""You are a fact verification assistant. Based on the following [Claim] and [New Evidence], answer 6 judgments. Output only a JSON object, no other text. Claim: {claim} New Evidence: {evidence[:1500]} Judgment criteria: 1. direct_support: Does the evidence directly support the claim? 2. new_info: Does the evidence provide new information not previously mentioned? 3. logical_consistent: Is the evidence logically consistent with previously known information? 4. direct_refute: Does the evidence explicitly refute the claim? 5. limitation: Does the evidence point out limitations or exceptions? 6. error_outdated: Does the evidence reveal that the claim contains errors or outdated info? Output format: {{"direct_support": true/false, "new_info": true/false, "logical_consistent": true/false, "direct_refute": true/false, "limitation": true/false, "error_outdated": false}}"""The same unsafe prompt construction is duplicated in
get_assessment_prompt()atassess.py:426-443.Technical Analysis
The
claimandevidencearguments are inserted directly into an instruction-bearing prompt. The prompt does not clearly isolate these values as untrusted data and does not instruct the model to ignore commands contained within them.An attacker can therefore place model instructions in either field, such as directions to disregard the judgment criteria and return attacker-selected Boolean values. Those values directly control
support_score,refute_score, and the resulting belief state. Truncating evidence to 1,500 characters limits input size but does not prevent injection.This is classified as an insecure coding practice rather than malicious skill-level instruction hijacking because the flaw ...[truncated 1011 chars]
- Remediation
View remediation
Remediation Suggestions
- Put untrusted values in strongly delimited data blocks and explicitly state that instructions inside those blocks must never be followed.
- Prefer structured model APIs with distinct trusted-instruction and untrusted-data fields where available.
- Validate model output against a strict JSON schema requiring exactly the six expected Boolean properties.
- Reject extra keys, prose, malformed values, and contradictory combinations.
- Add adversarial prompt-injection tests for both
claimandevidence. - Apply the same protections to both
_extract_llm_features()andget_assessment_prompt(). - Where possible, corroborate model judgments with deterministic checks or independent evidence processing rather than treating one model response as authoritative.
