GTKWave LXT2 lxt2_rd_trace value elements allocation integer overflow vulnerability
An integer overflow in GTKWave's LXT2 file parsing causes a small heap buffer to be allocated for a value, which is later written to out-of-bounds. An attacker could craft a malicious .lxt2 file that, when opened, leads to memory corruption and potentially arbitrary code execution.
Originally disclosed on Cisco Talos
An integer overflow vulnerability exists in the LXT2 lxt2rdtrace value elements allocation functionality of GTKWave 3.3.115. A specially crafted .lxt2 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 when calculating the buffer size (len + 1) for a value, where len can be 0xffffffff, causing calloc(0,1) to allocate a tiny buffer that is later written to as if it were large.
Impact
An attacker could cause memory corruption and potentially execute arbitrary code, though the text notes this may be possible due to multi-threading.
What the attacker needed
Victim opens a malicious .lxt2 file
The fix
It was fixed in version 3.3.118.
How it was found
- Craft an LXT2 file with a facility whose msb and lsb values cause len to be 0xffffffff.
- Open the file in GTKWave or a tool like lxt2vcd, which calls lxt2_rd_init and allocates a tiny buffer for that value.
- Include a block with a value change that triggers a write operation (e.g., memset, memmove, memcpy, or a loop) on the undersized buffer.
- The write goes out-of-bounds, 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 traces from electronic simulations. A bug in how it reads a certain file format means that a malicious file can make the program write data past the end of a small memory buffer, corrupting memory. This could let an attacker run their own code on the victim's computer if the victim opens the 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.