GTKWave FST fstReaderIterBlocks2 fstWritex len heap-based buffer overflow vulnerabilities
GTKWave 3.3.115 has heap-based buffer overflows in fstReaderIterBlocks2 when parsing a crafted .fst file, because signal_lens values are not checked against the actual data buffer. An attacker could cause memory corruption, potentially leading to code execution, if a victim opens a malicious file.
Originally disclosed on Cisco Talos
Multiple heap-based buffer overflow vulnerabilities exist in the fstReaderIterBlocks2 fstWritex len functionality of GTKWave 3.3.115. A specially crafted .fst file can lead to memory corruption.
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
Likely the code does not validate that the length value taken from the file (signal_lens) fits within the actual data buffer before passing it to a memory copy function, and a signed/unsigned mismatch allows a negative length.
Impact
An attacker could cause memory corruption, potentially leading to arbitrary code execution, though the CVSS vector indicates local access and user interaction are required.
What the attacker needed
Victim opens a malicious .fst file
The fix
The vulnerability was fixed in version 3.3.118.
How it was found
- Create a .fst file that starts with a valid header section (FST_BL_HDR) with non-zero start or end time.
- Include a geometry section (FST_BL_GEOM) that sets a signal_lens value larger than 0x7fffffff.
- Include a VCDATA block with a time table and a value change entry whose least significant bit is 1.
- Open the crafted file with GTKWave or fst2vcd, causing fstReaderIterBlocks2 to call fstWritex with the oversized length.
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 waveforms from electronic simulations. It reads files that describe these waveforms. A bug in how it reads a particular file format (.fst) means that a malicious file can make the program write data past the end of a memory buffer, which can crash it or let an attacker run their own code.
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.