Cloudanix VulnDB

CVE-2017-9047

High · 7.5

CVSS

7.5

EPSS

3.2%

Published

May 18, 2017

CISA due date

—

Cloudanix analysis

Next patch cycle SSVC: Track

A bug in a widely used library for reading XML data lets attackers send specially formatted information that crashes the programs using it.

Exploit Available
Exploitation
Remote Unauthenticated
Attacker needs
None
Complexity
Low
Impact
Denial Of Service
Component
Library
Class
Memory Corruption
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

Out-of-bounds write in xmlSnprintfElementContent due to stale length variable after prefix append, enabling writes beyond the allocated buffer and resulting in memory corruption that manifests as application crashes.

Why it matters to the business

Applications relying on the affected XML library experience denial-of-service conditions when processing attacker-supplied content, leading to service outages and potential loss of availability for dependent systems; the issue remains unpatched in some long-lived deployments given the age of the disclosure.

How an attack unfolds

An attacker crafts an XML document containing an element content definition of type ELEMENT with a prefix and name chosen to trigger the length miscalculation. The malformed XML is fed to any libxml2 consumer (such as PHP parsers) that invokes validation routines, causing the buffer overflow and immediate crash.

How to fix it

Upgrade libxml2 to a version containing the corrected length recalculation in valid.c; rebuild and redeploy all dependent applications; where immediate patching is impossible, restrict untrusted XML input or employ input sanitization gateways.

How to confirm the fix worked

Confirm the installed libxml2 binary or source no longer contains the original xmlSnprintfElementContent logic that reuses the pre-append 'len' value; run regression tests with crafted XML element content definitions and verify absence of crashes.

Typical attack path

  1. Identify a network-accessible service that parses untrusted XML using libxml2
  2. Submit a specially constructed XML document triggering the element-content path in xmlSnprintfElementContent
  3. Trigger the stale-length check to write beyond the buffer bounds
  4. Observe process crash and denial of service

How to detect it

Review application and library logs for segmentation faults or abrupt process termination during XML parsing; correlate with inbound XML requests containing element declarations; examine core dumps or crash reports referencing valid.c for evidence of prior exploitation.

What your security team should do

  • Prioritize patching libxml2 across all environments given the public exploit availability and high availability impact
  • Inventory all products that statically or dynamically link libxml2 and schedule upgrades
  • Implement network or application-layer controls to block untrusted XML until patches are applied
  • Update vulnerability management dashboards with the 2017 disclosure date and current exploit maturity

The record

A buffer overflow was discovered in libxml2 20904-GITv2.9.4-16-g0741801. The function xmlSnprintfElementContent in valid.c is supposed to recursively dump the element content definition into a char buffer 'buf' of size 'size'. The variable len is assigned strlen(buf). If the content->type is XML_ELEMENT_CONTENT_ELEMENT, then (i) the content->prefix is appended to buf (if it actually fits) whereupon (ii) content->name is written to the buffer. However, the check for whether the content->name actually fits also uses 'len' rather than the updated buffer length strlen(buf). This allows us to write about "size" many bytes beyond the allocated memory. This vulnerability causes programs that use libxml2, such as PHP, to crash.

Affected packages

