Bug 800591 - (CVE-2012-1133) CVE-2012-1133 freetype: heap buffer underflow in BDF parser _bdf_parse_glyphs() (#35607)
CVE-2012-1133 freetype: heap buffer underflow in BDF parser _bdf_parse_glyphs...
Status: CLOSED NOTABUG
Product: Security Response
Classification: Other
Component: vulnerability (Show other bugs)
unspecified
All Linux
high Severity high
: ---
: ---
Assigned To: Red Hat Product Security
impact=important,public=20120223,repo...
: Security
Depends On: 806270 806271 889398
Blocks: 800639
  Show dependency treegraph
 
Reported: 2012-03-06 13:51 EST by Jan Lieskovsky
Modified: 2015-07-31 11:20 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-02-24 17:03:12 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Jan Lieskovsky 2012-03-06 13:51:19 EST
An out-of heap-based buffer write flaw was found in the way FreeType font rendering engine performed parsing of glyph information and bitmaps for certain glyph bitmap distribution format (BDF) fonts. A remote attacker could provide a specially-crafted BDF font file, which once opened in an application linked against FreeType would lead to that application crash, or, potentially, arbitrary code execution with the privileges of the user running the application.

Upstream bug report:
[1] https://savannah.nongnu.org/bugs/?35607

Upstream patch:
[2] http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=28dd2c45957278e962f95633157b6139de8170aa

Acknowledgements:

Red Hat would like to thank Mateusz Jurczyk of the Google Security Team for reporting this issue.
Comment 1 Kurt Seifried 2012-03-06 15:52:23 EST
Added CVE as per http://www.openwall.com/lists/oss-security/2012/03/06/16
Comment 2 Jan Lieskovsky 2012-03-14 14:41:53 EDT
This issue did NOT affect the versions of the freetype package, as shipped with Red Hat Enterprise Linux 5 and 6.

--

This issue affects the versions of the freetype package, as shipped with Fedora release of 15 and 16.
Comment 7 Tomas Hoger 2012-03-15 16:43:51 EDT
This problem is triggered by a negative value of the glyph's ENCODING parameter and can cause freetype to index glyphs array (an array of bdf_glyph_t) using index -1.  The glyph structure is both read and written to.
Comment 8 Tomas Hoger 2012-03-16 03:50:21 EDT
It seems this issue existed in old freetype versions.  It was later resolved via the following commit:

http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=481838e2

That commit addresses a security issue CVE-2006-1861 (bug 484437, bug 190593) related to the large ENCODING values causing buffer overflow.  The fix ensures that ENCODING value is not negative and not too large.

The fix was backported to freetype packages in Red Hat Enterprise Linux 2.1, 3, and 4:

https://access.redhat.com/security/cve/CVE-2006-1861

The freetype packages in Red Hat Enterprise Linux 5 and 6 are based on upstream versions that include the fix.

However, the fix introduced a regression and caused valid ENCODING value of -1 to be rejected as invalid.  This was reported upstream and resolved via:

https://savannah.nongnu.org/bugs/?33663
http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=96ddc679

That regression fix re-introduced the security problem.  The regression fix is no included in freetype packages in Red Hat Enterprise Linux 4, 5 and 6.

Statement:

Not vulnerable. This issue did not affect freetype packages as shipped with Red Hat Enterprise Linux 3, 4, 5, and 6.
Comment 9 Tomas Hoger 2012-03-16 08:41:00 EDT
(In reply to comment #8)
> It seems this issue existed in old freetype versions.  It was later resolved
> via the following commit:
> 
> http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=481838e2

Note there is additional follow up patch:

http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=b698eeda

That patch add explicit conversion of p->glyph_enc to size_t for comparison (which causes negative values to be converted to large positive unsigned value).  However, as glyph_enc is (signed) long and the right side of the comparison is of the size_t type, gcc does implicit conversion of the p->glyph_enc to unsigned long and hence error is reported.

> The freetype packages in Red Hat Enterprise Linux 5 and 6 are based on
> upstream versions that include the fix.

freetype packages in Red Hat Enterprise Linux 5 and 6 include explicit conversion to size_t, patch that was added to earlier Red Hat Enterprise Linux versions does not include explicit type conversion.

Note You need to log in before you can comment on or make changes to this bug.