In this blog post, I’ll discuss some challenges around fuzzing the MP4 container format with conventional mutation-based strategies, how I developed targeted fuzzers for GStreamer’s MP4 demuxer (the qtdemux element), and the vulnerabilities I found. This post is aimed at security researchers interested in developing more effective fuzzing techniques for the MP4 format, for GStreamer and beyond.
I was originally inspired to conduct this research by the blog post Uncovering GStreamer secrets from GitHub Security Lab, in which the author found 29 vulnerabilities in GStreamer by developing an MP4 corpus generator. While their strategy of producing small, structurally valid seed files was successful, it did not attempt to address a fundamental difficulty of fuzzing the format, which is the subject of this post.
Background
GStreamer is a widely used open source multimedia framework, supporting hundreds of media formats across its plugin sets. It consists of several command-line tools and a C library (with bindings for many other languages) that allow power users and developers to create arbitrarily complex encoding, decoding, and streaming pipelines.
From an adversarial standpoint, GStreamer’s expansive and decades-old media processing code, written in a memory-unsafe language, is a rich attack surface. Any system that sends untrusted data into a GStreamer pipeline is therefore a promising target for attackers. Prominent examples of such systems are the GNOME desktop environment, the WebKitGTK browser engine, the webOS smart TV operating system, and Comcast’s RDK platform for set-top box development, all of which use GStreamer to process media from potentially malicious remote sources.
Since MP4 is the most common media container format on the internet, it was logical to scope my efforts to GStreamer’s isomp4 plugin, included by default in the Good plugin set.
Challenges with conventional fuzzing
When faced with the task of fuzzing a binary format like MP4, most researchers reach for a coverage-guided mutational fuzzer such as AFL++ or libFuzzer. This is a good instinct and is usually the right answer. However, the default mutation strategies used by these fuzzers tend not to be effective at achieving deep coverage for MP4 parsers, as we will see below.
An MP4 file can be represented as an n-ary tree consisting of nodes (referred to as atoms or boxes in the specification) that carry different kinds of data and metadata. Some atoms are parents to child atoms, while others are leaves that merely contain their own payloads.

To achieve this structure in a binary file, atoms are laid out in a depth-first sequence, each with a 4-byte size field followed by a 4-byte atom label. The size field accounts for the atom’s header, data, and descendants. When a fuzzer mutates the file by inserting or deleting data within an atom, the tree may become invalid unless the modified atom’s size field, as well as the size fields of each one of its ancestors, are corrected.

