CVE-2026-30754 Overview
A memory corruption vulnerability affects FFmpeg versions before 8.1 in the Real-time Transport Protocol (RTP) encoding path. The flaw resides in the nal_send function within libavformat/rtpenc_h264_hevc.c. When FFmpeg transmits H.264 or HEVC streams over RTP using a crafted input file, a negative size parameter (size=-3) is passed to memcpy, triggering an out-of-bounds write [CWE-787]. Researchers identified the issue using AddressSanitizer. The vulnerability affects any workflow that streams attacker-controlled media through the FFmpeg RTP muxer, including transcoding pipelines and media servers.
Critical Impact
Attackers can trigger heap memory corruption in FFmpeg processes handling untrusted media, potentially leading to arbitrary code execution or process crashes.
Affected Products
- FFmpeg versions prior to 8.1
- Applications embedding FFmpeg's libavformat for RTP H.264/HEVC streaming
- Media servers and transcoders using FFmpeg RTP muxers
Discovery Timeline
- 2026-09-08 - CVE-2026-30754 published to the National Vulnerability Database
- 2026-09-09 - Last updated in NVD database
Technical Details for CVE-2026-30754
Vulnerability Analysis
The vulnerability is an out-of-bounds write in FFmpeg's RTP muxer for H.264 and HEVC Network Abstraction Layer (NAL) units. During RTP packetization, nal_send in libavformat/rtpenc_h264_hevc.c computes the size of the NAL fragment to transmit. Under specific conditions triggered by a crafted input file, this computation produces a negative value. That value is subsequently passed as the length argument to memcpy.
Because memcpy accepts a size_t (unsigned) length, the negative signed integer is reinterpreted as a very large unsigned value. This drives memcpy to read and write far beyond the intended buffer boundaries, corrupting adjacent heap memory. AddressSanitizer flagged the issue during fuzzing of the RTP encoding path.
Root Cause
The root cause is missing validation of the NAL unit size before it reaches the memcpy call. The code path does not enforce that the fragment length remains non-negative and within the source buffer bounds. Insufficient bounds checking on attacker-influenced size fields is a recurring pattern in media parsers, and here it produces classic signed-to-unsigned conversion abuse.
Attack Vector
Exploitation requires a victim to process a crafted media file with FFmpeg while streaming the output over RTP using an H.264 or HEVC codec. The trigger is network-adjacent in effect but originates from file input, requiring user interaction to open or transcode the malicious asset. Successful exploitation corrupts heap memory in the FFmpeg process, which can lead to denial of service or, depending on heap layout, code execution in the context of the FFmpeg process.
A proof-of-concept demonstrating the crash is publicly available. See the GitHub PoC for FFmpeg and GitHub Gist PoC Code for reproduction details.
Detection Methods for CVE-2026-30754
Indicators of Compromise
- Unexpected crashes or segmentation faults in ffmpeg processes performing RTP output with -f rtp and H.264/HEVC codecs
- AddressSanitizer reports referencing nal_send in libavformat/rtpenc_h264_hevc.c
- Media assets from untrusted sources being processed by RTP streaming pipelines
Detection Strategies
- Inventory hosts running FFmpeg and check binary versions against the fixed 8.1 release
- Enable core dump collection on transcoding servers to capture faults in the RTP encoding path
- Fuzz media ingestion workflows with AddressSanitizer-enabled FFmpeg builds to surface similar boundary defects
Monitoring Recommendations
- Alert on repeated crashes of ffmpeg or child processes launched by media services
- Monitor RTP-emitting workloads for anomalous child process termination and restarts
- Track file ingestion sources feeding transcoders and flag inputs from untrusted origins
How to Mitigate CVE-2026-30754
Immediate Actions Required
- Upgrade FFmpeg to version 8.1 or later on all systems that transcode or stream media
- Audit downstream applications that bundle FFmpeg libraries and rebuild against the patched release
- Restrict RTP transcoding workflows to trusted, validated media inputs until patching completes
Patch Information
The fix is tracked in FFmpeg Pull Request #20746 and shipped in FFmpeg 8.1. The patch adds bounds validation on the NAL fragment size before it is passed to memcpy in nal_send. Package maintainers for Linux distributions and container base images should pull updated FFmpeg builds and rebuild dependent images.
Workarounds
- Disable RTP output paths (-f rtp) for H.264 and HEVC in pipelines that cannot immediately patch
- Sandbox FFmpeg processes with seccomp, containers, or systemd restrictions to limit blast radius on crash
- Validate and constrain input media formats before handing files to FFmpeg for RTP streaming
# Verify installed FFmpeg version and upgrade if below 8.1
ffmpeg -version | head -n 1
# Example: run FFmpeg under a restrictive systemd unit
# /etc/systemd/system/ffmpeg-transcoder.service
# [Service]
# ExecStart=/usr/bin/ffmpeg -i /media/input.mp4 -f rtp rtp://...
# NoNewPrivileges=true
# PrivateTmp=true
# ProtectSystem=strict
# MemoryDenyWriteExecute=true
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

