Skip to content

security(transcriber): fix arbitrary file read vulnerability in RecordingCreate API #9214

Closed

Description

@mrveiss

Priority

CRITICAL - Path injection vulnerability allows arbitrary file system access

Context

Post-MVA-2186 security review flagged critical path injection in transcriber API.

Vulnerability

POST /api/transcriber/recordings accepts client-provided file_path parameter which is passed directly to FFmpeg and speech providers without validation:

class RecordingCreate(BaseModel):
    filename: str
    file_path: str  # ← client-controlled, no validation

# Passed directly to system commands:
await self.ffmpeg_service.extract_audio(
    input_path=recording.file_path,  # ← attacker-controlled
    output_path=tmp_wav_path
)

Attack vector: Client submits {"filename": "test.wav", "file_path": "/etc/passwd"} → backend reads arbitrary files.

Required Fixes

  1. Remove file_path from RecordingCreate - do NOT accept paths from clients
  2. Implement authenticated file upload endpoint with multipart/form-data
  3. Server-managed paths - generate UUID filenames in per-user upload directory
  4. Path validation before any subprocess:
    • Path(p).resolve() and assert within upload dir
    • Reject symlinks
    • Check os.path.isabs() and reject relative paths
  5. FFmpeg hardening:
    • Add -protocol_whitelist file to block HLS/HTTP demuxers
    • Add -allowed_extensions wav,mp3,mp4,m4a
    • Pin demuxer with -f flag
  6. Consider worker isolation - chroot or privilege dropping

Files

  • autobot-backend/api/transcriber.py
  • autobot-backend/transcriber/models.py
  • autobot-backend/transcriber/orchestrator.py
  • autobot-backend/media/audio/ffmpeg_service.py

Reference

  • CWE-22: Improper Limitation of a Pathname to a Restricted Directory
  • CWE-73: External Control of File Name or Path
  • MVA-2186 (original implementation)

Activity

  1. github-actions commented on Jun 3, 2026

    @github-actions
    Contributor

    PR #9306 (merged to Dev_new_gui) references this issue with a close keyword.

    security(transcriber): fix arbitrary file read vulnerability (#9214)

    If this issue is fully resolved, close it manually. If work remains, no action is needed.

  2. self-assigned this
    on Jun 4, 2026
  3. mrveiss commented on Jun 12, 2026

    @mrveiss
    OwnerAuthor

    Closed — fix merged to Dev_new_gui as 6d3b004d8 (PR #9306); verified still present at current HEAD (791ae16f7):

    • file_path removed from RecordingCreate — model now accepts only project_id (transcriber/models.py:32)
    • Authenticated multipart upload endpoint (UploadFile in transcriber/routes/recordings.py:48) with extension whitelist
    • Server-managed paths: transcriber/upload_security.py — per-user upload dirs, UUID secure filenames, Path.resolve() canonicalization, traversal guard, symlink rejection (lines 30–154)
    • FFmpeg hardening: -protocol_whitelist + -allowed_extensions (media/audio/ffmpeg_service.py:105-108)

    (Issue stayed open only because close-keywords don't auto-fire on Dev_new_gui merges.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions