Skip to content
Memory corruption Advisory Advanced CVE-2023-37921CVE-2023-37923CVE-2023-37922

GTKWave VCD sorted bsearch arbitrary write vulnerabilities

GTKWave's VCD parser fails to check whether the sorted symbol table is initialised before calling bsearch, allowing a crafted .vcd file to cause an out-of-bounds read that can be turned into an arbitrary write. An attacker could achieve arbitrary code execution by convincing a victim to open a malicious file.

Claudio Bozzato Follow

Originally disclosed on Cisco Talos

High 7.8 View original

Multiple arbitrary write vulnerabilities exist in the VCD sorted bsearch functionality of GTKWave 3.3.115. A specially crafted .vcd 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

The code calls bsearch on the sorted array without checking that it was initialised, because the indexed hash table path was taken instead.

Impact

A crafted .vcd file could lead to arbitrary code execution, though the report notes that controlling the required memory may be easier in 32-bit mode.

What the attacker needed

Victim opens a malicious .vcd file; use of a vulnerable GTKWave version

The fix

The issue was fixed in version 3.3.118 by adding a check that the sorted buffer is initialised before calling bsearch.

How it was found

  1. Create a .vcd file with many $var declarations that all share the same identifier.
  2. Include a port dump line that references a different identifier.
  3. Open the file with a vulnerable GTKWave conversion utility.
  4. The parser calls bsearch on an uninitialised sorted array, causing an out-of-bounds read.
  5. If the attacker controls the memory at the computed address, an arbitrary vcdsymbol is returned.
  6. The subsequent value-change parsing writes attacker-controlled data to an arbitrary address.

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 particular file format lets a malicious file trick the program into reading and writing memory it shouldn't, which can let an attacker run their own code on the victim's computer. The victim just has 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.

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.