Ecosystem Package Introduced Fixed
Debian:11 libxml2 0 2.9.4+dfsg1-3.1
Debian:12 libxml2 0 2.9.4+dfsg1-3.1
Debian:13 libxml2 0 2.9.4+dfsg1-3.1
Debian:14 libxml2 0 2.9.4+dfsg1-3.1
Debian:7 libxml2 0 2.8.0+dfsg1-7+wheezy8
Debian:8 libxml2 0 2.9.1+dfsg1-5+deb8u5
Debian:9 libxml2 0 2.9.4+dfsg1-2.2+deb9u1
Mageia:5 libxml2 0 2.9.7-1.mga5
Mageia:5 perl-XML-LibXML 0 2.12.100-1.2.mga5
SUSE:Linux Enterprise Desktop 12 SP2 libxml2 0 2.9.4-36.1
SUSE:Linux Enterprise Desktop 12 SP2 libxml2 0 2.9.4-39.2
SUSE:Linux Enterprise Desktop 12 SP2 python-libxml2 0 2.9.4-36.1
SUSE:Linux Enterprise Desktop 12 SP2 python-libxml2 0 2.9.4-39.2
SUSE:Linux Enterprise Point of Sale 11 SP3 libxml2 0 2.7.6-0.69.1
SUSE:Linux Enterprise Point of Sale 11 SP3 libxml2-python 0 2.7.6-0.69.3
SUSE:Linux Enterprise Server 11 SP3-LTSS libxml2 0 2.7.6-0.69.1
SUSE:Linux Enterprise Server 11 SP3-LTSS libxml2-python 0 2.7.6-0.69.3
SUSE:Linux Enterprise Server 11 SP3-TERADATA libxml2 0 2.7.6-0.69.1
SUSE:Linux Enterprise Server 11 SP3-TERADATA libxml2-python 0 2.7.6-0.69.3
SUSE:Linux Enterprise Server 11 SP4 libxml2 0 2.7.6-0.69.1
SUSE:Linux Enterprise Server 11 SP4 libxml2-python 0 2.7.6-0.69.3
SUSE:Linux Enterprise Server 12 SP1-LTSS libxml2 0 2.9.1-26.15.1
SUSE:Linux Enterprise Server 12 SP1-LTSS python-libxml2 0 2.9.1-26.15.1
SUSE:Linux Enterprise Server 12 SP2 libxml2 0 2.9.4-36.1
SUSE:Linux Enterprise Server 12 SP2 libxml2 0 2.9.4-39.2
SUSE:Linux Enterprise Server 12 SP2 python-libxml2 0 2.9.4-36.1
SUSE:Linux Enterprise Server 12 SP2 python-libxml2 0 2.9.4-39.2
SUSE:Linux Enterprise Server 12-LTSS libxml2 0 2.9.1-26.15.1
SUSE:Linux Enterprise Server 12-LTSS python-libxml2 0 2.9.1-26.15.1
SUSE:Linux Enterprise Server for Raspberry Pi 12 SP2 libxml2 0 2.9.4-36.1
SUSE:Linux Enterprise Server for Raspberry Pi 12 SP2 libxml2 0 2.9.4-39.2
SUSE:Linux Enterprise Server for Raspberry Pi 12 SP2 python-libxml2 0 2.9.4-36.1
SUSE:Linux Enterprise Server for Raspberry Pi 12 SP2 python-libxml2 0 2.9.4-39.2
SUSE:Linux Enterprise Server for SAP Applications 11 SP4 libxml2 0 2.7.6-0.69.1
SUSE:Linux Enterprise Server for SAP Applications 11 SP4 libxml2-python 0 2.7.6-0.69.3
SUSE:Linux Enterprise Server for SAP Applications 12 libxml2 0 2.9.1-26.15.1
SUSE:Linux Enterprise Server for SAP Applications 12 python-libxml2 0 2.9.1-26.15.1
SUSE:Linux Enterprise Server for SAP Applications 12 SP1 libxml2 0 2.9.1-26.15.1
SUSE:Linux Enterprise Server for SAP Applications 12 SP1 python-libxml2 0 2.9.1-26.15.1
SUSE:Linux Enterprise Server for SAP Applications 12 SP2 libxml2 0 2.9.4-36.1
SUSE:Linux Enterprise Server for SAP Applications 12 SP2 libxml2 0 2.9.4-39.2
SUSE:Linux Enterprise Server for SAP Applications 12 SP2 python-libxml2 0 2.9.4-36.1
SUSE:Linux Enterprise Server for SAP Applications 12 SP2 python-libxml2 0 2.9.4-39.2
SUSE:Linux Enterprise Software Development Kit 11 SP4 libxml2 0 2.7.6-0.69.1
SUSE:Linux Enterprise Software Development Kit 12 SP2 libxml2 0 2.9.4-36.1
SUSE:Linux Enterprise Software Development Kit 12 SP2 libxml2 0 2.9.4-39.2
Ubuntu:14.04:LTS libxml2 0 2.9.1+dfsg1-3ubuntu4.10
Ubuntu:16.04:LTS libxml2 0 2.9.3+dfsg1-1ubuntu0.3
nuget libxml2 2.9.4 No fix
openSUSE:Tumbleweed libxml2 0 2.9.12-1.2

Related vulnerabilities