T09 · Insecure Skill Coding Practices
- Location
scripts/hipaa-check.py:315- Finding
Unescaped Cloud-Controlled Fields in Generated HTML Report
- Content
View full analysis
{current_cat}\n' icon = "✅" if r.get("passed") else "❌" cls = "pass" if r.get("passed") else "fail" rec = r.get("recommendation") or "Keep it up" rows += f"""{icon}{r.get('name')}{r.get('legal_ref') or ''}{cls.upper()}{rec}\n""" ``` ### Technical Analysis The HTML renderer directly interpolates `category_name`, `name`, `legal_ref`, and `recommendation` into HTML without escaping them. These values are taken from the cloud evaluation response and must therefore be treated as untrusted input. An attacker who can influence the cloud response could return fields containing HTML elements, event handlers, scripts, deceptive links, or other active content. Because no HTML escaping or Content Security Policy is applied, this content is persisted unchanged when the user generates an HTML report. For example, a malicious recommendation resembling the following would be inserted as active markup rather than displayed as text: ```html``` ### Attack Path 1. The user runs the Skill with HTML output, such as: ```bash python3 scripts/hipaa-check.py --format html -o hipaa-check-report.html ``` 2. The Skill submits the compliance answers to the remote evaluation service. 3. An attacker compromises or otherwise gains control over report fields returned by that service. 4. The remote response includes malicious markup in a field such as `recommendation`, `name`, or `category_name`. 5. `render_html()` inserts the value int ...[truncated 936 chars]
- Remediation
View remediation
``` 5. Add regression tests containing HTML metacharacters and event-handler payloads in every remotely supplied field. ]]>
