T09 · Insecure Skill Coding Practices
- Location
scripts/yt-transcribe.sh:571- Finding
Unscoped Recursive Deletion of Existing MP4 Files
- Content
View full analysis
Vulnerability Details
File Location:
scripts/yt-transcribe.sh:571
Vulnerability Type: Unintended recursive file deletion
Risk Level: MediumTechnical Analysis
After successfully creating a transcript, the script recursively deletes every MP4 file beneath the configured output directory:
bash rm -f "$TEMP_AUDIO" "$RAW_TEXT" "${TEMP_AUDIO%.*}.json" find "$OUTPUT_DIR" -type f -name "*.mp4" -deleteOUTPUT_DIRdefaults to~/Transcriptions, but the command-line parser allows the caller to replace it with an arbitrary output directory through--output-dir:bash --output-dir|-o) OUTPUT_DIR_ARG="$2" shift 2 ;;The cleanup operation is not restricted to the per-run temporary directory or to files created by the current execution. It recursively traverses the complete output tree and deletes pre-existing MP4 files, including files in nested directories. There is no confirmation, dry-run, ownership check, or manifest of files generated by the Skill.
This expands authorization to write a transcript into authorization to delete unrelated media beneath the selected directory.
Attack Path
- The Skill is invoked with a transcription URL and an output directory that already contains MP4 files, either directly or in nested directories.
- The video download and Whisper transcription complete successfully.
- The Skill writes the resulting transcript.
- Line 571 recursively searches the entire configured output directory.
- Every file whose name ends in
.mp4is deleted, regardless of whether the Skill created it.
For example, selecting a shared media directory as
--output-dircauses all MP4 files under that directory to be removed after a successful transcription.Impact Assessment
The issue can cause irreversible loss of unrelated user media within the configured output directory and all descendant directories. It does not grant additional operating-system privileges, but it exceeds the file-operatio ...[truncated 286 chars]
- Remediation
View remediation
Remediation Suggestions
Remove the recursive output-directory cleanup:
bash find "$OUTPUT_DIR" -type f -name "*.mp4" -deleteDelete only exact temporary files created during the current invocation. Prefer keeping all downloaded media inside the unique per-run temporary directory and removing that directory after processing:
bash rm -rf -- "$TEMP_DIR"For stronger hardening:
- Maintain an explicit list of files created by the current run and delete only those paths.
- Verify cleanup targets are descendants of the expected per-run temporary directory before deletion.
- Use
--before path arguments where supported to prevent option interpretation. - If broad media cleanup is intentionally required, expose it as a separate explicit flag, display the exact scope, and require confirmation before deletion.
- Add a regression test that places unrelated MP4 files in both the output root and a nested directory and verifies that transcription leaves them intact.
