Pangram verdict · v3.3
We believe that this entire text is human-written.
AI likelihood · overall
HumanArticle text · 1,481 words · 2 segments analyzed
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. Figure 1: Example MP4 Tree 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. Figure 2: Fuzzer Mutation Invalidates MP4 Structure 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. // 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; } Figure 3: Stock Fuzzer’s Core Logic 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. Figure 4: GStreamer Pipeline Architecture (source) To implement this, I wrote an LLVMFuzzerTestOneInput function that passed test cases to a pipeline defined as appsrc name=src !
qtdemux !