[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

What is a CDATA injection attack?

  • From: "Costello, Roger L." <costello@mitre.org>
  • To: "xml-dev@lists.xml.org" <xml-dev@lists.xml.org>
  • Date: Wed, 22 Aug 2012 11:24:19 +0000

What is a CDATA injection attack?
Hi Folks,

Liam Quinn wrote:

> CDATA sections ... tend to be vectors for CDATA injection attacks.

What is a CDATA injection attack?

On the Open Web Application Security Project (OWASP) page [1] it has the following:

------------------------------------------------------------------------
Suppose we have a node containing some text that will be displayed back to the user.

<html>
 $HTMLCode
 </html>

Then, an attacker can provide the following input:

$HTMLCode = <![CDATA[<]]>script<![CDATA[>]]>alert('xss')<![CDATA[<]]>/script<![CDATA[>]]>

and obtain the following node:

<html>
  <![CDATA[<]]>script<![CDATA[>]]>alert('xss')<![CDATA[<]]>/script<![CDATA[>]]>
 </html>

During the processing, the CDATA section delimiters are eliminated, generating the following HTML code:

<script>alert('XSS')</script>

The result is that the application is vulnerable to XSS (Cross-site Scripting).
------------------------------------------------------------------------

Is that a CDATA injection attack?

It raises several questions:

1. Their description says, 

       During the processing, ...

During what processing? XML parsing? Their example looks like HTML so why would there be XML parsing?


2. In their example they used multiple CDATA sections. Why? Couldn't the same attack be obtained using just one:

$HTMLCode = <![CDATA[<script>alert('XSS')</script>]]>


3. Also, couldn't the same attack be obtained by simply escaping the < characters:

$HTMLCode = &lt;script>alert('XSS')&lt;/script>


4. If yes, then why is it called a CDATA attack?

/Roger

[1] https://www.owasp.org/index.php/Testing_for_XML_Injection_%28OWASP-DV-008%29


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.