GTKWave FST fstReaderIterBlocks2 time_table tsec_nitems integer overflow vulnerability
An integer overflow in GTKWave's fstReaderIterBlocks2 function when parsing a crafted .fst file can cause a heap buffer overflow, allowing an attacker to corrupt memory and potentially execute arbitrary code. The victim must open a malicious file to trigger the vulnerability.
Originally disclosed on Cisco Talos
An integer overflow vulnerability exists in the fstReaderIterBlocks2 timetable tsecnitems 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 integer overflow occurs because the number of time table items (tsec_nitems) is multiplied by the size of each item without checking for overflow, leading to an undersized allocation.
Impact
An attacker could exploit this to execute arbitrary code, though on some systems the overflow is detected and only causes a crash.
What the attacker needed
Victim opens a malicious .fst file
The fix
It was fixed in version 3.3.118.
How it was found
- Craft a .fst file starting with a header sector (0x00) to set hdr_seen.
- Include a VCDATA block with a time section where tsec_nitems is set to a large value that overflows when multiplied by 8.
- Open the crafted file in GTKWave or use the fst2vcd command-line tool.
- The program allocates a small buffer due to overflow and then writes out-of-bounds while parsing the time table.
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 electronic signal traces. A bug in how it reads a file's time table can make it allocate a tiny memory buffer but then write many values into it, overflowing the buffer. 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.