T09 · Insecure Skill Coding Practices
- Location
assets/scripts/html-to-pptx.js:113- Finding
Unrestricted Local Image Paths Can Disclose Local Files
- Content
View full analysis
]*src="([^"]+)"[^>]*>/g; let match; while ((match = regex.exec(slideHtml)) !== null) { if (!match[1].includes('cover_bg') && !match[1].includes('end_bg')) { images.push(match[1]); } } return images; } ``` ```javascript function addImages(slide, images, imgBasePath) { const imgX = 5.0, imgY = 1.1, imgW = 4.7, imgH = 4.0; const validImages = images.filter(p => fs.existsSync(p)); if (validImages.length > 0) { if (validImages.length === 1) { slide.addImage({ path: validImages[0], x: imgX, y: imgY, w: imgW, h: imgH, sizing: { type: 'contain', w: imgW, h: imgH } }); ``` ### Technical Analysis The converter extracts image paths directly from input HTML and treats each extracted value as a local filesystem path. The only validation is `fs.existsSync()`, which confirms that the process can access the path but does not establish that access is authorized. The supplied `imgBasePath` is not used to constrain these image paths. Absolute paths, traversal paths, and paths resolving through symbolic links can therefore refer to files outside the intended working directory. If such a file is a supported image, `pptxgenjs` embeds it in the generated presentation. This violates the documented least-privilege expectation that only user-specified files and Skill resources are read. ### Attack Path 1. An attacker supplies or influences the HTML processed by `html-to-pptx.js`. 2. The HTML contains an image reference to a readable local file, for example: ```html
```
3. `extractImages()` copies the path without canonicalizat
...[truncated 851 chars]- Remediation
View remediation