Resultingly, a fuzzer that performs naive insertions and deletions (even on a coverage-guided basis) quickly starts failing on early validation code that checks the file’s structural soundness. For example, if a chunk of data is removed from the mdia atom, but the top-level moov atom still claims the original total size, the MP4 parser can reject the entire file because it is obviously invalid. After a while, the fuzzer can reach a plateau where it rarely makes it past those early routines, and deeper, more interesting code paths remain unexercised. This problem is exacerbated the more deeply nested the target atom is; the probability that a random, length-changing mutation will ever be seen by the relevant parsing code drops exponentially with the atom’s depth.
One way to counter this inefficiency is with structure-aware fuzzing, in which the fuzzer understands the format it is working with and uses a custom mutator to ensure that input files are at least loosely structurally valid before feeding them to the system under test (a good primer on structure-aware fuzzing can be found here). Developing a fuzzer that models the entire MP4 format is technically possible but complex to implement and would likely be much slower than a fuzzer targeting only a narrow, bug-prone subset of the specification. Such a fuzzer would also need to decide which of the many format invariants to enforce and which to break. With too much structural validity, the fuzzer may ironically miss some bugs that rely on malformed inputs. With too little, it may run into the original problem again.
Establishing a baseline
Before attempting to develop a structure-aware fuzzer, I first wanted to answer two questions: how much of isomp4 is already covered by conventional mutational fuzzers, and is there any low-hanging fruit left? Since GStreamer is continuously fuzzed by the OSS-Fuzz service, I headed to OSS-Fuzz’s code coverage report to answer the first question. To my surprise, there was (and still is) zero pre-existing MP4 coverage because GStreamer’s fuzz targets were compiled without the Good plugin set (which includes isomp4). As a result, I needed to build one of the fuzzers locally and manually enable those plugins in order to establish a baseline.
I decided to use the general-purpose gst-discoverer fuzzer, which calls the GStreamer API to scan (“discover”) a media URI and extract as much metadata as possible from it with the appropriate plugin. The core logic for the harness is shown in the snippet below (comments my own). libFuzzer passes a single mutated input, represented by data and size, to the LLVMFuzzerTestOneInput function. Each mutation is coverage-guided but format-agnostic; neither libFuzzer nor the harness has any built-in awareness of the MP4 structure. LLVMFuzzerTestOneInput then sends the input unmodified to the GStreamer API’s gst_discoverer_discover_uri function for metadata discovery.
图表:Figure 3: Stock Fuzzer’s Core Logic
// Receives a mutated payload from libFuzzer
int
LLVMFuzzerTestOneInput (const guint8 * data, size_t size)
{
// ...
dc = gst_discoverer_new (timeout * GST_SECOND, &err);
// ...
// Set global payload variables. Passed to GStreamer API via appsrc_configuration
fuzztesting_data = data;
fuzztesting_size = size;
// Discover mutated payload with GStreamer API
g_signal_connect (dc, "source-setup", (GCallback) appsrc_configuration, NULL);
info = gst_discoverer_discover_uri (dc, "appsrc://", &err);
g_clear_error (&err);
if (info)
gst_discoverer_info_unref (info);
g_object_unref (dc);
return 0;
}
After building the fuzzer with -Dgood=enabled to enable the Good plugin set, I ran it inside a virtual machine on my own hardware (Ryzen 9 3950X, 32GB RAM) for roughly 16-24 CPU-weeks. The input corpus was seeded with both complete MP4 files I found in various online corpora and minimal files generated by GitHub Security Lab’s corpus generator. Other than exercising isomp4, there were no functional differences between this fuzzer and the one continuously running on OSS-Fuzz.
Despite the fuzzer’s lack of structure awareness, this round succeeded in uncovering the five memory safety vulnerabilities listed below. The first two potentially allow attackers to disclose heap contents via crafted MP4 files, especially against applications that use the GStreamer API in non-standard ways. The remaining three enable denial of service against GStreamer or any application that uses its API to parse TMPlayer or SubRip subtitle files.
- Heap out-of-bounds read in qtdemux_parse_tree (CVE-2025-47183)
- Heap out-of-bounds read in qtdemux_parse_trak (CVE-2025-47219)
- Null pointer dereference in tmplayer_parse_line (CVE-2025-47808)
- Null pointer dereference in subrip_unescape_formatting (CVE-2025-47807)
- Stack buffer overflow in parse_subrip_time (CVE-2025-47806)
Note that the fuzzer was never seeded with subtitle files; it discovered the TMPlayer and SubRip formats entirely on its own. This is a phenomenon intrinsic to coverage-guided fuzzers, discussed in more detail in the next section.
Pipeline-based fuzzing
The first fuzzer discovered vulnerabilities in two file types it was never seeded with because libFuzzer made random mutations toward the TMPlayer and SubRip formats over time, encouraged by coverage feedback telling it that those were new code paths to explore. Such drift is common with structure-unaware, coverage-guided fuzzing of any target that supports multiple formats, but whether it is desirable depends on the researcher’s goals. For this project, I was more interested in depth of MP4 coverage than breadth of formats, so finding bugs in other file types was an anti-goal.
One way to prevent format drift would be to disable support for all plugins except isomp4 at compile time. However, to keep the build system compatible with other fuzz targets without maintaining different options for each one, I instead took advantage of GStreamer’s pipeline feature. Pipelines allow users to specify the exact sequence of elements that should be chained for operations such as demuxing, decoding, and playback. By defining a pipeline with qtdemux as the only demuxer, one could craft a fuzz target whose mutations converge on the MP4 format at runtime. This works because the pipeline fails early during demuxing on non-MP4 inputs, so libFuzzer sees no new code paths and does not consider those inputs worth mutating further.

