T09 · Insecure Skill Coding Practices
- Location
SKILL.md:85- Finding
Predictable Shared Temporary File Enables Symlink-Based File Overwrite
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 85-94
Vulnerability Type: Unsafe temporary-file handling
Risk Level: LowVulnerable Code
bash curl -s https://api.openai.com/v1/audio/speech \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "tts-1-hd", "input": "<news summary text>", "voice": "onyx", "speed": 0.95 }' \ --output /tmp/news.mp3Technical Analysis
The voice-summary workflow writes generated audio to the fixed, predictable path
/tmp/news.mp3. On systems where/tmpis shared among users or processes, an attacker may create this path in advance as a symbolic link to another file.When the documented
curlcommand subsequently opens the output path, it may follow the symbolic link and truncate or overwrite the linked destination using the privileges of the process running the skill. The fixed filename also creates race conditions between concurrent skill executions and may expose one user's generated audio to another local user, depending on filesystem permissions and system configuration.The external HTTPS requests themselves are consistent with the skill's declared functionality.
$OPENAI_API_KEYis sent only as an authorization credential to the declared OpenAI TTS endpoint; the reviewed content does not establish credential exfiltration.Attack Path
- A local attacker capable of writing to
/tmppredicts that the skill will use/tmp/news.mp3. - Before the voice-summary workflow runs, the attacker creates
/tmp/news.mp3as a symbolic link to a file writable by the skill's operating-system account. - A user invokes the optional voice-summary workflow.
curlfollows the attacker-controlled path while creating or truncating its output.- The OpenAI audio response overwrites the linked target with the privileges of the skill process.
Alternatively, two co ...[truncated 561 chars]
- A local attacker capable of writing to
- Remediation
View remediation
Remediation Suggestions
-
Create a private, unpredictable temporary directory and file rather than using a fixed shared path:
bash tmp_dir="$(mktemp -d)" || exit 1 chmod 700 "$tmp_dir" audio_file="$tmp_dir/news.mp3" cleanup() { rm -rf -- "$tmp_dir" } trap cleanup EXIT HUP INT TERM curl --fail --silent --show-error \ https://api.openai.com/v1/audio/speech \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "tts-1-hd", "input": "<news summary text>", "voice": "onyx", "speed": 0.95 }' \ --output "$audio_file" -
Apply restrictive permissions with
umask 077before creating temporary content. -
Remove temporary audio immediately after it has been delivered.
-
Do not reuse output paths across users, sessions, or concurrent executions.
-
If the execution environment supports it, use an application-owned private temporary directory and APIs that create files atomically without following symbolic links.
-
