GTKWave VCD var definition section out-of-bounds read vulnerabilities
GTKWave's VCD parser allows variable definitions after the end of the header, which can change the minimum hash ID and cause an out-of-bounds read when looking up symbols. An attacker could exploit this to achieve arbitrary code execution by opening a malicious .vcd file.
Originally disclosed on Cisco Talos
Multiple out-of-bounds read vulnerabilities exist in the VCD var definition section functionality of GTKWave 3.3.115. A specially crafted .vcd 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 parser does not prevent variable definitions after the header ends, allowing the minimum hash ID to be updated and causing an out-of-bounds array access during symbol lookup.
Impact
An attacker could achieve arbitrary code execution by convincing a victim to open a malicious .vcd file.
What the attacker needed
Victim opens a malicious .vcd file
The fix
The issue was fixed in version 3.3.118 by properly enforcing that variable definitions cannot occur after $enddefinitions.
How it was found
- Create a VCD file with a variable definition before $enddefinitions.
- Include $enddefinitions to trigger creation of the symbol index.
- Add another variable definition after $enddefinitions with an ID that changes vcd_minid.
- Add a port dump value that references an ID whose hash falls within the new range.
- Open the file in GTKWave or a conversion utility to trigger the out-of-bounds read.
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 electronic signal traces. A specially crafted trace file can trick the program into reading memory outside its intended bounds, and this can be turned into running attacker-controlled code. The victim must 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.