CVE-2012-6702
Medium · 5.9CVSS
5.9
EPSS
2.4%
Published
Jun 16, 2016
CISA due date
—
Cloudanix analysis
A widely used XML parsing library can let attackers guess internal random values, making it possible for tampered data to slip through security checks in many applications and devices.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- High
- Impact
- Data Tampering
- Component
- Library
- Class
- Cryptographic Weakness
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
When XML_SetHashSalt is not called or is passed a zero seed, Expat relies on the default srand seeding behavior for internal hash functions, allowing predictable hash values that can be abused to cause collisions and defeat integrity protections in dependent parsers.
Why it matters to the business
Applications that parse untrusted XML may silently accept tampered data or bypass security checks, increasing the risk of data corruption or unauthorized actions without requiring direct code changes in the affected products.
How an attack unfolds
An attacker supplies specially crafted XML input to a parser that has not initialized Expat's hash salt; because srand is called without a strong seed, the attacker can pre-compute or guess the resulting hash values, forcing collisions that undermine any integrity or anti-tampering mechanisms built on top of the parser.
How to fix it
Update to a version of libexpat that enforces or documents safe use of XML_SetHashSalt with a non-zero seed; rebuild and redeploy all dependent packages on Ubuntu, Debian, and Android with the patched library; where source changes are possible, explicitly call XML_SetHashSalt with a cryptographically random value before parsing.
How to confirm the fix worked
Review application or library initialization code for the presence of XML_SetHashSalt calls with non-zero seeds; recompile test parsers with the updated library and confirm that identical malicious XML inputs now produce different hash behavior or are rejected; scan build artifacts for the vulnerable Expat version strings.
Typical attack path
- Identify a target application or service that uses libexpat without calling XML_SetHashSalt
- Craft malicious XML payloads designed to trigger hash collisions in the parser's internal tables
- Submit the payload over the network or via file upload to the affected parser
- Observe or force acceptance of tampered content that should have been rejected by integrity checks
How to detect it
Examine application logs and XML parser initialization traces for missing or zero-value salt configuration; look for repeated parsing of XML documents that would normally trigger integrity failures; review process startup for calls to srand without preceding entropy gathering in any Expat-dependent binary.
What your security team should do
- Prioritize patching libexpat in all server-side XML processing pipelines due to the network attack vector
- Add static analysis or dependency checks to ensure XML_SetHashSalt is invoked with a strong seed in new code
- Monitor EPSS and exploit maturity indicators for any future increase in observed exploitation attempts
The record
Expat, when used in a parser that has not called XML_SetHashSalt or passed it a seed of 0, makes it easier for context-dependent attackers to defeat cryptographic protection mechanisms via vectors involving use of the srand function.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Alpine:v3.2 | expat | 0 | 2.2.0-r0 |
| Alpine:v3.3 | expat | 0 | 2.2.0-r0 |
| Alpine:v3.4 | expat | 0 | 2.2.0-r0 |
| Debian:11 | expat | 0 | 2.1.1-3 |
| Debian:11 | libxmltok | 0 | No fix |
| Debian:12 | expat | 0 | 2.1.1-3 |
| Debian:12 | libxmltok | 0 | No fix |
| Debian:13 | expat | 0 | 2.1.1-3 |
| Debian:7 | expat | 0 | 2.1.0-1+deb7u4 |
| Debian:8 | expat | 0 | 2.1.0-6+deb8u3 |
| Mageia:5 | expat | 0 | 2.1.0-9.3.mga5 |
| SUSE:Linux Enterprise Desktop 12 SP1 | expat | 0 | 2.1.0-20.2 |
| SUSE:Linux Enterprise Desktop 12 SP2 | expat | 0 | 2.1.0-20.2 |
| SUSE:Linux Enterprise Server 11 SP4 | expat | 0 | 2.0.1-88.41.1 |
| SUSE:Linux Enterprise Server 12 SP1 | expat | 0 | 2.1.0-20.2 |
| SUSE:Linux Enterprise Server 12 SP2 | expat | 0 | 2.1.0-20.2 |
| SUSE:Linux Enterprise Server for Raspberry Pi 12 SP2 | expat | 0 | 2.1.0-20.2 |
| SUSE:Linux Enterprise Server for SAP Applications 11 SP4 | expat | 0 | 2.0.1-88.41.1 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP1 | expat | 0 | 2.1.0-20.2 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP2 | expat | 0 | 2.1.0-20.2 |
| SUSE:Linux Enterprise Software Development Kit 11 SP4 | expat | 0 | 2.0.1-88.41.1 |
| SUSE:Linux Enterprise Software Development Kit 12 SP1 | expat | 0 | 2.1.0-20.2 |
| SUSE:Linux Enterprise Software Development Kit 12 SP2 | expat | 0 | 2.1.0-20.2 |
| SUSE:Studio Onsite 1.3 | expat | 0 | 2.0.1-88.41.1 |
| Ubuntu:14.04:LTS | expat | 0 | 2.1.0-4ubuntu1.3 |
| Ubuntu:16.04:LTS | expat | 0 | 2.1.0-7ubuntu0.16.04.2 |
| Ubuntu:20.04:LTS | xmlrpc-c | 0 | No fix |
| Ubuntu:22.04:LTS | xmlrpc-c | 0 | No fix |
| Ubuntu:24.04:LTS | audacity | 0 | No fix |
| Ubuntu:24.04:LTS | xmlrpc-c | 0 | No fix |
| Ubuntu:Pro:14.04:LTS | vnc4 | 0 | No fix |
| Ubuntu:Pro:14.04:LTS | xmlrpc-c | 0 | No fix |
| Ubuntu:Pro:16.04:LTS | insighttoolkit | 0 | No fix |
| Ubuntu:Pro:16.04:LTS | vnc4 | 0 | No fix |
| Ubuntu:Pro:16.04:LTS | xmlrpc-c | 0 | No fix |
| Ubuntu:Pro:18.04:LTS | vnc4 | 0 | No fix |
| Ubuntu:Pro:18.04:LTS | xmlrpc-c | 0 | No fix |
| openSUSE:Tumbleweed | expat | 0 | 2.2.0-3.1 |
Related vulnerabilities
- CVE-2017-9233 XML External Entity vulnerability in libexpat 2.2.0 and earlier (Expat XML Parser… Also affects expat
- CVE-2016-4472 The overflow protection in Expat is removed by compilers with certain optimization… Also affects expat
- CVE-2016-0718 Expat allows context-dependent attackers to cause a denial of service (crash) or possibly… Also affects expat
- CVE-2024-50602 An issue was discovered in libexpat before 2.6.4. Also affects expat
- CVE-2024-45491 An issue was discovered in libexpat before 2.6.3. Also affects expat
- CVE-2024-45492 An issue was discovered in libexpat before 2.6.3. Also affects expat
- CVE-2024-45490 An issue was discovered in libexpat before 2.6.3. Also affects expat
- CVE-2024-28757 libexpat through 2.6.1 allows an XML Entity Expansion attack when there is isolated use… Also affects expat