T09 · Insecure Skill Coding Practices
- Location
scripts/ppt_generator.js:213- Finding
Untrusted VLM Output Can Trigger Arbitrary Local Image File Inclusion
- Content
View full analysis
Vulnerability Details
File Location:
scripts/coordinate_mapper.js:128-194;scripts/ppt_generator.js:213-220
Vulnerability Type: Unrestricted local file path accepted from untrusted structured input
Risk Level: HighVulnerable Code
javascript const regions = Array.isArray(parsed) ? parsed : [parsed]; // Post-processing: field handling without schema enforcement return regions.map((r, idx) => { if (!r.bounds) { r.bounds = { x: r.x || 0, y: r.y || 0, width: r.width || r.w || 100, height: r.height || r.h || 30 }; } if (r.content) { r.content = normalizeSymbols(r.content, 'keep_cn'); } if (r.content && !r.bulletType) { const { bulletChar } = detectBullet(r.content); if (bulletChar) r.bulletType = bulletChar; } if (r.zIndex === undefined) r.zIndex = idx; return r; });javascript function renderImage(slide, region, pos) { if (region.imagePath || region.path || region.data) { slide.addImage({ ...pos, path: region.imagePath || region.path, data: region.data // base64 }); } }Technical Analysis
Region data originates from an external vision-language model and is therefore outside the application's trust boundary. The parser accepts arbitrary object properties and returns them without enforcing
references/region_schema.json, filtering sensitive fields, or validating image paths.When an accepted region has type
image,renderImagepassesregion.imagePathorregion.pathdirectly topptxgenjs. This permits an untrusted response to select a local file for inclusion in the generated presentation. There is no canonical path resolution, workspace containment check, extension allowlist, file-size restriction, or distinction between application-supplied paths and VLM-supplied paths.The declared schema does not mitigate the vulnerability ...[truncated 1673 chars]
- Remediation
View remediation
Remediation Suggestions
- Treat all VLM output as untrusted and validate it against a strict JSON Schema before rendering.
- Remove
path,imagePath, anddatafrom the set of fields accepted from the VLM. Resolve image references through trusted application-generated identifiers instead. - If local paths must be supported, canonicalize each path with
path.resolveand verify that it remains under a dedicated input directory. - Reject absolute paths, traversal components, symbolic links escaping the workspace, device paths, and network-share paths.
- Apply an allowlist of supported image extensions and verify file signatures rather than trusting extensions alone.
- Enforce limits on individual file size, decoded image dimensions, base64 payload size, and total embedded media.
- Configure JSON Schema with
additionalProperties: falseand explicit constraints for every numerical and string field. - Run conversion in a sandbox with access only to the uploaded source files and a dedicated output directory.
- Keep trusted source-image metadata separate from the model response so the model cannot overwrite filesystem references.
