T09 · Insecure Skill Coding Practices
- Location
scripts/comfyUIClient.js:970- Finding
Path Traversal Through Untrusted ComfyUI Output Filenames
- Content
View full analysis
{ const urlObj = new URL(url); const isHttps = urlObj.protocol === 'https:'; const httpModule = isHttps ? https : http; const file = fs.createWriteStream(outputPath); ``` ### Technical Analysis The `filename` value originates from the ComfyUI server's history response and is therefore controlled by the configured server. It is incorporated into a local output path without sanitization: ```javascript const outputPath = path.join(this.sessionDir, `${nodeId}_${filename}`); ``` `path.join()` normalizes traversal components but does not enforce that the resulting path remains inside `this.sessionDir`. A filename containing enough `../` components can escape the session directory. The `${nodeId}_` prefix does not neutralize traversal because traversal components appearing later in the string are still normalized. For example, an attacker-controlled response could use a filename conceptually similar to: `` ...[truncated 2581 chars]- Remediation
View remediation
