T08 · Insecure Dependencies
- Location
scripts/setup_transcribe.py:32- Finding
Unverified FFmpeg Binary Automatically Downloaded Through a Third-Party Proxy and Executed
- Content
View full analysis
Vulnerability Details
File Location:
scripts/setup_transcribe.py:32-33, 92-112, 144; reachable automatically throughscripts/transcribe.py:57-68
Vulnerability Type: Unsafe dependency retrieval and native binary execution
Risk Level: HighComplete Code Snippet
python # scripts/setup_transcribe.py:32-33 GH_PROXY = "https://gh-proxy.com/https://github.com" OFFICIAL = "https://github.com"python # scripts/setup_transcribe.py:92-112 fname, kind = ASSETS[sys.platform] archive = os.path.join(FF_DIR, fname) ok = False for base in (GH_PROXY, OFFICIAL): url = f"{base}/BtbN/FFmpeg-Builds/releases/download/latest/{fname}" try: download(url, archive) ok = True break except Exception as e: log(f"Mirror source failed, trying the next one: {e}") if not ok: die("ffmpeg download failed") extract(archive, kind, FF_DIR) os.remove(archive) exe = find_ffmpeg_exe(FF_DIR) if not exe: die(f"ffmpeg executable not found after extraction: {FF_DIR}") with open(MARKER, "w", encoding="utf-8") as f: f.write(exe)python # scripts/setup_transcribe.py:144 rc = subprocess.run([ff_exe, "-version"], capture_output=True, text=True)python # scripts/transcribe.py:57-68 def ensure_ready(): if deps_ready(): return load_ffmpeg() print("[transcribe] dependencies unavailable; automatically running installer") setup = os.path.join( os.path.dirname(os.path.abspath(__file__)), "setup_transcribe.py" ) rc = subprocess.run([sys.executable, setup]) if rc.returncode != 0: sys.exit("automatic installation failed") if not deps_ready(): sys.exit("dependencies remain unavailable after installation") return load_ffmpeg()Technical Analysis
When transcription dependencies are missing,
transcribe.pyautomatically invokessetup_transcribe.py. The installer preferentially downloads a mutablelatestFFmpeg archive through `gh-pro ...[truncated 2179 chars]- Remediation
View remediation
Remediation Suggestions
- Download release artifacts directly from the upstream publisher by default.
- Pin FFmpeg to an immutable version instead of the mutable
latestpath. - Maintain a trusted SHA-256 digest for each supported operating-system artifact and verify it before extraction.
- Prefer verification of a trusted publisher signature where upstream signatures are available.
- Delete the archive and abort installation on any checksum, signature, filename, or platform mismatch.
- Do not execute the downloaded binary as a verification mechanism until its authenticity has been established.
- Remove the third-party proxy or require the user to explicitly opt into it after disclosing that it becomes part of the executable-code trust chain.
- If a proxy must remain supported, verify the downloaded bytes against a digest obtained through an independent trusted channel.
- Consider requiring explicit confirmation before automatic dependency installation so users can review the source, version, and expected digest.
