Crash [@ graphite2::TtfUtil::CheckTable]

RESOLVED FIXED

Status

()

--
critical
RESOLVED FIXED
3 years ago
2 years ago

People

(Reporter: decoder, Unassigned)

Tracking

(Blocks: 1 bug, {crash, sec-moderate, testcase})

Trunk
x86_64
Linux
crash, sec-moderate, testcase
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox43 fixed, firefox44 fixed)

Details

(Whiteboard: sec-high+ without OTS [gfx-noted][adv-main43+][post-critsmash-triage], crash signature)

Attachments

(1 attachment)

45.50 KB, application/octet-stream
Details
(Reporter)

Description

3 years ago
The attached testcase crashes on graphite2 revision fa8d4398dded (run through the gr2fonttest command line utility).

Backtrace:

==1667==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000efd0 at pc 0x7fe96c758c78 bp 0x7fff75154680 sp 0x7fff75154678
READ of size 4 at 0x60200000efd0 thread T0
    #0 0x7fe96c758c77 in graphite2::TtfUtil::CheckTable(graphite2::TtfUtil::Tag, void const*, unsigned long) /src/TtfUtil.cpp:273:18
    #1 0x7fe96c6d281c in graphite2::Face::Table::Table(graphite2::Face const&, graphite2::TtfUtil::Tag, unsigned int) /src/Face.cpp:277
    #2 0x7fe96c6ea5b3 in graphite2::GlyphCache::Loader::Loader(graphite2::Face const&, bool) /src/GlyphCache.cpp:248
    #3 0x7fe96c6e1211 in graphite2::GlyphCache::GlyphCache(graphite2::Face const&, unsigned int) /src/GlyphCache.cpp:123
    #4 0x7fe96c6ce304 in graphite2::Face::readGlyphs(unsigned int) /src/Face.cpp:98
    #5 0x7fe96c66ba7b in (anonymous namespace)::load_face(graphite2::Face&, unsigned int) /src/gr_face.cpp:54
    #6 0x7fe96c66ef79 in gr_make_face_with_ops /src/gr_face.cpp:89
    #7 0x7fe96c66ef79 in gr_make_file_face /src/gr_face.cpp:242
    #8 0x48ed05 in Parameters::testFileFont() const /gr2fonttest/gr2FontTest.cpp:618
    #9 0x49248b in main /gr2fonttest/gr2FontTest.cpp:770
    #10 0x7fe96c2acec4 (/lib/x86_64-linux-gnu/libc.so.6+0x21ec4)
    #11 0x486c4c in _start (/build/gr2fonttest/gr2fonttest+0x486c4c)

0x60200000efd1 is located 0 bytes to the right of 1-byte region [0x60200000efd0,0x60200000efd1)
allocated by thread T0 here:
    #0 0x46df61 in __interceptor_malloc (/build/gr2fonttest/gr2fonttest+0x46df61)
    #1 0x7fe96c760bfe in graphite2::FileFace::get_table_fn(void const*, unsigned int, unsigned long*) /src/FileFace.cpp:90
    #2 0x7fe96c6d279f in graphite2::Face::Table::Table(graphite2::Face const&, graphite2::TtfUtil::Tag, unsigned int) /src/Face.cpp:274
    #3 0x7fe96c6ea5b3 in graphite2::GlyphCache::Loader::Loader(graphite2::Face const&, bool) /src/GlyphCache.cpp:248
    #4 0x7fe96c6e1211 in graphite2::GlyphCache::GlyphCache(graphite2::Face const&, unsigned int) /src/GlyphCache.cpp:123
    #5 0x7fe96c6ce304 in graphite2::Face::readGlyphs(unsigned int) /src/Face.cpp:98

SUMMARY: AddressSanitizer: heap-buffer-overflow /src/TtfUtil.cpp:273 graphite2::TtfUtil::CheckTable(graphite2::TtfUtil::Tag, void const*, unsigned long)
Shadow bytes around the buggy address:
  0x0c047fff9da0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9db0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9dc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9dd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9de0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c047fff9df0: fa fa fa fa fa fa fa fa fa fa[01]fa fa fa 00 04
  0x0c047fff9e00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9e10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9e20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9e30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9e40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Contiguous container OOB:fc
  ASan internal:           fe
==1667==ABORTING


Note that this is on graphite2 trunk and without OTS in front of it. We tested this particular file and Firefox and it is rejected by OTS with:

Sill: invalid table offset

However, according to cdiehl that doesn't necessarily mean that the bug cannot be reached through OTS (e.g. by fixing up the testcase enough to make it through). Marking s-s until we confirmed that this bug cannot be reached/exploited with OTS enabled.
(Reporter)

Comment 1

3 years ago
Created attachment 8647197 [details]
Testcase
(Reporter)

Updated

3 years ago
Flags: needinfo?(martin_hosken)

Comment 2

3 years ago
Fixed upstream
Flags: needinfo?(martin_hosken)
Keywords: sec-moderate
Whiteboard: sec-high+ without OTS

Updated

3 years ago
Group: core-security → gfx-core-security

Updated

3 years ago
Depends on: 1207207

Updated

3 years ago
Whiteboard: sec-high+ without OTS → sec-high+ without OTS [gfx-noted]

Comment 3

3 years ago
fixed in central (and aurora)
Fixed by bug 1200098.
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
status-firefox43: --- → fixed
status-firefox44: --- → fixed
Depends on: 1200098
No longer depends on: 1207207
Group: gfx-core-security → core-security-release
Whiteboard: sec-high+ without OTS [gfx-noted] → sec-high+ without OTS [gfx-noted][adv-main43+]
Whiteboard: sec-high+ without OTS [gfx-noted][adv-main43+] → sec-high+ without OTS [gfx-noted][adv-main43+][post-critsmash-triage]
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.