Home > CAPEC List > CAPEC-99: XML Parser Attack (Version 2.5)  

CAPEC-99: XML Parser Attack

 
XML Parser Attack
Definition in a New Window Definition in a New Window
Attack Pattern ID: 99
Abstraction: Standard
Status: Draft
Completeness: Complete
+ Description

Summary

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 unintended 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. [R.99.1]

Attack Execution Flow

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

Experiment
  1. 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 Severity

Medium

+ Typical Likelihood of Exploit

Likelihood: Medium

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

Description

"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 unsanitized 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" [R.99.2]

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

Description

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
ScopeTechnical ImpactNote
Availability
DoS: resource consumption (memory)
Denial of Service
Confidentiality
Read memory
Confidentiality
Integrity
Availability
Execute unauthorized code or commands
Run Arbitrary Code
Confidentiality
Access_Control
Authorization
Gain privileges / assume identity
+ Injection Vector

Application XML-compliant interface

+ Payload

User-controllable XML code

+ Activation Zone

The XML parser code.

+ Purposes
  • Penetration
  • Exploitation
+ CIA Impact
Confidentiality Impact: MediumIntegrity Impact: HighAvailability Impact: High
+ Technical Context
Architectural Paradigms
Client-Server
SOA
Frameworks
All
Platforms
All
Languages
All
+ References
[R.99.1] [REF-43] Shlomo, Yona. "XML Parser Attacks: A summary of ways to attack an XML Parser". What is an XML Parser Attack?. 2007. <http://yeda.cs.technion.ac.il/~yona/talks/xml_parser_attacks/slides/slide2.html>.
[R.99.2] GulfTech Security Research. "PHPXMLRPC Remote Code Execution". BugTraq Archive. June 29, 2005. <http://www.securityfocus.com/archive/1/403987>.
+ Content History
Submissions
SubmitterOrganizationDateComments
Sean BarnumCigital, Inc.2007-03-25Identified priority for pattern creation
Modifications
ModifierOrganizationDateCommentsSource
Evgeny LebanidzeCigital, Inc.,2007-03-21Fleshed out content for pattern
Sean BarnumCigital, Inc2007-04-16Review and revise
CAPEC Content TeamThe MITRE Corporation2013-06-21Updated Example-Instance_Description and SummaryInternal
CAPEC Content TeamThe MITRE Corporation2013-12-18Updated Description Summary, ReferencesInternal
CAPEC Content TeamThe MITRE Corporation2014-02-06Updated Attack_Phases, Description Summary, Examples-InstancesInternal

Page Last Updated: May 07, 2014