GTKWave LXT2 num_dict_entries integer overflow vulnerabilities
GTKWave 3.3.115 has integer overflow vulnerabilities in the LXT2 num_dict_entries handling when parsing .lxt2 files. A crafted file can cause heap out-of-bounds writes, potentially leading to arbitrary code execution when opened by a victim.
Originally disclosed on Cisco Talos
Multiple integer overflow vulnerabilities exist in the LXT2 numdictentries functionality of GTKWave 3.3.115. A specially crafted .lxt2 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 multiplication of num_dict_entries by the element size can overflow in 32-bit builds, causing malloc to allocate a smaller buffer than needed, leading to out-of-bounds writes in the subsequent loop.
Impact
A crafted .lxt2 file could cause heap out-of-bounds writes, potentially leading to arbitrary code execution, but only in 32-bit builds; 64-bit builds are not affected.
What the attacker needed
Victim opens a malicious .lxt2 file; 32-bit build of GTKWave
The fix
The vulnerabilities were fixed in version 3.3.118.
How it was found
- Open a malicious .lxt2 file with GTKWave or its command-line tools.
- The file is parsed by lxt2_rd_init, which reads block headers and stores them in a linked list.
- lxt2_rd_iter_blocks decompresses each block and calls lxt2_rd_process_block.
- In lxt2_rd_process_block, num_dict_entries is read from the block.
- Arrays string_pointers and string_lens are allocated with a size that may overflow.
- A loop writes to these arrays, causing 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 traces from electronic simulations. A trace file can contain a number that tells the program how many dictionary entries to expect. If that number is huge, a calculation to reserve memory can wrap around and reserve too little, so the program writes past the end of the reserved memory. This can crash the program or, with careful manipulation, 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.