T09 · Insecure Skill Coding Practices
- Location
SKILL.md:400- Finding
Unsafe HTML Injection in Generated Quiz Feedback
- Content
View full analysis
✓ 正确'; correct++; } else { feedback.innerHTML = '✗ 错误 正确答案:' + answer + '' + explanations[qName] + ''; } ``` ### Technical Analysis The quiz-generation template assigns dynamically generated values to the `innerHTML` property. In particular, `explanations[qName]` may be derived from user-provided or externally searched educational material. The skill does not require this content to be escaped or sanitized before interpolation into the HTML string. Because `innerHTML` parses its assigned value as markup, an attacker-controlled explanation containing HTML elements or executable event handlers could be interpreted by the browser rather than displayed as plain text. The generated explanation data may also create an injection issue earlier if it is embedded in a JavaScript object without safe serialization. The hard-coded markup itself is not dangerous. The vulnerability arises from concatenating potentially untrusted generated content into that markup without defining a trust boundary or sanitization requirement. ### Attack Path 1. An attacker supplies a textbook, document, or other learning material containing a crafted payload. 2. The skill extracts or transforms the malicious content into a quiz explanation. 3. The payload is placed in `explanations[qName]` in the generated quiz HTML. 4. A user opens the generated quiz in a web browser. 5. The user submits an incorrect answer, causing the vulnerable branch to execute. 6. The browser assigns the explanation to `feedback.innerHTML` and parses the ...[truncated 921 chars]- Remediation
View remediation
