# GHSA-5JGV-C722-R5CG: Zero-length H264 SPS/PPS in an RTMP AVC configuration causes an unrecovered panic that terminates MediaMTX

- Database: GitHub
- Severity: CVSS 8.7 (High)
- Published: 2026-10-08
- Modified: 2026-10-08

## Affected versions

- github.com/bluenviron/mediamtx (Go): from 1.16.0, fixed in 1.21.0

## Description

MediaMTX's RTMP server uses `gortmplib` to detect a publisher's tracks during an initial analysis window of about two seconds. The first H264 `AVCDecoderConfigurationRecord` creates the track, while any later configuration message is buffered and replayed after the window through the `OnDataH264` callback as an access unit made of the first SPS and the first PPS (`SequenceParameterSets[0]` and `PictureParameterSets[0]`). The parsing code only verified that the SPS and PPS counts were non-zero, not that the NAL units themselves contained any data. The H265 path was affected in a similar way, since parameter sets were indexed without checking their length.

An unauthenticated RTMP publisher could therefore publish a valid H264 track and then send a second configuration declaring one SPS and one PPS, both with length zero. The empty slices were forwarded unchanged by `internal/protocols/rtmp/to_stream.go` to `SubStream.WriteUnit`, which called `formatUpdaterH264` in `internal/stream/format_updater.go`. That function reads the NAL unit type with `nalu[0] & 0x1F` without checking the length, causing an `index out of range [0] with length 0` panic. The panic is not recovered and terminates the whole process, interrupting every stream and every protocol served by the instance. The attack requires a tiny RTMP message and no credentials on any path that allows anonymous publishing.

This was fixed in `gortmplib` PR #121, which makes the RTMP message parsing and the reader reject empty H264 and H265 parameter sets as malformed input, so that only NAL units with at least 1 byte are passed to the `OnDataH26x` callbacks and the error is limited to the offending connection. MediaMTX includes the fix since the update of `gortmplib` to v1.0.2.

Reported by the University of Sydney security research team.

## References

- https://github.com/bluenviron/mediamtx/security/advisories/GHSA-5jgv-c722-r5cg

Page: https://cve.now/GHSA-5JGV-C722-R5CG

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
