CVE-2012-1148: Medium severity Libexpat Project Libexpat vulnerability

Published Mar 9, 2012
·
Updated

Last updated 27 February 2025

Other sources

Memory leak in the poolGrow function in expat/lib/xmlparse.c in expat before 2.1.0 allows context-dependent attackers to cause a denial of service (memory consumption) via a large number of crafted XML files that cause improperly-handled reallocation failures when expanding entities.

Launchpad

Tim Boddy reported a memory leak in poolGrow [1]

This bug applies at least to 1.95.8, 2.0.0 and 2.0.1

poolGrow in xml.parse.cpp has the following block of code: if (pool->blocks && pool->start == pool->blocks->s) { int blockSize = (int)(pool->end - pool->start)2; pool->blocks = (BLOCK ) pool->mem->reallocfcn(pool->blocks, (offsetof(BLOCK, s) + blockSize sizeof(XMLChar))); if (pool->blocks == NULL) return XMLFALSE; pool->blocks->size = blockSize; pool->ptr = pool->blocks->s + (pool->ptr - pool->start); pool->start = pool->blocks->s; pool->end = pool->start + blockSize; } It looks like this will cause a memory leak if reallocfcn returns NULL because pool->blocks will be overwritten but the old memory area to which it pointed won't be freed. The other places where reallocation is done in this file (via the REALLOC macro) don't have this bug because they correctly store the result in a temporary variable. This bug allows a serious DOS attack on a server that accepts XML-based requests if a request is seen of the following form:

<!DOCTYPE foo [ <!ENTITY a "1234567890" > <!ENTITY b "&a;&a;&a;&a;&a;&a;&a;&a;" > <!ENTITY c "&b;&b;&b;&b;&b;&b;&b;&b;" > <!ENTITY d "&c;&c;&c;&c;&c;&c;&c;&c;" > <!ENTITY e "&d;&d;&d;&d;&d;&d;&d;&d;" > <!ENTITY f "&e;&e;&e;&e;&e;&e;&e;&e;" > <!ENTITY g "&f;&f;&f;&f;&f;&f;&f;&f;" > <!ENTITY h "&g;&g;&g;&g;&g;&g;&g;&g;" > <!ENTITY i "&h;&h;&h;&h;&h;&h;&h;&h;" > <!ENTITY j "&i;&i;&i;&i;&i;&i;&i;&i;" > <!ENTITY k "&j;&j;&j;&j;&j;&j;&j;&j;" > <!ENTITY l "&k;&k;&k;&k;&k;&k;&k;&k;" > <!ENTITY m "&l;&l;&l;&l;&l;&l;&l;&l;" > <!ENTITY n "&m;&m;&m;&m;&m;&m;&m;&m;" > ]> <foo bar="&n;"/>

When the attribute is expanded, the realloc (assuming that it bounds the size of the request) will fail, leaking the buffer from before the realloc.

[1] http://mail.python.org/pipermail/expat-bugs/2010-February/002870.html http://sourceforge.net/tracker/?func=detail&atid=110127&aid=2958794&groupid=10127

Affected Software

13 affected componentsFixes available
redhat/expat<2.1.0
2.1.0
Libexpat Project Libexpat<=2.0.1
Libexpat Project Libexpat=1.95.1
Libexpat Project Libexpat=1.95.2
Libexpat Project Libexpat=1.95.4
Libexpat Project Libexpat=1.95.5
Libexpat Project Libexpat=1.95.6
Libexpat Project Libexpat=1.95.7
Libexpat Project Libexpat=1.95.8
Libexpat Project Libexpat=2.0.0
Apple iOS and macOS<=10.11.1
debian/expat
2.2.10-2+deb11u52.2.10-2+deb11u72.5.0-1+deb12u12.7.1-1
debian/xmlrpc-c
1.33.14-91.33.14-111.59.03-9

Event History

Jul 3, 2012
CVE Published
via MITRE·07:00 PM
Data Sourced
via MITRE·07:00 PM
Description
Data Sourced
via NVD·07:55 PM
RemedyDescriptionSeverityWeaknessAffected Software
Jan 11, 2024
Data Sourced
via Launchpad·09:58 PM
Description
Mar 3, 2025
Data Sourced
via Ubuntu·01:18 AM
RemedyDescriptionSeverityAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2012-1148?

CVE-2012-1148 is classified as a denial of service vulnerability due to a memory leak.

2

How do I fix CVE-2012-1148?

To fix CVE-2012-1148, upgrade to expat version 2.1.0 or later whichever is appropriate for your system.

3

What software is affected by CVE-2012-1148?

CVE-2012-1148 affects expat versions prior to 2.1.0 and various earlier versions of libexpat.

4

What impact does CVE-2012-1148 have on systems?

CVE-2012-1148 can lead to denial of service through excessive memory consumption when processing crafted XML files.

5

Is CVE-2012-1148 present in macOS systems?

Yes, CVE-2012-1148 affects macOS versions up to 10.11.1 that utilize vulnerable versions of expat.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203