Gerbv drill format T-code tool number out-of-bounds write vulnerability
An out-of-bounds write vulnerability exists in Gerbv's drill file parsing when handling T-code tool numbers, allowing an attacker to overwrite memory and potentially achieve code execution by supplying a malicious drill file.
Originally disclosed on Cisco Talos
An out-of-bounds write vulnerability exists in the drill format T-code tool number functionality of Gerbv 2.7.0, dev (commit b5f1eacd), and the forked version of Gerbv (commit 71493260). A specially-crafted drill file can lead to 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 tool number from a T-code is used as an index into the aperture array without proper bounds checking, and the error condition is detected but not acted upon, allowing out-of-bounds access.
Impact
An attacker could overwrite memory, potentially leading to code execution, though the write is restricted to NULL dwords in 32-bit mode and depends on int size in 64-bit mode.
What the attacker needed
Victim opens a malicious drill file; file must be recognised as a drill file
How it was found
- Create a file that is recognised as a drill file by including required markers like M48, M30, %, and T with a digit.
- Include a T-code with a tool number outside the valid range (1-9998).
- Follow the T-code with a C and a drill size value between 1 and 9999.
- Open the file with Gerbv, for example using the export option to convert it to an image.
- The out-of-bounds write occurs when the tool number is used to index the aperture array.
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.
Gerbv is a program that reads files describing circuit boards. A bug in how it reads one type of file lets an attacker write data outside the intended memory area, which can crash the program or let the attacker run their own code.
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.