T01 · Skill Instruction Hijacking
- Location
scripts/epub_chapter_reader.py:30- Finding
Untrusted EPUB Content Is Passed to the Agent Without Prompt-Injection Isolation
- Content
View full analysis
Vulnerability Details
File Location:
scripts/epub_chapter_reader.py:30-32, 65;SKILL.md:146-157
Vulnerability Type: Indirect prompt injection through attacker-controlled document content
Risk Level: MediumVulnerable Code
python html = item.get_content() soup = BeautifulSoup(html, 'html.parser') text = soup.get_text('\n', strip=True)python return f"# {ch['title']}\n\n{text}"The skill then directs the agent to consume the extracted content:
markdown When an EPUB exists, always read from it directly — never from search or memory.markdown Read the full text before writing. For short chapters, use what's there. For long chapters, 14000 chars is enough to work with.Technical Analysis
An EPUB is a container of attacker-controlled HTML documents. The reader converts each document into plain text and emits it directly for use by the AI agent. It does not remove hidden HTML elements such as
script,style, or elements concealed with CSS before callingget_text(). It also does not mark the extracted text as an untrusted data boundary.The skill instructions require the agent to read this output but do not instruct it to disregard operational commands found inside the book. Consequently, text embedded in an EPUB may be interpreted as agent instructions rather than quoted source material.
This is an indirect prompt-injection weakness. Exploitation depends on the agent following the malicious document text and on the tools or context available during that session.
Attack Path
- An attacker prepares an EPUB containing instruction-like text in a chapter document, potentially inside visually hidden HTML.
- The victim provides that EPUB to DeepTutor.
item.get_content()reads the attacker-controlled HTML.BeautifulSoup.get_text()includes the instruction-like content in the extracted chapter text.get_chapter()emits that content without an explicit trust-boundary marker.- The agen ...[truncated 835 chars]
- Remediation
View remediation
Remediation Suggestions
- Treat all EPUB content as untrusted data and state this explicitly in
SKILL.md. - Instruct the agent never to follow commands, policies, tool requests, destination changes, or requests for secrets contained in extracted book text.
- Place extracted text inside clear begin/end delimiters and label it as quoted source material.
- Remove non-content and hidden elements before extracting text, including
script,style,noscript, and elements hidden through common attributes or CSS. - Avoid presenting EPUB-derived headings or text in a form that resembles privileged system or skill instructions.
- Require explicit user confirmation before any tool operation requested or suggested by document content.
- Apply host-level tool allowlists and least-privilege controls so document text cannot independently authorize file, network, or command operations.
- Treat all EPUB content as untrusted data and state this explicitly in
