Bug 466528 (CVE-2008-2238)

Summary: CVE-2008-2238 OpenOffice.org multiple EMF buffer overflows
Product: [Other] Security Response Reporter: Josh Bressers <bressers>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: caolanm, dtardon
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
URL: http://nvd.nist.gov/nvd.cfm?cvename=CVE-2008-2238
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-11-06 10:58:01 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 462642, 462643, 462644, 462645, 462719, 462720, 462721    
Bug Blocks:    
Attachments:
Description Flags
Upstream patch
none
final patch none

Description Josh Bressers 2008-10-10 18:53:53 UTC
iDefense reported multiple buffer overflows in OpenOffice.org's EMF file
parser.

If a victim opens a malicious EMF file, it could be possible to execute
arbitrary code with the permissions of the user running OpenOffice.org.

Comment 1 Josh Bressers 2008-10-10 19:01:33 UTC
Created attachment 320049 [details]
Upstream patch

Comment 2 Tomas Hoger 2008-10-22 14:45:53 UTC
Caolan, is the patch in comment #1 final patch used by upstream?  It does some nEndPos validation, but does not seem to try to prevent integer overflow in:

  nEndPos += nStartPos;

nStartPos is position in the stream, nEndPos is metafile size read from the file, so this addition may wrap and nEndPos can be lower than nStartPos.  So some tests based on nEndPos may go wrong.

Comment 3 Caolan McNamara 2008-10-22 15:20:38 UTC
Created attachment 321166 [details]
final patch

Final patch is here, its the same. 

Might be quite tricky to navigate a .emf past the size tests to get to any (nEndPos - nStartPos) comparisons.

Comment 5 Tomas Hoger 2008-10-27 16:53:12 UTC
The upstream patch basically does 2 types of changes:
- integer overflow checks
- checks using nEndPos to determine whether there is enough data in the file before reading larger arrays

Second type of changes does not seem to be directly related to what iDefense reports.  It seems to rather be a change to make the code bit more correct, and defensive.  Without them, hitting EOF in the middle of the larger read seems to be the worst case.  If no exception is raised when EOF is hit, values read are undefined, which is not worse than attacker-controlled ones.

Please correct me if I wrong in that, as if those checks are security-relevant as well, than "nEndPos += nStartPos" overflow does matter.

Thank you!

Comment 6 Caolan McNamara 2008-10-28 10:34:16 UTC
> The upstream patch basically does 2 types of changes:
> - integer overflow checks
> - checks using nEndPos to determine whether there is enough data in the file
> before reading larger arrays

right

> Second type of changes does not seem to be directly related to what iDefense
> reports.  

right

> It seems to rather be a change to make the code bit more correct, and
> defensive.

Yup, my understanding is that sj decided to stick some defensive code in there while addressing the (messy set of) iDefense overflow issues.

Comment 7 Tomas Hoger 2008-10-28 10:54:59 UTC
Ok, thanks, sounds reasonable.  If you are in communication with sj, please drop him a note about nEndPos issue, so the code can be made even bit more defensive in the future revisions.  Thanks!

Comment 8 Tomas Hoger 2008-10-29 10:45:01 UTC
Public now via:
  http://www.openoffice.org/security/cves/CVE-2008-2238.html

Fixed upstream in 2.4.2.

Comment 9 Fedora Update System 2008-10-30 08:39:20 UTC
openoffice.org-2.3.0-6.17.fc8 has been submitted as an update for Fedora 8.
http://admin.fedoraproject.org/updates/openoffice.org-2.3.0-6.17.fc8

Comment 10 Fedora Update System 2008-10-30 08:50:19 UTC
openoffice.org-2.4.2-18.1.fc9 has been submitted as an update for Fedora 9.
http://admin.fedoraproject.org/updates/openoffice.org-2.4.2-18.1.fc9

Comment 11 Fedora Update System 2008-10-31 10:23:43 UTC
openoffice.org-2.4.2-18.1.fc9 has been pushed to the Fedora 9 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 12 Fedora Update System 2008-10-31 10:27:08 UTC
openoffice.org-2.3.0-6.17.fc8 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.