GTKWave VZT longest_len value allocation integer overflow vulnerability
An integer overflow in GTKWave's VZT file parsing allows a crafted file to cause a heap buffer overflow, potentially leading to arbitrary code execution. A victim must open a malicious .vzt file to trigger the vulnerability.
Originally disclosed on Cisco Talos
An integer overflow vulnerability exists in the VZT longestlen value allocation functionality of GTKWave 3.3.115. A specially crafted .vzt 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
Likely, the integer overflow occurs because the difference between msb and lsb is computed as a signed 32-bit integer without checking for overflow, leading to a negative value that is then used as a size in malloc, resulting in a small allocation.
Impact
A crafted .vzt file could lead to arbitrary code execution, with the number of bytes written out-of-bounds carefully controlled.
What the attacker needed
Victim opens a malicious .vzt file
The fix
The vulnerability was fixed in version 3.3.118.
How it was found
- Craft a .vzt file with msb and lsb values that cause longest_len to become 0xffffffff.
- Open the malicious .vzt file with GTKWave or vzt2vcd.
- The program allocates a tiny buffer due to integer overflow.
- During block processing, out-of-bounds writes occur when writing facility values.
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 bug in how it reads a certain file type (.vzt) lets an attacker craft a file that, when opened, can crash the program or run malicious code. The problem is that a size value in the file is used to allocate memory without checking for overflow, so a huge value wraps around to a tiny allocation, and later writes overflow that small buffer.
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.