Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2025-25473

CVE-2025-25473: FFmpeg Memory Leak Vulnerability

CVE-2025-25473 is a memory leak flaw in FFmpeg's avformat_free_context function that can cause resource exhaustion. This article covers the technical details, affected versions, impact, and mitigation strategies.

Published:

CVE-2025-25473 Overview

CVE-2025-25473 is a memory leak vulnerability in FFmpeg, the widely used multimedia framework for handling audio, video, and other multimedia files. The flaw resides in the avformat_free_context function within libavutil/mem.c. FFmpeg git master builds prior to commit c08d300481b8ebb846cd43a473988fdbc6793d1b fail to release allocated memory correctly when freeing format context structures.

The issue was tracked in FFmpeg Ticket #11419 and resolved in the upstream repository. The vulnerability is classified under [CWE-476] and carries a network attack vector with low integrity impact.

Critical Impact

Repeated invocation of the vulnerable code path can exhaust process memory, degrading availability of applications and services that embed FFmpeg for media processing.

Affected Products

  • FFmpeg git master builds before commit c08d300481b8ebb846cd43a473988fdbc6793d1b
  • Applications statically or dynamically linking vulnerable libavformat builds
  • Media processing pipelines and transcoding services based on pre-patch FFmpeg

Discovery Timeline

  • 2025-02-18 - CVE-2025-25473 published to NVD
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2025-25473

Vulnerability Analysis

The vulnerability is a memory leak in FFmpeg's avformat_free_context function. This function is responsible for releasing resources associated with an AVFormatContext structure once a media file or stream has been processed. Under specific conditions, allocated memory tied to the context is not properly freed before the structure is discarded.

CWE-476 (NULL Pointer Dereference) is assigned to this record, and the fix ships in commit c08d300481b8ebb846cd43a473988fdbc6793d1b. The upstream code diff modifies the cleanup logic in libavformat/avformat.c to correctly release the affected allocations.

Root Cause

The root cause is incomplete cleanup logic inside avformat_free_context. When the context is torn down, one or more allocations owned by the format context remain referenced only by the freed structure. Because no av_free or equivalent release call runs against these pointers, the memory becomes unreachable and unrecoverable for the process lifetime.

Attack Vector

An attacker can supply crafted media inputs or repeatedly trigger format context allocation and release cycles in a networked service that uses vulnerable FFmpeg builds. Each cycle leaks a small amount of memory. Sustained requests against a long-running transcoder, streaming server, or thumbnailing service drive process memory upward until the host runs out of memory or the process is terminated.

The vulnerability does not enable code execution or data disclosure. Impact is limited to integrity of processed data structures and gradual resource exhaustion. See the FFmpeg commit overview for the exact patch scope.

Detection Methods for CVE-2025-25473

Indicators of Compromise

  • Steady, non-releasing growth of resident memory in ffmpeg, ffprobe, or embedding processes over time
  • Out-of-memory kills of media processing workers under normal input load
  • Elevated slab or heap allocations traced back to libavformat frames

Detection Strategies

  • Query installed FFmpeg build metadata and compare the source revision against commit c08d300481b8ebb846cd43a473988fdbc6793d1b
  • Run Valgrind or AddressSanitizer against FFmpeg-based services to surface leak stacks originating in avformat_free_context
  • Track per-process RSS growth across repeated media transcoding jobs using APM or infrastructure monitoring tooling

Monitoring Recommendations

  • Alert on media worker processes exceeding baseline memory thresholds during steady-state workloads
  • Log FFmpeg version strings emitted during startup and inventory them against known vulnerable revisions
  • Correlate OOM killer events with services that link libavformat to identify affected components

How to Mitigate CVE-2025-25473

Immediate Actions Required

  • Upgrade FFmpeg to a build that includes commit c08d300481b8ebb846cd43a473988fdbc6793d1b or later
  • Rebuild and redeploy internal applications that statically link vulnerable libavformat versions
  • Restart long-running media services after upgrade to release leaked memory

Patch Information

The fix is committed upstream in FFmpeg as commit c08d30. Distribution packages tracking FFmpeg master or point releases that include this commit resolve the leak. Package maintainers should verify their FFmpeg source revision includes the referenced commit before shipping updates.

Workarounds

  • Recycle FFmpeg worker processes on a fixed interval to release accumulated memory
  • Apply cgroup or systemd memory limits to isolate leak impact from co-located services
  • Restrict acceptance of untrusted media inputs to rate-limited or sandboxed workers until patched builds are deployed

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.