MP4 Security and Privacy: Hidden Data to Check
Review active content, parser risks and hidden metadata before opening or sharing MP4 files.
Box Hierarchy Exploits: Overlaps, Underflows and Empty Structures
MP4 files inherit structural complexity from ISO Base Media File Format (ISOBMFF). Malformed boxes can crash parsers or bypass validation without triggering MIME-type rejection. Three specific conditions warrant immediate rejection of files from untrusted sources:
- Overlapping
stbl(sample table) boxes: When twostblboxes declare ownership of the same byte range inmdat, parsers attempting double-allocation can enter undefined states. This condition is not theoretical—it was the mechanism behind CVE-2019-14981 in FFmpeg's MOV demuxer. - Negative sample sizes in
stsz: The sample size atom uses 32-bit unsigned integers per specification, but some parsers cast these to signed types internally. A craftedstszentry of0xFFFFFFFFtriggers integer underflow during buffer allocation, producing exploitable heap corruption. - Empty
moovwith validftyp: A file presentingftypbox set toisomormp42alongside a zero-lengthmoovatom passesfile(1)and MIME-sniffing checks (video/mp4) while containing no decodable media. Security scanners that stop after identifying the file type miss this condition entirely.
Detection command:
mp4box -strict -info file.mp4 2>&1 | grep -E "overlap|negative|invalid|empty"
Any output from this command indicates structural corruption that makes the file unsafe for players released before 2020, including QuickTime 7.x and VLC versions prior to 3.0.12.
Active Streams: BIFS, Object Descriptors and Codec Execution Paths
MP4 containers can carry executable rendering instructions through two MPEG-4 Systems extensions: BIFS (Binary Format for Scenes) and OD (Object Descriptors). These streams define scene composition and media object behavior at decode time. The Library of Congress format description (FDD000155) documents MP4's derivation from ISOBMFF, which permits uuid boxes containing proprietary data that a parser might interpret as valid codec initialization.
Verification steps:
- List all box types with
mp4box -info file.mp4. Look foriods(Initial Object Descriptor) orBIFStrack references inside themoovhierarchy. A file containing these boxes can execute scene-graph commands during playback. - Inspect
mdatheaders for non-standard padding. The 2017 "MP4Downd" vulnerability in QuickTime exploited oversizedmdatboxes padded with shellcode that triggered a buffer overflow when the decoder processed a craftedstsc(sample-to-chunk) table. - Reject files containing more than one
moovbox. Multiple movie headers indicate a "box smuggling" attempt where onemoovsatisfies validation while a second, hiddenmoovcontains malicious track definitions. Standard ISOBMFF permits exactly onemoovat the file level.
Metadata Vectors: Vendor-Specific Boxes That Leak Identity and Location
MP4 metadata resides in udta (user data) and meta boxes within moov. Unlike EXIF in images, MP4 metadata lacks a privacy standard—manufacturers embed custom uuid boxes that persist through simple remuxing operations.
Boxes requiring audit before sharing:
@PST(Photoshop-specific): Embedded layer names, creation timestamps, and GPS coordinates imported from Adobe Bridge. Extract withexiftool -G1 -a -s file.mp4.XMP_(Adobe XMP): Author email addresses, software serial numbers, and complete edit histories. Extract withexiftool -X file.mp4to review the full RDF/XML payload.GNV(GoPro-specific): Device serial number, firmware revision, GPS track logs sampled at 18 Hz, and three-axis accelerometer data. Inspect withmp4box -meta file.mp4.©xyz(Apple QuickTime user data): Copyright strings, performer names, and content creation coordinates populated automatically from iCloud-synced metadata on iOS and macOS.
Bulk privacy scan:
exiftool -a -u -g1 file.mp4 | grep -E "GPS|Serial|Author|Email|Device"
Any match for GPS Position or Camera Serial Number confirms the file carries hardware-identifying data that survives cropping, transcoding to matching bitrate, and container rewrapping.
moov Atom Placement: Streaming Order and Scanner Evasion
MP4 files arrange their top-level boxes in one of two orders. Fast-start files place moov before mdat, enabling playback before download completes. Streaming-optimized files place moov after mdat, requiring the entire file before metadata becomes available.
Security implications of moov-at-end placement:
- Antivirus heuristics that scan only the first 2–8 MB of a file never reach the metadata. A malicious file can present benign
ftypandmdatheaders while concealing exploit payloads inmoovsub-boxes at the file's tail. - Forensic triage becomes resource-intensive: a file with
moovat end and a 2 GBmdatblock requires full ingestion before any metadata extraction tool can operate.
Position check:
ffprobe -v error -show_entries format=size,duration -of default=noprint_wrappers=1 file.mp4
mp4box -info file.mp4 2>&1 | grep "Movie duration"
If Movie duration reports before the file finishes downloading, moov precedes mdat. If the command blocks until transfer completes, the file requires full download for metadata access—a red flag for files from untrusted sources.
Edit Lists: Hidden Temporal Data in edts Boxes
The edts box inside each trak atom contains an edit list (elst) that defines playback time offsets. These offsets are invisible to video editors operating on decoded frames but control which media samples reach the renderer.
Privacy and integrity risks:
- An edit list can skip segments of
mdatwithout deleting the underlying data. A file presenting as a 2-minute clip may contain 30 minutes of unplayed footage recoverable withmp4dumporffmpeg -copyts. - Edit lists enable forensic watermarking through imperceptible timecode shifts. A file can carry a unique pattern of sub-frame offsets that identifies the original recipient without visible alteration.
Audit command:
mp4box -info file.mp4 2>&1 | grep -A5 "Edit List"
If Edit List appears with Duration values that do not sum to the track's declared duration in mdhd (media header), the file contains hidden temporal data requiring extraction and review.
Fragmented MP4: Steganography in moof Boxes
Fragmented MP4 (FMP4), used by DASH and HLS streaming, distributes media across moof (movie fragment) and mdat pairs. Each fragment carries independent metadata, creating insertion points invisible to players that reassemble fragments sequentially.
Documented steganography methods:
mfhd(movie fragment header) sequence numbers accept arbitrary 32-bit values. Players ignore non-sequential numbers, but fragment analyzers detect the anomaly. Binary data encoded across multiplemfhdfields survives streaming delivery.- Variable-length padding between
trun(track run) boxes provides unindexed byte ranges. Atrunwithdata_offsetpointing beyond its declared sample data leaves gaps that can carry payloads without violating ISOBMFF compliance.
Fragment count verification:
mp4box -diso file.mp4 | grep "moof" | wc -l
Compare the fragment count against the expected value derived from segment duration. Discrepancies exceeding 5% indicate extra fragments warranting byte-level inspection.
Private Data Boxes: UUID-Registered Vendor Payloads
ISOBMFF allows any vendor to register a 16-byte UUID and embed arbitrary binary data in uuid boxes under moov/udta/meta. These boxes pass through generic parsers unvalidated.
High-risk UUID patterns:
- Nokia 3GPP metadata (UUID
b8b4b4b8): Contains IMSI (International Mobile Subscriber Identity) from mobile-originated recordings. The IMSI uniquely identifies the SIM card used during capture. - Apple
©dayatom: Stores the exact creation date from the recording device's hardware clock, independent of filesystem timestamps. - Samsung
SEFDbox (UUIDd89c4b88): Carries device encryption keys and DRM tokens that can link a file to a specific handset.
Extraction command:
mp4dump -path /moov/udta/meta/uuid file.mp4 | xxd
Pipe output through xxd to examine binary content. Known UUID patterns identify hardware-originating data that must be stripped before distribution.
Sanitization Protocol for Untrusted Files
Before sharing any MP4 file received from an external source, execute these steps in order:
- Strip all metadata except codec initialization:
ffmpeg -i input.mp4 -map_metadata -1 -c:v copy -c:a copy output.mp4
This removes udta, meta, and all uuid boxes while preserving video and audio bitstreams unchanged.
- Rebuild
moovto fast-start position:
qtfaststart output.mp4 clean.mp4
This overwrites any reverse-order obfuscation by placing moov at the file head.
- Validate with two independent parsers:
exiftool -all= clean.mp4
mp4box -info clean.mp4 2>&1 | grep -E "Error|Warning"
The first command should report "0 image files updated." The second should produce no output.
- Confirm zero residual fragments:
mp4box -diso clean.mp4 | grep -c "moof"
Result must be 0 for standard (non-fragmented) MP4 output.
Reference: The Library of Congress format specification for MPEG-4 File Format (FDD000155) confirms that the box hierarchy permits arbitrary vendor extensions unvalidated by generic parsers. All files from untrusted sources require sanitization using the protocol above before opening or redistribution.
Technical basis for MP4 Security and Privacy
Format-level claims use the primary MP4 reference.