T09 · Insecure Skill Coding Practices
- Location
scripts/gdpr-check.py:323- Finding
Unescaped Cloud-Controlled Data 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 report renderer directly interpolates `category_name`, `name`, `legal_ref`, and `recommendation` into HTML markup without applying HTML escaping or sanitization. These values originate from data returned by the remote cloud evaluation service. Consequently, they cross an external trust boundary and cannot safely be treated as HTML. A malicious or compromised service could return values containing elements or event handlers such as: ```html``` The value would be written verbatim into the generated report. When a user opens that report in a browser, the injected markup can be interpreted and executed. The fixed HTTPS endpoint and certificate validation reduce exposure to network interception, but they do not protect against a compromised endpoint, malicious backend response, or server-side data poisoning. ### Attack Path 1. A user explicitly runs the GDPR check and requests HTML output, such as: `python3 scripts/gdpr-check.py --format html -o gdpr-check-report.html`. 2. The Skill submits the assessment answers to the fixed cloud evaluation endpoint. 3. A compromised or malicious cloud response places attacker-controlled HTML or JavaScript in a report field such as `recom ...[truncated 1071 chars]
- Remediation
View remediation
``` 5. Add regression tests using payloads such as: ```html"> ``` Verify that generated reports contain escaped text such as `<script>` rather than executable markup. 6. Treat all cloud response fields as untrusted, even though the endpoint is pinned and accessed over TLS. Validate expected data types, impose reasonable length limits, and reject malformed response structures. ]]>
