GTKWave FST fstReaderIterBlocks2 vesc allocation integer overflow vulnerability
An integer overflow in the vesc allocation of GTKWave's FST reader, when compiled as a 32-bit binary, allows a crafted .fst file to cause a heap buffer overflow. An attacker could achieve memory corruption and potentially arbitrary code execution by convincing a victim to open a malicious file.
Originally disclosed on Cisco Talos
An integer overflow vulnerability exists in the FST fstReaderIterBlocks2 vesc allocation functionality of GTKWave 3.3.115, when compiled as a 32-bit binary. 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 an integer overflow in the calculation of the buffer size for the vesc buffer (len * 4 + 1) when len is a large 32-bit value, leading to a heap buffer overflow during escaping.
Impact
An attacker could cause memory corruption and potentially execute arbitrary code, though the CVSS score indicates high attack complexity and requires user interaction.
What the attacker needed
Victim opens a malicious .fst file; GTKWave compiled as 32-bit
How it was found
- Craft an .fst file with a header sector and a VCDATA sector containing a large len value.
- Open the file with GTKWave or a command-line tool like fst2vcd.
- The program parses the file and reaches the vulnerable allocation.
- The integer overflow causes a small buffer to be allocated.
- The escaping function writes beyond the buffer, causing memory corruption.
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. A bug in how it reads a file format called FST means that a malicious file can make the program allocate a buffer that is too small, and then write past the end of it. This can crash the program 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.