T09 · Insecure Skill Coding Practices
- Location
SKILL.md:55- Finding
Predictable Shared Temporary Paths Expose Extracted Video Frames
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 55–58 and 172–174
Vulnerability Type: Predictable shared temporary files and directories
Risk Level: MediumVulnerable Code
bash mkdir -p /tmp/narration-frames for t in $(seq 0 3 <duration>); do ffmpeg -y -ss $t -i <video> -frames:v 1 -q:v 2 /tmp/narration-frames/frame_${t}s.jpg 2>/dev/null doneThe verification phase uses similarly predictable paths:
bash for t in <timestamps>; do ffmpeg -y -ss $t -i <output> -frames:v 1 -q:v 2 /tmp/verify_${t}s.jpg 2>/dev/null doneTechnical Analysis
The documented workflow stores frames extracted from potentially sensitive videos in fixed locations under the shared
/tmpdirectory. It neither creates a unique, owner-only temporary directory nor removes the generated images after use. Theffmpeg -yoption also permits unconditional overwriting of existing destinations.An attacker with local access can predict the directory and filenames. Depending on host permissions and temporary-directory protections, the attacker may inspect residual frames, interfere with concurrent narration jobs, pre-create malicious filesystem entries, or use symbolic links to redirect writes to another path writable by the victim process.
The first command uses a fixed directory shared by every run, while the verification command writes directly to predictable
/tmp/verify_*filenames. No ownership, file-type, or symbolic-link checks are performed before writing.Attack Path
- A local attacker predicts that the Skill will use
/tmp/narration-frames/frame_${t}s.jpgor/tmp/verify_${t}s.jpg. - The attacker monitors the shared directory for generated files, or pre-creates predictable entries or symbolic links before the workflow runs.
- The user invokes the narration workflow on a private video.
ffmpeg -ywrites extracted frames to the predictable locations.- The attacker reads retained frames, corrupts the workflow by creat ...[truncated 800 chars]
- A local attacker predicts that the Skill will use
- Remediation
View remediation
Remediation Suggestions
- Create a unique temporary directory for each run with
mktemp -d. - Restrict access with an owner-only umask and directory permissions.
- Register a cleanup trap so extracted frames are deleted on success, failure, or interruption.
- Keep verification images inside the same private directory instead of writing predictable files directly under
/tmp. - Refuse to use an existing temporary path and validate that output destinations are regular files beneath the newly created directory.
- Avoid following pre-existing symbolic links.
Example hardened pattern:
bash umask 077 frames_dir="$(mktemp -d "${TMPDIR:-/tmp}/narration-frames.XXXXXX")" || exit 1 trap 'rm -rf -- "$frames_dir"' EXIT HUP INT TERM for t in $(seq 0 3 <duration>); do ffmpeg -n -ss "$t" -i <video> -frames:v 1 -q:v 2 \ "$frames_dir/frame_${t}s.jpg" 2>/dev/null done for t in <timestamps>; do ffmpeg -n -ss "$t" -i <output> -frames:v 1 -q:v 2 \ "$frames_dir/verify_${t}s.jpg" 2>/dev/null doneWhere supported, use secure file-creation APIs that atomically create outputs with exclusive semantics and do not follow symbolic links.
- Create a unique temporary directory for each run with
