GTKWave FST fstReaderIterBlocks2 chain_table parsing heap-based buffer overflow vulnerabilities
GTKWave's FST file parser fails to check that an index stays within the bounds of a heap buffer when processing chain_table entries, allowing out-of-bounds writes. An attacker can craft a malicious .fst file that, when opened, may lead to arbitrary code execution.
Originally disclosed on Cisco Talos
Multiple heap-based buffer overflow vulnerabilities exist in the fstReaderIterBlocks2 chaintable parsing functionality of GTKWave 3.3.115. A specially crafted .fst 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 does not validate that the index used to write into the chain_table buffer stays within its allocated size, allowing out-of-bounds writes.
Impact
A crafted .fst file could lead to arbitrary code execution when opened by the victim.
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
- Craft an .fst file starting with a header sector (0x00) so that hdr_seen is set and hdr_incomplete remains 0.
- Include a VCDATA block with a chain section containing varints that cause the loop to write beyond the allocated chain_table.
- Open the malicious .fst file with GTKWave or its command-line tools to trigger the 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 waveform files from electronic simulations. A specially crafted file can trick the program into writing data past the end of a memory buffer, which can crash it or let an attacker run their own code. The victim just needs to open the malicious 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.