Graphite2 vm::Machine::Code::decoder::fetch_opcode out of bounds read
An out-of-bounds read occurs when parsing a crafted font's silf table on 32-bit systems, leading to a crash. An attacker could cause a denial of service by supplying a malicious font file.
Originally disclosed on Mozilla
- Fixed in 6 months
- Paid in 7 months
- Disclosed after 6 months
Created attachment 8849946
poc.ttf
On 32 bit systems out of bounds reads can occur during the parsing of a silf table.
valgrind log of first read: (created with gr2fonttest tool):
Invalid read of size 1
at 0x804A400: fetch_opcode (Code.cpp:269)
by 0x804A400: graphite2::vm::Machine::Code::decoder::load(unsigned char const*, unsigned char const*) (Code.cpp:251)
by 0x804BA62: graphite2::vm::Machine::Code::Code(...) (Code.cpp:191)
by 0x806210C: graphite2::Pass::readRules(...) (Pass.cpp:287)
by 0x8062F65: graphite2::Pass::readPass(...) (Pass.cpp:226)
by 0x806A13F: graphite2::Silf::readGraphite(unsigned char const*, unsigned int, graphite2::Face&, unsigned int) (Silf.cpp:216)
by 0x8057534: graphite2::Face::readGraphite(graphite2::Face::Table const&) (Face.cpp:149)
by 0x805AE71: (anonymous namespace)::load_face(graphite2::Face&, unsigned int) (gr_face.cpp:59)
by 0x805BA0E: gr_make_face_with_ops (gr_face.cpp:89)
by 0x805BA0E: gr_make_file_face (gr_face.cpp:242)
by 0x806EC45: Parameters::testFileFont() const (gr2FontTest.cpp:640)
by 0x8048E15: main (gr2FontTest.cpp:797)
Address 0x240197c is not stack'd, malloc'd or (recently) free'd
Process terminating with default action of signal 11 (SIGSEGV)
Access not within mapped region at address 0x240197C
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 missing bounds check when fetching opcodes from the silf table during parsing.
Impact
An attacker could cause a denial of service by crashing the application that processes the font.
What the attacker needed
32-bit system; malicious font file
How it was found
- Create a malicious font file (poc.ttf) with a crafted silf table.
- Run the gr2fonttest tool with the malicious font file.
- The tool crashes with a segmentation fault due to an 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.
A font file contains a table that describes how to draw text. The program reads past the end of this table, which can crash it. This means a bad font file could make the program stop working.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.