T09 · Insecure Skill Coding Practices
Warning
- Location
index.js:13- Finding
Untrusted Log Content Embedded Verbatim in Generated Markdown
- Content
View full analysis
s.replace(/\d+/g,'').replace(/[a-f0-9]{8,}/gi,'').replace(/\s+/g,' ').trim(); const groups=new Map(); for(const m of matches){const key=`${m.severity}|${normalize(m.line)}`; if(!groups.has(key)) groups.set(key,{severity:m.severity,count:0,sample:m.line}); groups.get(key).count++;} const ordered=[...groups.values()].sort((a,b)=>b.count-a.count); const counts=matches.reduce((m,x)=>(m[x.severity]=(m[x.severity]||0)+1,m),{}); const report=[]; report.push('# Log Analysis Report','',`- Total scanned lines: ${lines.length}`,`- WARN: ${counts.WARN||0}`,`- ERROR: ${counts.ERROR||0}`,`- CRITICAL: ${counts.CRITICAL||0}`,'','## Grouped findings'); if(!ordered.length) report.push('- No WARN/ERROR/CRITICAL lines found.'); else ordered.slice(0,50).forEach((g,i)=>report.push(`- ${i+1}. [${g.severity}] x${g.count} — ${g.sample}`)); ``` ### Technical Analysis The `sample` property is populated directly from `m.line`, which originates from the user-selected log file. Although a normalized version of the line is used as the grouping key, the original untrusted line is retained as the sample and inserted into the Markdown report without Markdown or HTML escaping. An attacker who can influence the analyzed log can include Markdown links, remote images, raw HTML, deceptive headings, or instruction-like text in any line containing `WARN`, `ERROR`, or `CRITICAL`. The generated report preserves that content verbatim. When the report is opened in a permissive Markdown renderer, injected markup may alter its presentation or request remote resources. If an AI agent reviews the report, instruction-like log content may also become an indirect prompt-injection surface unless the report is explicitly handled as untrusted data. ### Attack Path ...[truncated 1643 chars]- Remediation
View remediation
