T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/render_quotation.py:10- Finding
Arbitrary Local File Disclosure Through Unrestricted Logo Path
- Content
View full analysis
- Remediation
View remediation
Path: candidate = (ASSET_ROOT / path).resolve() if candidate != ASSET_ROOT and ASSET_ROOT not in candidate.parents: raise ValueError("Logo path is outside the approved asset directory") if candidate.suffix.lower() not in {".png", ".jpg", ".jpeg"}: raise ValueError("Unsupported logo format") if not candidate.is_file(): raise ValueError("Logo does not exist") return candidate ``` 4. Validate image contents using a maintained image-decoding library rather than trusting the extension. 5. Reject SVG unless it is securely sanitized, because SVG can contain active content and external references. 6. Enforce a conservative file-size limit before reading the file. 7. Prefer a fixed logo identifier mapped by server-side code to a trusted file rather than accepting arbitrary paths. 8. Run the renderer in a sandbox with access only to required input, output, template, and asset directories. ]]>
