XML Parser Attack
Attack Pattern ID: 99 (Standard Attack Pattern Completeness: Complete)Typical Severity: MediumStatus: Draft
+ Description


Applications often need to transform data in and out of the XML format by using an XML parser. It may be possible for an attacker to inject data that may have an adverse effect on the XML parser when it is being processed. These adverse effects may include the parser crashing, consuming too much of a resource, executing too slowly, executing code supplied by an attacker, allowing usage of unintenteded system functionality, etc. An attacker's goal is to leverage parser failure to his or her advantage. In some cases it may be possible to jump from the data plane to the control plane via bad data being passed to an XML parser [1].

Attack Execution Flow

  1. An attacker determines the input data stream that is being processed by an XML parser on the server side.

  2. An attacker crafts input data that may have an adverse effect on the operation of the XML parser when the data is parsed on the server.

+ Attack Prerequisites

An application uses an XML parser to perform transformation on user-controllable data.

An application does not perform sufficient validation to ensure that user-controllable data is safe for an XML parser.

+ Typical Likelihood of Exploit

Likelihood: Medium

+ Methods of Attack
  • Injection
  • API Abuse
+ Examples-Instances


"PHPXMLRPC aka XML-RPC For PHP is a PHP implementation of the XML-RPC web RPC protocol, and was originally developed by Edd Dumbill of Useful Information Company. As of the 1.0 stable release, the project has been opened to wider involvement and moved to SourceForge. PHPXMLRPC is used in a large number of popular web applications such as PostNuke, Drupal, b2evolution, and TikiWiki. Unfortunately PHPXMLRPC is vulnerable to a remote php code execution vulnerability that may be exploited by an attacker to compromise a vulnerable system.

Remote Command Execution:

PHPXMLRPC is vulnerable to a very high risk remote php code execution vulnerability that may allow for an attacker to compromise a vulnerable webserver. The vulnerability is the result of unsanatized data being passed directly into an eval() call in the parseRequest() function of the XMLRPC server.

By creating an XML file that uses single quotes to escape into the eval() call an attacker can easily execute php code on the target server. This has a lot to do with the fact that magic_quotes_gpc() does not apply to $HTTP_RAW_POST_DATA so using single quotes is not a problem" [2].

Reference: GulfTech Security Research"PHPXMLRPC Remote Code Execution", SecurePoint - BugTraq Archive: "http://msgs.securepoint.com/bugtraq"

Related Vulnerabilities


+ Attacker Skills or Knowledge Required

Skill or Knowledge Level: Low

Denial of service (making the parser crash)

Skill or Knowledge Level: High

Arbitrary code execution

+ Indicators-Warnings of Attack

Bad data is continuously passed to the XML parser, possibly making it crash.

+ Solutions and Mitigations

Carefully validate and sanitize all user-controllable data prior to passing it to the XML parser routine. Ensure that the resultant data is safe to pass to the XML parser.

Perform validation on canonical data.

Pick a robust implementation of an XML parser.

Validate XML against a valid schema or DTD prior to parsing.

+ Attack Motivation-Consequences
  • Denial of Service
  • Information Leakage
  • Run Arbitrary Code
  • Privilege Escalation
+ Injection Vector

Application XML-compliant interface

+ Payload

User-controllable XML code

+ Activation Zone

The XML parser code.

+ Related Weaknesses
CWE-IDWeakness NameWeakness Relationship Type
112Missing XML ValidationTargeted
20Improper Input ValidationTargeted
19Data HandlingTargeted
674Uncontrolled RecursionTargeted
770Allocation of Resources Without Limits or ThrottlingTargeted
+ Related Attack Patterns
NatureTypeIDNameDescriptionView(s) this relationship pertains toView\(s\)
ChildOfAttack PatternAttack Pattern82Violating Implicit Assumptions Regarding XML Content (aka XML Denial of Service (XDoS)) 
Mechanism of Attack (primary)1000
ParentOfAttack PatternAttack Pattern230Recursive Payloads Sent to XML Parsers 
Mechanism of Attack (primary)1000
ParentOfAttack PatternAttack Pattern231Oversized Payloads Sent to XML Parsers 
Mechanism of Attack (primary)1000
+ Purposes
  • Penetration
  • Exploitation
+ CIA Impact
Confidentiality Impact: MediumIntegrity Impact: HighAvailability Impact: High
+ Technical Context
Architectural Paradigms
+ References
GulfTech Security Research. "PHPXMLRPC Remote Code Execution". SecurePoint. <http://msgs.securepoint.com/bugtraq>.
+ Content History
Sean BarnumCigital, Inc.2007-03-25Identified priority for pattern creation
Evgeny LebanidzeCigital, Inc.,2007-03-21Fleshed out content for pattern
Sean BarnumCigital, Inc2007-04-16Review and revise