T01 · Skill Instruction Hijacking
- Location
scripts/build_skill.py:259- Finding
Untrusted Document Content Can Influence Agent Instructions
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill appears to perform the advertised document-to-skill conversion, but it needs review because untrusted document text can influence generated skills and the build step can package unintended asset files.
Install only in a trusted workspace and use fresh task directories. Treat input documents as untrusted: review generated skills before sharing or installing them, and do not allow attacker-controlled files or symlinks in the assets directory. Ensure PDFTOPPM_BIN is unset or points to a trusted pdftoppm binary.
scripts/build_skill.py:259Untrusted Document Content Can Influence Agent Instructions
scripts/build_skill.py:382Generated Archive Includes Unreferenced Assets and May Follow Symbolic Links
The declared description presents an end-to-end document-to-skill conversion utility. The supplied code chunk is only a batching/orchestration component within an indexing pipeline: it reads an existing manifest, groups chunks into batches, emits payloads for batch-part creation, validates resulting batch parts, handles retries, and produces a compact outline. While this may support creation of a grounded knowledge index, it does not itself convert source documents, extract images, normalize Markdown, or build a skill zip. The primary purpose of this code is materially narrower and different from the declared description, so this is a mismatch.
The code clearly implements document conversion to Markdown plus asset extraction, which partially matches the declared description. It supports TXT/Markdown/DOCX/PDF, extracts images from DOCX/PDF, renders scanned PDF pages, and writes a JSONL manifest of converted documents. However, key declared outputs and workflow claims are absent: there is no packaging into a skill zip, no substantive grounded knowledge index construction (only a simple documents.jsonl manifest with metadata like paths/counts), and no logic related to invoking the skill before inspecting task files or avoiding directory listings. Thus the declared description overstates the implemented capability in materially important ways.
The code is related to document-to-skill preparation, so the overall domain matches the description. However, this specific chunk is only an orchestration/preparation wrapper. It invokes other scripts to convert documents, split markdown, and plan batches, then emits compact workflow state. There is no logic here for packaging a reusable skill zip, and no direct creation of a final knowledge index artifact as described. It also includes resumable workflow behavior and a policy message about not reading chunk/state files directly, which are not part of the declared purpose. Because the declared description presents a fuller end-to-end conversion capability than this code chunk actually implements, this is a material mismatch.
The declared purpose is focused on document-to-skill conversion: ingesting source files, normalizing them to Markdown, extracting images, and building a reusable skill package and JSONL index. This code does none of that generation work. Instead, it assumes an index already exists, reads the JSONL file, tokenizes and scores query terms, and returns ranked search results. That is a materially different primary purpose—index search/retrieval rather than document conversion/building—so this is a clear description-behavior mismatch.
Referenced artifact was not completely inspected
guarantees the zip contains `SKILL.md`, `agents/openai.yaml`, the index, source Markdown, retrieval script, and every
Without declared permissions the skill's intent is opaque and cannot be validated.
The skill is described as converting documents into normalized Markdown, extracted images, and an index, but this implementation invokes the external pdftoppm executable via subprocess.run to render PDF pages. Spawning subprocesses is a broader capability than a typical in-process document parser and is not justified explicitly by the manifest's stated scope.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
str(path),
str(prefix),
]
result = subprocess.run(command, capture_output=True, text=True, timeout=120, check=False)
if result.returncode != 0 or not rendered.is_file():
rendered.unlink(missing_ok=True)
detail = (result.stderr or result.stdout or "unknown pdftoppm error").strip()
The executable path comes from the PDFTOPPM_BIN environment variable and is then executed without validation. In environments where untrusted users or upstream workflows can influence environment variables, this enables arbitrary program execution under the agent's privileges when PDF conversion is triggered.
str(path),
str(prefix),
]
result = subprocess.run(command, capture_output=True, text=True, timeout=120, check=False)
if result.returncode != 0 or not rendered.is_file():
rendered.unlink(missing_ok=True)
detail = (result.stderr or result.stdout or "unknown pdftoppm error").strip()
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
def run_stage(script: str, arguments: list[str]) -> None:
command = [sys.executable, str(SCRIPT_DIR / script), *arguments]
completed = subprocess.run(
command,
check=False,
capture_output=True,
No suspicious patterns detected.