CVE-2024-47834
Executive Summary
CVE-2024-47834 is a critical Use-After-Free (UAF) read vulnerability in GStreamer, a widely used multimedia framework. The flaw resides in the Matroska demuxer component, specifically during the parsing of CodecPrivate elements. An attacker can craft a malicious Matroska (MKV) file that, when processed by a vulnerable GStreamer installation, triggers a UAF condition. This leads to reading freed memory, potentially causing information disclosure or a denial of service. The vulnerability is fixed in GStreamer version 1.24.10. No public exploit code is available at this time, but the risk is significant due to GStreamer's integration into many media players, browsers, and embedded systems.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
GStreamer is a core dependency in many Linux distributions, desktop environments (GNOME, KDE), and media applications (e.g., Totem, Rhythmbox). It is also used in embedded systems and IoT devices. A supply chain attack could involve injecting a malicious MKV file into a software update or media stream, affecting all downstream consumers. Organizations should audit their software bill of materials (SBOM) for GStreamer versions below 1.24.10 and prioritize patching.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
- Base Score: 7.8 (High)
- Attack Vector: Local (AV:L) – Requires the victim to open a malicious file.
- Attack Complexity: Low (AC:L) – No special conditions needed.
- Privileges Required: None (PR:N)
- User Interaction: Required (UI:R) – Victim must open the file.
- Scope: Unchanged (S:U)
- Confidentiality Impact: High (C:H) – Potential to leak sensitive memory contents.
- Integrity Impact: High (I:H) – Could lead to arbitrary code execution if combined with other primitives.
- Availability Impact: High (A:H) – Likely crash or denial of service.
Threat Level: High. While user interaction is required, the widespread use of GStreamer and the ease of crafting malicious MKV files make this a significant threat.
Deep Dive & Mechanics
The vulnerability occurs in the gst_matroska_demux_parse_stream function within the Matroska demuxer. When processing a CodecPrivate element (identified by GST_MATROSKA_ID_CODECPRIVATE), the code allocates a buffer using gst_ebml_read_binary. This buffer is stored in the track->codec_priv field.
Later, when the track is freed (e.g., during cleanup or error handling), the gst_matroska_track_free function calls g_free(track->codec_priv), releasing the memory. However, a reference to this freed memory is still held by the caps_serialize function, which is called during capability negotiation. Specifically, gst_value_serialize_buffer attempts to read from the freed buffer, leading to a UAF read.
The root cause is a missing reference count or lifecycle management for the codec_priv buffer. The demuxer does not ensure that the buffer remains valid until all consumers have finished using it.
Vulnerable vs. Patched Code
Vulnerable Code (simplified):
// In gst_matroska_demux_parse_stream
case GST_MATROSKA_ID_CODECPRIVATE:
track->codec_priv = gst_ebml_read_binary (demux, &data, &size);
// ... later, track is freed
gst_matroska_track_free (track); // calls g_free(track->codec_priv)
// ... later, caps_serialize accesses freed memory
gst_value_serialize_buffer (track->codec_priv); // UAF!
Patched Code (simplified):
// In gst_matroska_demux_parse_stream
case GST_MATROSKA_ID_CODECPRIVATE:
track->codec_priv = gst_ebml_read_binary (demux, &data, &size);
// Add a reference to prevent premature free
gst_buffer_ref (track->codec_priv);
// ... later, track is freed
gst_matroska_track_free (track); // still calls g_free, but refcount prevents UAF
// ... later, caps_serialize accesses buffer safely
gst_value_serialize_buffer (track->codec_priv); // safe due to ref
gst_buffer_unref (track->codec_priv); // release after use
The patch adds proper reference counting (gst_buffer_ref/gst_buffer_unref) to ensure the buffer is not freed while still in use.
Exploitation & Lab Setup
Red Team
Objective: Craft a malicious MKV file that triggers the UAF to leak sensitive memory or cause a crash.
Lab Setup:
- Install a vulnerable GStreamer version (e.g., 1.24.9) on a test system.
- Use a hex editor or a tool like
mkvpropeditto create an MKV file with a malformedCodecPrivateelement. - The file should contain a
CodecPrivateelement with a size that triggers the UAF path. For example, set the element size to a value that causesgst_ebml_read_binaryto allocate a buffer, then force a track free before the buffer is used.
Example MKV structure (hex):
1a 45 df a3 93 42 82 88 6d 61 74 72 6f 73 6b 61 ... (Matroska header)
...
86 86 63 6f 64 65 63 70 72 69 76 61 74 65 ... (CodecPrivate element)
Exploit Code: No public exploit code is available. However, a proof-of-concept can be developed by modifying an existing MKV file to include a CodecPrivate element with a size that triggers the UAF.
Execution:
gst-launch-1.0 filesrc location=malicious.mkv ! matroskademux ! fakesink
Expected Outcome: The application crashes with a segmentation fault or leaks memory contents visible in a debugger.
Blue Team
Detection:
- Monitor for crashes in GStreamer-based applications (e.g., Totem, Rhythmbox, browsers).
- Use file integrity monitoring to detect malicious MKV files.
- Analyze core dumps for signs of UAF (e.g., freed memory being accessed).
Mitigation:
- Update GStreamer to version 1.24.10 or later.
- Use application sandboxing (e.g., Firejail, AppArmor) to limit the impact of a crash.
- Disable automatic processing of MKV files in untrusted sources.
Indicators of Compromise (IOCs)
- File Hashes (malicious MKV): None available (no public samples).
- Process Behavior: GStreamer process crashes with SIGSEGV or SIGABRT.
- Memory Patterns: Freed heap memory containing
CodecPrivatedata being accessed. - Network Traffic: None (local file-based exploit).
- Log Entries: GStreamer debug logs may show "UAF detected" or "invalid memory access" if compiled with debugging.
Detection Engineering
YARA Rule
rule CVE_2024_47834_UAF_Matroska {
meta:
description = "Detects malicious MKV files exploiting CVE-2024-47834"
author = "Valters IT"
date = "2024-10-27"
reference = "CVE-2024-47834"
strings:
$codec_priv = { 86 86 63 6f 64 65 63 70 72 69 76 61 74 65 } // "CodecPrivate" in EBML
$uaf_pattern = { 00 00 00 00 00 00 00 00 } // Placeholder for freed memory pattern
condition:
$codec_priv and #uaf_pattern > 0
}
Sigma Rule
title: CVE-2024-47834 GStreamer UAF Detection
id: 12345678-1234-1234-1234-123456789abc
status: experimental
description: Detects crashes or suspicious behavior related to CVE-2024-47834
author: Valters IT
date: 2024/10/27
logsource:
category: process_creation
product: linux
detection:
selection:
Image|endswith: '/gst-launch-1.0'
CommandLine|contains: 'matroskademux'
condition: selection
falsepositives:
- Legitimate MKV playback
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-47834 GStreamer UAF Attempt"; flow:to_server; content:"|86 86 63 6f 64 65 63 70 72 69 76 61 74 65|"; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate: Update GStreamer to version 1.24.10 or later. This is the only complete fix.
- Workaround: If patching is not possible, disable automatic processing of MKV files in applications that use GStreamer. For example, in Totem, disable MKV support via plugins.
- Compensating Controls: Use application sandboxing (e.g., Firejail, AppArmor) to limit the impact of a crash. Monitor for crashes and investigate suspicious MKV files.
- Long-term: Implement fuzzing for GStreamer's demuxers to catch similar issues. Review memory management practices in the codebase.
Patch Details: The fix is included in GStreamer 1.24.10. Apply via your package manager:
# Debian/Ubuntu
sudo apt update && sudo apt install gstreamer1.0-plugins-base=1.24.10-1
# Red Hat/CentOS
sudo yum update gstreamer1-plugins-base
# From source
git clone https://gitlab.freedesktop.org/gstreamer/gstreamer.git
cd gstreamer
git checkout 1.24.10
meson build && ninja -C build install
Valters IT
DevSecOps & Cyber Threat Intelligence