T09 · Insecure Skill Coding Practices
- Location
assets/templates/infographic_template.html:203- Finding
Unescaped PDF-Derived Content Can Cause HTML and JavaScript Injection
- Content
View full analysis
{{BOOK_TITLE}}
{{AUTHOR}} | {{PUBLICATION_YEAR}} | {{CORE_THEME}}
{{CONCEPT_TAGS}}{{CHAPTER_CARDS}}``` ```javascript xAxis: { type: 'category', data: {{CHAPTER_NAMES}}, axisLabel: { interval: 0, rotate: 30, fontSize: 11 } }, series: [{ name: '字数', type: 'bar', data: {{CHAPTER_WORDS}}, itemStyle: { color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ { offset: 0, color: '#2196F3' }, { offset: 1, color: '#64B5F6' } ]), borderRadius: [4, 4, 0, 0] }, barWidth: '50%' }] ``` ```javascript data: {{KNOWLEDGE_NODES}}, links: {{KNOWLEDGE_LINKS}}, ``` ```javascript data: {{CONTENT_TYPES}} ``` ### Technical Analysis The template places generated values directly into two security-sensitive contexts: 1. HTML document content, including `BOOK_TITLE`, `AUTHOR`, `CORE_THEME`, `CONCEPT_TAGS`, and `CHAPTER_CARDS`. 2. Executable JavaScript expressions, including chapter names, chart values, graph nodes, graph links, and content types. The documented workflow derives infographic content from user-supplied PDF documents. Neither the template nor the accompanying workflow defines contextual escaping, HTML sanitization, strict schema validation, or safe JSON serialization. Consequently, content originating in a crafted PDF can be carried into the generated infographic. For HTML placeholders, attacker-controlled markup could introduce elements, event-handler attributes, deceptive links, or other active content. For JavaScript placeholders, a value t ...[truncated 2072 chars]- Remediation
View remediation
` sequences, and JavaScript expression termination. ]]>
