MKVToolNix MKVINFO read_one_element code execution vulnerability
A use-after-free vulnerability in MKVToolNix MKVINFO v25.0.0 allows a crafted MKV file to cause arbitrary code execution. The parser deletes an element but later tries to delete it again, leading to a crash and potential code execution.
Originally disclosed on Cisco Talos
A use-after-free vulnerability exists in the way MKVToolNix MKVINFO v25.0.0 handles the MKV (matroska) file format. A specially crafted MKV file can cause arbitrary code execution in the context of the current user.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The parser deletes an element that failed validation but still passes a pointer to it back to the caller, which then deletes it again, causing a double-free/use-after-free.
Impact
A crafted MKV file could lead to arbitrary code execution in the context of the current user.
What the attacker needed
Victim opens a crafted MKV file with MKVINFO
The fix
The vendor patched the vulnerability on 2018-10-25.
How it was found
- Craft a malicious MKV file that triggers the parser to delete an element during reading.
- Open the file with MKVINFO, causing the parser to attempt to delete the already-freed element.
- Observe the use-after-free and potential code execution.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A use-after-free bug happens when a program frees memory but then keeps using it. Here, a malformed video file tricks the program into freeing a piece of memory twice, which can let an attacker run their own code on the computer.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.