GTKWave VZT LZMA_Read dmem extraction out-of-bounds write vulnerability
A heap buffer overflow exists in GTKWave's LZMA decompression when parsing VZT files, because the destination buffer is allocated using one length but filled using a different, attacker-controlled length. An attacker could exploit this to execute arbitrary code when a victim opens a malicious file.
Originally disclosed on Cisco Talos
An out-of-bounds write vulnerability exists in the VZT LZMARead dmem extraction functionality of GTKWave 3.3.115. A specially crafted .vzt file can lead to arbitrary code execution.
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 code allocates a heap buffer using a length read from the file (dstlen) but then reads data into it using a separate, unchecked length (srclen), allowing srclen to exceed the buffer size.
Impact
A victim opening a malicious file could trigger a heap buffer overflow, potentially leading to arbitrary code execution.
What the attacker needed
Victim opens a malicious .vzt file
The fix
The vulnerability was fixed in version 3.3.118.
How it was found
- Craft a VZT file with a compressed block where the source length (srclen) is larger than the destination length (dstlen).
- Open the crafted file with GTKWave or its command-line tools (e.g., vzt2vcd).
- The LZMA_read function allocates dmem based on dstlen and then reads srclen bytes into it, causing a heap overflow.
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.
GTKWave is a program for viewing signal traces from electronic simulations. It reads compressed files, and when decompressing one part, it reserves a small space in memory but then writes more data than fits, which can corrupt memory and let an attacker run their own code. The victim just needs to open a malicious trace file.
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.