T09 · Insecure Skill Coding Practices
- Location
scripts/render-ontology.js:40- Finding
Unescaped Ontology Names Allow Mermaid Diagram Injection
- Content
View full analysis
30 ? '...' : ''), type: type }); } ``` ```js // Add nodes for (const obj of objects) { const shape = obj.type === 'core-self' ? `((${obj.name}))` : `[${obj.name}]`; lines.push(` ${obj.id}${shape}`); } ``` ### Technical Analysis The renderer reads object names from ontology Markdown headings and directly interpolates those names into Mermaid source code. Although names are truncated to 30 characters, truncation does not escape Mermaid metacharacters such as `]`, `)`, `"`, `;`, or comment markers. An object name can therefore terminate its intended node label and append another Mermaid statement. For example, a crafted heading could contain a short payload resembling: ```markdown ## B1 — X];click B1 "https://x";%% ``` The generated Mermaid source would contain attacker-influenced graph syntax rather than treating the entire value as plain label text. The actual behavior of injected directives depends on the Mermaid implementation and its security configuration. Strict renderers may disable active links or scripts, but injected graph nodes, edges, styling, or links can still compromise the integrity of the visualization. A permissive downstream renderer may expose a greater risk. The affected data normally comes from local ontology files, and the documented bootstrap process requires user confirmation before committing extracted objects. This reduces exploitability but does not provide syntactic validation: imported content, manually edited ontology files, or inco ...[truncated 1564 chars]- Remediation
View remediation