To implement this, I wrote an LLVMFuzzerTestOneInput function that passed test cases to a pipeline defined as appsrc name=src ! qtdemux ! fakesink, as shown below. The fakesink element is a dummy sink that discards its input and is necessary to complete the pipeline.
图表:Figure 5: Pipeline-Based MP4 Fuzzer
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
// ...
fuzz_decode_mp4(data, size);
return 0;
}
int fuzz_decode_mp4(const uint8_t *data, size_t size)
{
GstElement *pipeline = gst_parse_launch(
"appsrc name=src ! qtdemux ! fakesink",
NULL);
if (!pipeline)
return 0;
GstElement *src = gst_bin_get_by_name(GST_BIN(pipeline), "src");
GstBuffer *buf = gst_buffer_new();
GstMemory *mem =
gst_memory_new_wrapped(GST_MEMORY_FLAG_READONLY,
(gpointer)data,
size,
0,
size,
NULL,
NULL);
gst_buffer_append_memory(buf, mem);
gst_element_set_state(pipeline, GST_STATE_PLAYING);
GstFlowReturn flow;
g_signal_emit_by_name(src, "push-buffer", buf, &flow);
gst_buffer_unref(buf);
g_signal_emit_by_name(src, "end-of-stream", &flow);
// ...
return 0;
}
This pipeline-based fuzzer was faster than the stock one and found one bug the latter had missed: a heap out-of-bounds read in the qtdemux_parse_uuid function via an MP4 file with crafted PlayReady DRM metadata (CVE-2026-46471). An attacker could exploit this vulnerability to bypass address space layout randomization (ASLR) or leak the contents of files previously loaded by a GStreamer-backed process (see Atredis’ advisory here).
Structure-aware fuzzing
After investigating what was possible with conventional fuzzing, I started to conceptualize a structure-aware MP4 fuzzer. To avoid the complexities involved in modeling the entire MP4 format, I homed in on a small but valuable subset of the specification: the sample description (stsd) atom. This deeply nested atom is rich with variable-size sample decoding metadata contained in a number of sub-atoms, which are technically entries of one field called the sample description table.


Within GStreamer, stsd is handled by the qtdemux_parse_trak function, which loops over the sample description table’s entries and parses each one using a mix of inline code and helper functions. The code tends to rely on manual pointer arithmetic and ad hoc bounds checking, making it a likely source of vulnerabilities. Additionally, coverage reports I generated after running the earlier fuzzing campaigns revealed that large, interesting regions of this code were never being hit. For instance, the section below, which parses a chunk of the video sample description, remained without coverage after extended runs of the stock fuzzer.

A fuzzer that understands how stsd fits into the larger MP4 file and takes care to preserve the structure surrounding it could therefore be fruitful for finding bugs in this code.
As a proof of concept, I developed a partially structure-aware fuzzer with the following design: instead of mutating the entire MP4 file and passing it to GStreamer, as the stock fuzzer did, it would mutate just stsd. It would then randomly splice the mutated data into one of two static template MP4 files (either a video or audio track) containing stsd’s entire ancestor tree and update the ancestors’ size fields appropriately. This way, the overall structure of each MP4 file passed to qtdemux is guaranteed to be valid, while only the target atom is fuzzed. My hypothesis was that this would increase coverage for code sections like the one above.

