Back to skill

Security audit

Subtitle Srt Export

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent local subtitle-export skill, with a limited temp-file hardening issue to consider in shared or untrusted job folders.

Install only if you are comfortable running a local shell script that reads input.json and overwrites subtitles.srt in a job folder you choose. Use job folders you control, avoid running it as root or on directories writable by other users, and consider replacing the fixed .cues.tmp file with mktemp for better hardening.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/export_srt.sh:43
Finding

Predictable Temporary File Permits Symlink-Based File Overwrite

Content
View full analysis
"$JOB/.cues.tmp" # Step 2: convert cues to SRT (awk handles HH:MM:SS,mmm formatting + numbering) awk -F'|' ' function ts(t, h,m,s,ms) { h=int(t/3600); t-=h*3600; m=int(t/60); t-=m*60; s=int(t); ms=int((t-s)*1000 + 0.5) if (ms==1000){s++; ms=0} return sprintf("%02d:%02d:%02d,%03d", h, m, s, ms) } { printf "%d\n%s --> %s\n%s\n\n", NR, ts($1), ts($2), $3 } ' "$JOB/.cues.tmp" > "$SRT" rm -f "$JOB/.cues.tmp" ``` ### Technical Analysis The script stores intermediate data at the fixed, predictable path `$JOB/.cues.tmp`. Shell output redirection opens this path with truncation and follows symbolic links. The script neither creates the file atomically nor verifies that the path is a regular file owned by the current process. If an attacker can write to the supplied job directory before the script runs, the attacker can create `.cues.tmp` as a symbolic link to another file writable by the victim. The redirection on line 43 then follows that link, truncates the target, and writes attacker-influenced subtitle cue data into it. The later `rm -f` does not prevent exploitation because the target has already been overwritten. It ordinarily removes only the symbolic link, potentially concealing the temporary artifact after the overwrite. ### Attack Path 1. An attacker obtains write access to a job directory that a more privileged victim will process. 2. The attacker creates a symbolic link at the predictable temporary path: ```bash ln -s /path/to/victim-writable-file /shared/job/.cues.tmp ``` 3. The victim invokes: ```bash bash scripts/export_srt.sh /shared/job ``` 4. The shell evaluates the redirection to `$JOB/.cues.tmp`, follows the symbolic link, and truncates the linked target. 5. `jq` output is w ...[truncated 808 chars]
Remediation
View remediation
"$TMP_CUES" awk -F'|' '...' "$TMP_CUES" > "$SRT" ``` Additional hardening measures: - Verify that `JOB` exists and is a directory before creating output files. - Reject job directories writable by untrusted users when the script runs with elevated or shared-account privileges. - Use `--` before path arguments where supported to prevent option interpretation. - Avoid running this script as `root` or another privileged account. - If hostile concurrent modification is within the threat model, open files through a trusted file descriptor or use a small helper that applies `O_CREAT | O_EXCL | O_NOFOLLOW` rather than relying solely on path-based shell redirection. - Apply equivalent symlink-safety controls to all output paths when job directories may be attacker-controlled. ]]>
Vulnerability Patterns
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (1)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
95% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · scripts/export_srt.sh (reported line 57)May include surrounding context.

sh
{ printf "%d\n%s --> %s\n%s\n\n", NR, ts($1), ts($2), $3 }
' "$JOB/.cues.tmp" > "$SRT"

rm -f "$JOB/.cues.tmp"

# Step 3: verify
CUES=$(grep -c ' --> ' "$SRT")