T09 · Insecure Skill Coding Practices
- Location
fetch_ai_news_improved.py:153- Finding
Untrusted RSS Content Is Rendered as Agent-Facing Markdown Without Neutralization
- Content
View full analysis
Vulnerability Details
File Location:
fetch_ai_news_improved.py, lines 153-155 and 217-221
Vulnerability Type: Indirect prompt injection and unsafe Markdown generation
Risk Level: MediumVulnerable Code
python title = entry.get("title", "无标题") link = entry.get("link", "") summary = entry.get("summary", entry.get("description", ""))python lines.append(f"**{trans['title']}**") if trans["summary"]: lines.append(f"> {trans['summary'][:200]}") if orig["link"]: lines.append(f"🔗 [原文链接]({orig['link']})")Technical Analysis
Article titles, summaries, and links originate from external RSS feeds. These values are incorporated into the generated Markdown without escaping Markdown control characters or validating URL schemes.
Although HTML tags are removed from summaries elsewhere in the script, HTML removal does not neutralize Markdown syntax, instruction-like text, embedded links, or malformed link destinations. Titles and summaries are also sent through translation, but translation is not a security boundary and may preserve attacker-controlled instructions and formatting.
The generated digest is written to
latest_digest.mdand printed to standard output for OpenClaw consumption. Consequently, external feed content can cross from an untrusted network source into an agent-facing context. A downstream AI agent could interpret malicious article content as instructions instead of treating it exclusively as quoted data.Attack Path
- An attacker gains control of, compromises, or successfully submits content to one of the configured RSS sources.
- The attacker publishes an article with a crafted title, summary, or link containing Markdown manipulation, instruction-like content, or a deceptive URL.
fetch_feeds()retrieves the crafted RSS entry and stores its fields without Markdown escaping or URL-scheme validation.- The title and summary pass through the translation service, which may preserve the malicious ...[truncated 1054 chars]
- Remediation
View remediation
Remediation Suggestions
- Treat every RSS field as untrusted data and explicitly separate it from agent instructions.
- Escape Markdown metacharacters in titles and summaries before rendering them.
- Validate article URLs with a strict parser and allow only expected schemes such as
httpsand, if required,http. - Reject control characters, malformed URLs, and dangerous or unexpected schemes such as
javascript,data, andfile. - Place external article content inside clearly delimited data sections with an explicit statement that downstream agents must not follow instructions contained in those sections.
- Consider producing structured JSON for agent consumption instead of free-form Markdown, with fields marked as untrusted external content.
- Apply length limits before sending content to translation and again after translation.
- Configure downstream agents not to execute commands, invoke tools, disclose data, or alter objectives based solely on instructions found in fetched articles.
