GTKWave LXT2 lxt2_rd_get_facname decompression out-of-bounds write vulnerabilities
GTKWave's LXT2 file parser has out-of-bounds write vulnerabilities in the facility name decompression code. A crafted .lxt2 file can cause heap corruption and potentially arbitrary code execution when opened.
Originally disclosed on Cisco Talos
Multiple out-of-bounds write vulnerabilities exist in the LXT2 parsing 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 copy loops in lxt2_rd_get_facname do not check that writes stay within the allocated buffer size, which is based on the longestname value, while the clone count and string data come from the file and can be larger.
Impact
A crafted .lxt2 file could cause heap corruption and potentially arbitrary code execution when opened by a victim.
What the attacker needed
Victim opens a malicious .lxt2 file
The fix
The vendor fixed the issue in version 3.3.118.
How it was found
- Create a malicious .lxt2 file with a large clone value and crafted zfacnames data.
- Open the file with GTKWave or the lxt2vcd command-line tool.
- The parser reads the clone value and copies bytes from bufprev to bufcurr without bounds checking.
- The out-of-bounds write corrupts adjacent heap memory, including other structures.
- The corrupted heap can lead to a crash or potentially arbitrary code execution.
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. It reads files that can be shared, and a malicious file can trick the program into writing data past the end of a small memory buffer, corrupting other data and possibly letting an attacker run their own code. The victim just needs to open 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.