The basic implementation of this fuzzer is shown below. After receiving and minimally validating an input (a mutated stsd atom), the LLVMFuzzerTestOneInput function calls the fix_outer_structure_and_fuzz helper to adjust the ancestor tree based on the difference between the mutated atom’s size and its original size in the template.
图表:Figure 10: Structure-Aware stsd Fuzzer’s LLVMFuzzerTestOneInput Function
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
// ...
if (size < MIN_DATA_SIZE)
{
// Input too small to hold stsd header and metadata; tell libFuzzer to reject it
return -1;
}
// Update ancestors' sizes to match new stsd atom
fix_outer_structure_and_fuzz(data, size);
return 0;
}
图表:Figure 11: fix_outer_structure_and_fuzz Helper
static void fix_outer_structure_and_fuzz(const uint8_t *data, size_t size)
{
uint8_t trak_type = data[0];
uint8_t *stsd_data = data + 1;
size_t stsd_size = size - 1;
if (trak_type >= sizeof(TRAK_TYPES))
{
fprintf(stderr, "unexpected trak type %d\n", trak_type);
exit(1);
}
int diff = 0;
// Update parent box sizes to match new stsd atom
switch (trak_type)
{
case 0:
diff = stsd_size - TRAK_1_ORIG_STSD_SIZE;
write_uint32_be(TRAK_1_BEFORE_DATA + MOOV_OFFSET, TRAK_1_ORIG_MOOV_SIZE + diff);
write_uint32_be(TRAK_1_BEFORE_DATA + TRAK_1_TRAK_OFFSET, TRAK_1_ORIG_TRAK_SIZE + diff);
write_uint32_be(TRAK_1_BEFORE_DATA + TRAK_1_MDIA_OFFSET, TRAK_1_ORIG_MDIA_SIZE + diff);
write_uint32_be(TRAK_1_BEFORE_DATA + TRAK_1_MINF_OFFSET, TRAK_1_ORIG_MINF_SIZE + diff);
write_uint32_be(TRAK_1_BEFORE_DATA + TRAK_1_STBL_OFFSET, TRAK_1_ORIG_STBL_SIZE + diff);
fuzz_decode_mp4(TRAK_1_BEFORE_DATA, sizeof(TRAK_1_BEFORE_DATA),
TRAK_1_AFTER_DATA, sizeof(TRAK_1_AFTER_DATA),
stsd_data, stsd_size);
break;
// ... Handle other track types ...
}
}
fix_outer_structure_and_fuzz passes the updated ancestor tree, mutated atom, and trailing template data to the fuzz_decode_mp4 helper, which wraps these pieces in a GstBuffer object to form a full MP4 container. It then pushes the buffer to a qtdemux pipeline defined as appsrc name=src ! qtdemux ! decodebin ! fakesink sync=false.
图表:Figure 12: fuzz_decode_mp4 Helper
int fuzz_decode_mp4(uint8_t *head, size_t head_size, uint8_t *tail, size_t tail_size, const uint8_t *data, size_t size)
{
GstElement *pipeline = gst_parse_launch(
"appsrc name=src ! qtdemux ! decodebin ! fakesink sync=false",
NULL);
if (!pipeline)
{
fprintf(stderr, "error creating pipeline");
exit(1);
}
GstElement *src = gst_bin_get_by_name(GST_BIN(pipeline), "src");
GstBuffer *buf = gst_buffer_new();
GstMemory *mem_head =
gst_memory_new_wrapped(GST_MEMORY_FLAG_READONLY,
head,
head_size,
0,
head_size,
NULL,
NULL);
gst_buffer_append_memory(buf, mem_head);
GstMemory *mem_middle =
gst_memory_new_wrapped(GST_MEMORY_FLAG_READONLY,
data,
size,
0,
size,
NULL,
NULL);
gst_buffer_append_memory(buf, mem_middle);
GstMemory *mem_tail =
gst_memory_new_wrapped(GST_MEMORY_FLAG_READONLY,
tail,
tail_size,
0,
tail_size,
NULL,
NULL);
gst_buffer_append_memory(buf, mem_tail);
GST_BUFFER_OFFSET(buf) = 0;
GST_BUFFER_OFFSET_END(buf) = head_size + size;
g_object_set(G_OBJECT(src), "size", head_size + size, NULL);
gst_element_set_state(pipeline, GST_STATE_PLAYING);
GstFlowReturn flow;
g_signal_emit_by_name(src, "push-buffer", buf, &flow);
gst_buffer_unref(buf);
g_signal_emit_by_name(src, "end-of-stream", &flow);
// ... Cleanup ...
return 0;
}
While the basic concept works as is, it is somewhat counterproductive to always mutate everything inside stsd. Because the goal is structure awareness, fields like the atom type (label), size, and entry count should stay correct at least some percentage of the time, or we would re-encounter the problem solved by step three in the diagram above, just at the stsd level. At the other extreme, keeping the header valid 100% of the time could make us miss bugs stemming from disagreements between the size or entry count field and the contents of the payload (the sample description table).
We can compromise by adding a libFuzzer custom mutator to fix the atom’s size and entry count fields 50% of the time (arbitrary; there might be a more optimal value):
size_t LLVMFuzzerCustomMutator(uint8_t *Data, size_t Size, size_t MaxSize, unsigned int Seed)
{
size_t mutated_size = LLVMFuzzerMutate(Data, Size, MaxSize);
if (mutated_size < MIN_DATA_SIZE)
{
mutated_size = MIN_DATA_SIZE;
}
uint8_t new_trak_type = rand() % 2;
Data[0] = new_trak_type;
uint8_t *stsd_data = Data + 1;
// Restore type field in case it was mutated
stsd_data[4] = 's';
stsd_data[5] = 't';
stsd_data[6] = 's';
stsd_data[7] = 'd';
int should_fix_stsd = ((rand() % 2) == 0);
if (should_fix_stsd)
{
size_t stsd_size = mutated_size - 1;
// Update stsd size field
write_uint32_be(stsd_data, stsd_size);
size_t stsd_entry_count = read_uint32_be(stsd_data + 12);
if (stsd_entry_count == 0 || stsd_entry_count > (stsd_size / 8))
{
write_uint32_be(stsd_data + 12, (rand() % (stsd_size / 16)) + 1);
}
}
return mutated_size;
}
Instead of whole MP4 files, this fuzzer is seeded with a diverse sampling of stsd atoms, which I extracted from earlier runs’ corpora. All crash files and other libFuzzer artifacts are also stsd atoms and do not reproduce directly under GStreamer; they must be either spliced back into the right template first or passed to the fuzzer binary (which does the splicing automatically) as positional arguments.
This fuzzer ultimately yielded three new bugs: two division-by-zero vulnerabilities allowing denial of service with crafted audio tracks (CVE-2026-46469 and CVE-2026-46470) and one global buffer overread without clear exploitability (CVE-2026-46472). As hypothesized, the coverage reports generated after a long campaign with this harness showed a substantial increase in qtdemux_parse_trak coverage, particularly in the section responsible for handling stsd.
Disclosure and remediation
As I verified and root-caused the crashes that accumulated, I reported them to the GStreamer developers per the project’s disclosure policy. This process entailed creating an account on https://gitlab.freedesktop.org and filing a confidential GitLab issue under the GStreamer/gstreamer repository.
The first batch of vulnerabilities, found during the stock fuzzer campaign, was fixed in the 1.26.2 release on May 29, 2025. The single issue found by the pipeline-based fuzzer was fixed in the 1.28.1 release on February 26, 2026. Finally, the three bugs raised by the structure-aware fuzzer were fixed in version 1.28.2 on April 7, 2026. In addition to these point releases, GStreamer published patch files allowing end users to manually incorporate the remediations into older versions of the software. Further details on the disclosure and remediation timeline can be found in Atredis’ advisories.
I would like to highlight GStreamer’s frictionless disclosure process and the maintainers’ quick turnaround on my reports. The developers acknowledged each of my submissions within 24 hours, and internal fix commits were sometimes made even faster than that. This kind of response time is rarely seen from vendors, and I commend the GStreamer team for their attentiveness to security issues.
Limitations and future work
This blog post has shown that it is possible to extract more code coverage and vulnerabilities from MP4-handling targets using partially structure-aware fuzzers, even after extended fuzzing with a format-agnostic approach. However, the fuzzer I built had several design limitations that future research in this area should address. These include (but are not limited to) the following:
- Single-atom focus: The fuzzer only mutated stsd, leaving all other atoms alone. stsd is not the only complex atom, and its interactions with data in other segments of the MP4 file format might find code paths not yet explored by this work. A fuzzer capable of modeling a larger subset of the format and mutating different combinations of atoms (while keeping the overall file structurally valid) would search an exponentially greater input space and likely cover more code.
- Static template: While splicing stsd into a pair of unchanging MP4 templates simplified fuzzer development, it also likely blocked off code paths dependent on state set by stsd’s ancestor atoms. An approach that rotates between a variety of templates and injects randomness into fuzzed atoms’ ancestors is well worth exploring.
- Limited subset of tracks: The fuzzer mutated stsd only within two MP4 track types: vide (video) and soun (audio). Extending the fuzzer to support the full range of track types recognized by isomp4 would not be difficult and, when paired with support for different atom types, could produce substantially more bugs.
- Demux-only focus: As stated in the introduction, this research focused on GStreamer’s MP4 demuxer in isolation. Codec parsing, decoding, encoding, and other elements of a full MP4 pipeline were out of scope but would also be expected to contain vulnerabilities. Future work should attempt to pass structurally mutated inputs to different pipeline configurations to exercise a broader range of GStreamer’s MP4 functionality.
In addition, this research occurred over several weeks between January 2025 and January 2026, just before the widespread adoption of AI agent harnesses for security research. As a result, all development, testing, debugging, fuzzing, and bug triage were done without the help of LLMs. The space has changed significantly in the past year. Frontier models are now capable not only of rapidly implementing and iterating on custom fuzzers, but also of spotting subtle vulnerabilities in complex codebases just by reading them. I would strongly advise anyone who picks up this work to enlist an AI agent and let it try both static and dynamic approaches.