T09 · Insecure Skill Coding Practices
- Location
assets/report-template.html:251- Finding
Unsanitized Placeholder Substitution in Generated HTML Reports
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:186-201; vulnerable output sinks inassets/report-template.html:6, 251-256, 302, 310, 318, 326, 333
Vulnerability Type: HTML injection with potential script execution
Risk Level: MediumVulnerable Code
SKILL.md:186-201instructs the agent to replace template placeholders with appraisal data but does not require contextual output encoding or sanitization:markdown ### 4.2 Report Generation Method Use `assets/report-template.html` as the template and replace its placeholders with actual appraisal data. Supported template placeholders: - `{item_name}` - Item name - `{item_type}` - Item type - `{era_judgment}` - Era assessment - `{condition_rating}` - Condition rating - `{price_low}` - Lower appraisal estimate `{price_high}` - Upper appraisal estimate - `{appraisal_details}` - Detailed appraisal text - `{market_analysis}` - Market analysis - `{expert_advice}` - Collecting advice - `{risk_notes}` - Risk notes - `{report_date}` - Report date - `{order_id}` - Order identifierThe corresponding raw insertion points include:
html <title>Collection Appraisal Report - {item_name}</title> <div class="info-item"><span class="label">Item Name</span><span class="value">{item_name}</span></div> <div class="info-item"><span class="label">Item Type</span><span class="value">{item_type}</span></div> <div class="info-item"><span class="label">Era Assessment</span><span class="value">{era_judgment}</span></div> <div class="info-item"><span class="label">Condition Rating</span><span class="value">{condition_rating}</span></div> <div class="info-item"><span class="label">Report Number</span><span class="value">{order_id}</span></div> <div class="info-item"><span class="label">Report Date</span><span class="value">{report_date}</span></div>html <div class="analysis-text" style="margin-top:16px;"> {market_analysis} </ ...[truncated 2800 chars]- Remediation
View remediation
Remediation Suggestions
- Treat every placeholder value as untrusted, including model-generated prose derived from user input.
- Apply context-sensitive HTML encoding to all plain-text fields. At minimum, encode
&,<,>,", and'before substitution. - Do not insert raw narrative strings as HTML. Prefer DOM text nodes or a template engine with automatic escaping enabled by default.
- If limited formatting is required, process rich-text fields through a maintained allowlist sanitizer. Permit only necessary elements and attributes; reject scripts, event attributes, embedded content, unsafe SVG, CSS injection, and dangerous URL schemes.
- Generate
{expert_advice}from a structured array and create each list element safely rather than accepting a complete raw HTML fragment. - Add strict validation for structured fields such as scores, prices, dates, and order identifiers.
- Add a restrictive Content Security Policy, for example one that denies scripts, plugins, frames, network connections, and form submissions unless explicitly required.
- Serve or preview generated reports from an isolated origin and use a sandboxed viewer without same-origin privileges.
- Add security tests using payloads in every placeholder and verify that they are displayed as inert text rather than parsed as executable markup.
