Gerbv RS-274X aperture macro multiple outline primitives out-of-bounds read vulnerability
A crafted RS-274X Gerber file with an aperture macro containing multiple outline primitives can cause an out-of-bounds read when the file is rendered, because an unsupported primitive code leaves the previous outline type in place while copying a new vertex count. An attacker could supply such a file to a service that converts Gerber files to images, leading to information disclosure.
Originally disclosed on Cisco Talos
An out-of-bounds read vulnerability exists in the RS-274X aperture macro multiple outline primitives functionality of Gerbv 2.7.0 and dev (commit b5f1eacd), and Gerbv forked 2.7.1 and 2.8.0. A specially-crafted Gerber file can lead to information disclosure.
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 a stale primitive type variable is reused after an unsupported primitive code, so a later outline is processed with a vertex count that was never validated against the parameter buffer.
What the attacker needed
Attacker can supply a Gerber file; target renders the file with Gerbv
How it was found
- Create a Gerber file recognised as RS-274X containing an aperture macro with an outline primitive.
- Add a second primitive with an unsupported code followed by a large vertex count.
- Instantiate the macro with an aperture definition command.
- Upload or open the file so Gerbv renders it, triggering 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.
Gerber files describe the layers of a printed circuit board, and some websites let people upload them so the site can draw a preview image. A bug in the drawing program means a file with a strange shape definition makes it read past the end of a list of numbers, which can leak memory contents. The attacker only needs to upload a malicious file.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.