T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/upload_card.py:18- Finding
Arbitrary Local File Upload Through Unrestricted Path Arguments
- Content
View full analysis
- Remediation
View remediation
/cards`. - Resolve both the permitted root and input path with `os.path.realpath`, then enforce containment using `os.path.commonpath`. - Reject symbolic links and non-regular files. - Validate the PNG magic bytes and decode the image before upload instead of trusting the extension or MIME label. - Enforce strict file-size limits. - Remove or tightly constrain the arbitrary `--secrets` path. - Require explicit user confirmation before external publication. - Apply the same workspace-containment controls to `generate_card.py --image-path`. - Run the Skill under a dedicated operating-system account with access only to its workspace and required secrets. ]]>
