CVE-2025-25946
Executive Summary
CVE-2025-25946 is a memory leak vulnerability in Bento4 v1.6.0-641, specifically within the AP4_MarlinIpmpEncryptingProcessor::Initialize and AP4_Processor::Process functions in Ap4Marlin.cpp and Ap4Processor.cpp. An attacker can trigger this leak by providing a specially crafted MP4 input file to the mp4encrypt utility, leading to uncontrolled memory consumption. This issue is unpatched, and no public exploit code or proof-of-concept is available. The vulnerability is classified under CWE-401 (Improper Release of Memory Before Removing Last Reference).
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
Bento4 is a C++ library and toolset for MP4 file manipulation, commonly used in media processing pipelines. This vulnerability affects the mp4encrypt binary, which is part of the Bento4 distribution. No package manager (NPM, PyPI, Go, Ruby) is involved; the software is typically compiled from source or distributed as a binary. Users should verify the integrity of their Bento4 builds and monitor for any updates from the vendor.
CVSS Breakdown & Threat Level
- CVSS Score: 0.0 (No official CVSS vector assigned)
- Attack Vector (AV): Local (requires crafted MP4 file)
- Attack Complexity (AC): Low
- Privileges Required (PR): None
- User Interaction (UI): Required (user must run
mp4encrypton the malicious file) - Scope (S): Unchanged
- Confidentiality (C): None
- Integrity (I): None
- Availability (A): Low (memory exhaustion)
- Threat Level: Low (no remote exploitation, no data breach)
Deep Dive & Mechanics
The vulnerability resides in the Marlin IPMP (Intellectual Property Management and Protection) encrypting processor. When mp4encrypt processes a crafted MP4 file, the AP4_MarlinIpmpEncryptingProcessor::Initialize function allocates memory for encryption contexts but fails to release it properly if an error occurs during processing. Similarly, AP4_Processor::Process may leak memory when handling malformed track data. The leak is triggered by:
- Parsing a specially crafted MP4 file with malformed Marlin protection headers.
- The
Initializefunction allocating resources for encryption. - An error condition (e.g., invalid track reference) causing an early return without freeing allocated memory.
- Repeated processing of such files leading to cumulative memory exhaustion.
The leak is not exploitable for code execution but can cause denial of service by exhausting system memory.
Vulnerable vs. Patched Code
Vulnerable Code (Bento4 v1.6.0-641):
// Ap4Marlin.cpp
AP4_Result AP4_MarlinIpmpEncryptingProcessor::Initialize(AP4_Track* track) {
AP4_Result result = AP4_SUCCESS;
// Allocate encryption context
AP4_MarlinIpmpEncryptingTrack* encrypting_track = new AP4_MarlinIpmpEncryptingTrack();
if (encrypting_track == NULL) {
return AP4_ERROR_OUT_OF_MEMORY;
}
// ... processing that may fail ...
if (AP4_FAILED(result)) {
// Missing: delete encrypting_track;
return result; // Leak occurs here
}
// ...
}
Patched Code (Hypothetical Fix):
AP4_Result AP4_MarlinIpmpEncryptingProcessor::Initialize(AP4_Track* track) {
AP4_Result result = AP4_SUCCESS;
AP4_MarlinIpmpEncryptingTrack* encrypting_track = new AP4_MarlinIpmpEncryptingTrack();
if (encrypting_track == NULL) {
return AP4_ERROR_OUT_OF_MEMORY;
}
// ... processing that may fail ...
if (AP4_FAILED(result)) {
delete encrypting_track; // Proper cleanup
return result;
}
// ...
}
Exploitation & Lab Setup
Red Team
No public exploit code exists. To reproduce the vulnerability:
- Obtain Bento4 v1.6.0-641 source and compile
mp4encrypt. - Craft a malicious MP4 file with a malformed Marlin protection box (e.g., invalid
sinfbox or missing track reference). - Run:
./mp4encrypt --method MARLIN --key <key> --property <prop> malicious.mp4 output.mp4 - Monitor memory usage with
toporhtop; repeated execution will show increasing memory consumption.
Blue Team
- Monitor for excessive memory usage by
mp4encryptprocesses. - Use file integrity monitoring to detect crafted MP4 files.
- Implement resource limits (ulimit) for media processing tools.
- Sandbox
mp4encryptexecution in a restricted environment.
Indicators of Compromise (IOCs)
- File Hashes: No specific hashes available; crafted MP4 files will have unusual Marlin protection box structures.
- Process Behavior:
mp4encryptconsuming increasing memory over time. - Network: No network indicators (local vulnerability).
- Logs: System logs may show out-of-memory errors when processing multiple malicious files.
Detection Engineering
YARA Rule
rule CVE_2025_25946_Bento4_Memory_Leak {
meta:
description = "Detects crafted MP4 files targeting Bento4 memory leak in Marlin processor"
author = "Valters IT"
date = "2025-03-01"
reference = "CVE-2025-25946"
strings:
$marlin_box = "sinf" // Protection scheme information box
$marlin_header = { 6D 61 72 6C } // "marl" in hex
$invalid_track = { 00 00 00 00 } // Potential null track reference
condition:
$marlin_box at 0 and $marlin_header and #invalid_track > 2
}
Sigma Rule
title: Bento4 mp4encrypt Memory Leak Exploitation Attempt
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects execution of mp4encrypt with crafted MP4 files causing memory leak
author: Valters IT
date: 2025-03-01
logsource:
category: process_creation
product: linux
detection:
selection:
Image|endswith: '/mp4encrypt'
CommandLine|contains: '--method MARLIN'
condition: selection
falsepositives:
- Legitimate use of Marlin encryption
level: low
Suricata Rule
alert http any any -> any any (msg:"CVE-2025-25946 Bento4 mp4encrypt Memory Leak Attempt"; flow:to_server; content:"|73 69 6E 66|"; depth:4; content:"|6D 61 72 6C|"; distance:0; within:4; classtype:attempted-dos; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate: Avoid processing untrusted MP4 files with
mp4encrypt. Use resource limits (e.g.,ulimit -v 500000) to cap memory usage. - Short-term: Apply the hypothetical patch shown in the Vulnerable vs. Patched Code section to your local Bento4 build.
- Long-term: Monitor the Bento4 project for an official fix. Consider switching to an alternative MP4 encryption tool (e.g., GPAC, FFmpeg with encryption support).
- Detection: Deploy the YARA and Sigma rules to identify malicious files and process behavior.
Valters IT
Senior DevSecOps & Cyber Threat Intelligence Expert
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.