T09 · Insecure Skill Coding Practices
- Location
SKILL.md:33- Finding
Predictable Shared Temporary File Path for Generated Voice Responses
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 33–37
Vulnerability Type: Unsafe temporary-file handling
Risk Level: MediumVulnerable Code
bash bin/sherpa-onnx-tts /tmp/reply.ogg "Tu mensaje aquí"The instructions subsequently require the agent to send
/tmp/reply.oggthrough the messaging tool:text Then send `/tmp/reply.ogg` via `message` tool with `filePath`.Technical Analysis
The documented workflow writes generated speech to a fixed, predictable filename in the globally shared
/tmpdirectory. In a multi-user or otherwise untrusted local environment, another process may create, replace, or manipulate/tmp/reply.oggbefore or between the generation and sending operations.If
sherpa-onnx-ttsfollows symbolic links when opening its output, an attacker may pre-create/tmp/reply.oggas a symbolic link to another file writable by the agent. A time-of-check/time-of-use race may also allow the generated file to be replaced after synthesis but before it is submitted to the messaging tool. The exact overwrite behavior depends on the implementation of the referenced TTS binary, which is not included in the supplied artifact.Attack Path
- A local attacker with access to the shared temporary directory predicts the documented
/tmp/reply.oggpath. - The attacker creates that path as a symbolic link to a file writable by the agent, or continuously replaces the path to win a race.
- The agent executes the documented TTS command.
- If the TTS utility follows the link, it writes to the linked destination instead of an isolated output file.
- Alternatively, the attacker replaces the completed audio file before the messaging operation.
- The agent may overwrite an unintended file or send attacker-controlled audio to the WhatsApp recipient.
Exploitation requires local access sufficient to manipulate entries in the relevant temporary directory and depends partl ...[truncated 613 chars]
- A local attacker with access to the shared temporary directory predicts the documented
- Remediation
View remediation
Remediation Suggestions
- Create a private temporary directory with permissions restricted to the agent process, such as mode
0700. - Generate a cryptographically unpredictable filename using a secure temporary-file facility such as
mktemp. - Open output files with exclusive-creation and no-symbolic-link protections where supported.
- Verify immediately before sending that the output is a regular file owned by the expected user and located inside the private directory.
- Pass an already-open file descriptor to downstream components where possible to eliminate path replacement races.
- Delete the generated audio and private temporary directory after the send operation, including on failures.
- Avoid reusing output paths across requests or concurrent conversations.
Example hardened shell workflow:
bash tmp_dir="$(mktemp -d)" chmod 700 "$tmp_dir" output="$tmp_dir/reply.ogg" trap 'rm -rf -- "$tmp_dir"' EXIT bin/sherpa-onnx-tts "$output" "Tu mensaje aquí" test -f "$output" && test ! -L "$output"The messaging tool should then receive the unique
$outputpath only after these checks succeed.- Create a private temporary directory with permissions restricted to the agent process, such as mode
