T09 · Insecure Skill Coding Practices
- Location
SKILL.md:109- Finding
Indirect Prompt Injection Through Untrusted PDF and Glossary Content
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 109-114
Vulnerability Type: Indirect prompt injection caused by unsafe handling of untrusted document content
Risk Level: MediumRelevant Skill Instruction:
markdown ### Step 2: Perform LLM Translation - **Image-only page** (`is_empty: true`): Skip translation and write `Page {page_num}: Image-only page` - **Page with text**: Submit the source `text`, matching `matched_terms`, current dedicated glossary, and user-provided translation style instructions to the model for translation.Technical Analysis
The workflow directs the agent to submit text extracted from arbitrary PDF files and glossary entries directly to the language model. It does not establish a trust boundary around that content or explicitly instruct the model to treat instructions contained in the source material as inert data.
PDF text and glossary files are attacker-controllable inputs. A malicious document can include statements formatted as model instructions, such as directions to ignore the translation task, reveal contextual data, alter output, invoke available tools, or generate attacker-selected glossary entries. Because the document content is inserted into the same model context used to perform the task, the model may interpret those statements as executable instructions rather than material to translate.
The dynamic glossary increases the potential persistence within the current translation job: model-generated terms are appended to a file and reused as context on later pages. A successful injection could therefore influence subsequent translation steps by causing malicious or misleading content to be stored in that glossary.
Attack Path
- An attacker creates or modifies a PDF or glossary containing instruction-like text.
- The user processes that file using the Skill.
scripts/extract_page.pyextracts the malicious text or returns the malicious glossar ...[truncated 1421 chars]
- Remediation
View remediation
Remediation Suggestions
- Add an explicit instruction before every model call stating that PDF text and glossary entries are untrusted data and that any commands found inside them must not be followed.
- Place source text and glossary data in clearly delimited data blocks, separate from system and workflow instructions.
- Require the model to perform only translation and structured term extraction during this step.
- Disable unrelated tools while translating untrusted document content, or enforce a strict tool allowlist.
- Validate generated glossary entries before writing them. Reject entries containing instruction-like phrases, markup intended to alter prompts, excessive length, or malformed term mappings.
- Do not submit the complete dynamic glossary when only matched entries are needed.
- Require user confirmation before persisting newly generated terms when processing documents from untrusted sources.
- Consider using a separate, tool-free model invocation for document translation so document text cannot influence a tool-enabled agent session.
