T09 · Insecure Skill Coding Practices
- Location
scripts/render_brief.py:156- Finding
Unescaped User-Controlled Content Allows Markdown Injection
- Content
View full analysis
str: lines: list[str] = [] for item in items: label = f" · {item['category']}" if item.get("category") else "" lines.append( f"- **[{item['title']}]({item['url']})**{label} — {item['summary']} " f"({item['publisher']},{item['published_date']})" ) return "\n".join(lines) def render_markdown(payload: dict[str, Any]) -> str: profile = payload["profile"] weather = payload["weather"] reminder_block = "" if payload["reminders"]: reminder_block = "\n## 今日提醒\n\n" + "\n".join(f"- {item}" for item in payload["reminders"]) + "\n" return f"""# {profile['display_name']}的校园晨报 {payload['date']} · {profile['city']} ## 今日天气 **{weather_line(payload)}** - 穿衣:{weather['outfit']} - 校园提示:{weather['campus_tip']} ## 今日一句 > {payload['quote']['primary']}
> {payload['quote']['english']}
> — {payload['quote']['author']} ## 综合要闻 {news_markdown(payload['general_news'])} ## 兴趣拓展 {news_markdown(payload['interest_news'])} ## 学习方法 {payload['study_tip']} {reminder_block} ## 现在就做 **{payload['action_anchor']}** """ ``` ### Technical Analysis The validator only requires these fields to be non-empty strings. It does not escape or reject Markdown metacharacters, embedded HTML, line breaks, or control characters before the values are inserted into the generated Markdown document. Attacker-controlled titles can terminate the existing link syntax and introduce additional links or formatting. Summaries, profile fields, reminders, study tips, quotes, weather advice, and action prompts are inserted directly and can introduce arbitrary Markdown or raw HTML. The URL validator restricts schemes to HTTP or HTTPS but does not make the URL s ...[truncated 1461 chars]- Remediation
View remediation
# Forged Trusted Section [Urgent school notice](https://attacker.example) ``` 7. Verify generated documents in the actual Markdown viewers supported by the project, with raw HTML disabled where possible. ]]>
