Skip to content
Memory corruption Advisory Advanced CVE-2023-36915CVE-2023-36916

GTKWave FST fstReaderIterBlocks2 chain_table allocation integer overflow vulnerabilities

GTKWave 3.3.115 has integer overflow vulnerabilities in the allocation of chain_table and chain_table_lengths when parsing .fst files. A crafted file can cause a small heap buffer to be allocated and then written out-of-bounds, potentially leading to arbitrary code execution.

Claudio Bozzato Follow

Originally disclosed on Cisco Talos

High 7.8 View original

Multiple integer overflow vulnerabilities exist in the FST fstReaderIterBlocks2 chaintable allocation functionality of GTKWave 3.3.115. A specially crafted .fst file can lead to arbitrary code execution.

Claudio Bozzato, on Cisco Talos

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 program does not validate the vc_maxhandle value before using it in calloc, so the addition vc_maxhandle+1 or the multiplication inside calloc can overflow, resulting in a small allocation that is later written past its bounds.

Impact

An attacker could execute arbitrary code with the privileges of the user running GTKWave, though on some systems the overflow may be detected and cause only a crash.

What the attacker needed

Victim opens a malicious .fst file

The fix

The vulnerabilities were fixed in version 3.3.118 by properly validating vc_maxhandle before allocation.

How it was found

  1. Create a .fst file that starts with a header block (sectype 0x00) and sets start_time or end_time to a non-zero value.
  2. In a VCDATA block, set vc_maxhandle to a value that causes the allocation size to wrap around.
  3. Set chain_clen to a large value independent of vc_maxhandle.
  4. Open the crafted file in GTKWave to trigger the out-of-bounds writes.

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. When it opens a file, it calculates how much memory to reserve based on a number stored in the file. If that number is huge, the calculation can wrap around and reserve almost no memory, but the program then writes lots of data into that tiny space, corrupting memory and possibly letting 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.

More by Claudio Bozzato

View all

185 more disclosed reports, best first.

More from Cisco Talos

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.