T09 · Insecure Skill Coding Practices
- Location
SKILL.md:70- Finding
Predictable Temporary Log Path Enables Symlink-Based File Truncation
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, line 70
Vulnerability Type: Unsafe predictable temporary file path
Risk Level: MediumVulnerable Code:
bash nohup {baseDir}/scripts/compress-and-send.sh "/path/to/video.mp4" "CHAT_ID" > /tmp/compress.log 2>&1 &Technical Analysis
The documented command redirects standard output and standard error to the fixed, predictable path
/tmp/compress.log. Shared temporary directories are generally writable by other local users. Before executingcompress-and-send.sh, the invoking shell opens this path with truncation enabled.An attacker with local access can pre-create
/tmp/compress.logas a symbolic link to another file. If the user running the command has permission to write to the symlink target, shell redirection follows the link and truncates that target. The script itself does not need elevated privileges; the operation occurs with the invoking user's permissions.Attack Path
- A local attacker predicts that the documented compression workflow will be used.
- The attacker creates
/tmp/compress.logas a symbolic link to a file writable by the intended victim. - The victim or AI agent invokes the exact background command documented in
SKILL.md. - The shell resolves the symbolic link while opening the redirection target.
- The linked file is truncated and subsequently receives the script's log output.
Exploitation requires local filesystem access, the ability to create the predictable path before invocation, and a target file writable by the victim account.
Impact Assessment
Successful exploitation can overwrite or destroy the contents of files writable by the invoking account. The scope is limited to that account's existing filesystem privileges; this issue does not independently provide privilege escalation or access to otherwise protected files. Depending on the chosen target, impact may include loss of user data, corru ...[truncated 65 chars]
- Remediation
View remediation
Remediation Suggestions
Replace the fixed shared path with a securely generated private log file or directory:
bash LOG_DIR="$(mktemp -d "${TMPDIR:-/tmp}/video-dl.XXXXXX")" || exit 1 chmod 700 "$LOG_DIR" LOG_FILE="$LOG_DIR/compress.log" nohup {baseDir}/scripts/compress-and-send.sh \ "/path/to/video.mp4" "CHAT_ID" >"$LOG_FILE" 2>&1 &Additionally:
- Set a restrictive
umask, such asumask 077, before creating logs. - Verify that the generated log location is owned by the invoking user and is not a symbolic link.
- Prefer a user-private runtime or state directory when available.
- Remove temporary logs and directories when they are no longer needed.
- Do not restore a fixed filename by combining
mktempwith a later predictable rename.
- Set a restrictive
