Skip to content

FFmpeg WASM loaded from cdn.jsdelivr.net without Subresource Integrity hash - CDN compromise executes arbitrary code client-side #1703

Description

@anshul23102

Problem

src/lib/ffmpeg.ts loads the FFmpeg WebAssembly core from a hardcoded
jsDelivr CDN URL with no Subresource Integrity (SRI) check:

const CORE_BASE_URL =
  "https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.12.10/dist/umd";

coreURL: await toBlobURL(`${CORE_BASE_URL}/${coreName}.js`, "text/javascript"),
wasmURL: await toBlobURL(`${CORE_BASE_URL}/${coreName}.wasm`, "application/wasm"),

toBlobURL fetches the file and re-wraps it as a Blob URL, but does not
verify any cryptographic hash of the fetched content. If jsDelivr is
compromised, or if a man-in-the-middle attack intercepts the fetch (possible
on networks without HSTS), a malicious .js or .wasm file is silently
executed in the user's browser with full access to their files.

Reframe's core value proposition is that files never leave the device. A
compromised WASM payload would silently violate this guarantee.

Impact

  • Arbitrary code execution in the user's browser.
  • Silent exfiltration of video files the user believed were processed locally.
  • Complete violation of the "No uploads. 100% private." privacy guarantee.

Suggested Fix

  1. Compute SHA-384 hashes of the WASM and JS files for each pinned version:
    openssl dgst -sha384 -binary ffmpeg-core.js | openssl base64 -A
    
  2. Verify the hash in toBlobURL or add a manual fetch-and-verify step
    before creating the Blob URL.
  3. Pin the dependency to an exact version (already done: @0.12.10) and
    update the hash whenever the version is bumped.
  4. Consider bundling the WASM files directly in the project's public/
    directory to eliminate the CDN dependency entirely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions