XXE

CWE-611: Improper Restriction of XML External Entity Reference

There are various types of XXE attacks:

XXE Attack TypeDescription

Exploiting XXE to Retrieve Files

Where an external entity is defined containing the contents of a file, and returned in the application's response.

Exploiting XXE to Perform SSRF Attacks

Where an external entity is defined based on a URL to a back-end system.

Exploiting Blind XXE Exfiltrate Data Out-of-Band

Where sensitive data is transmitted from the application server to a system that the attacker controls.

Exploiting blind XXE to Retrieve Data Via Error Messages

Where the attacker can trigger a parsing error message containing sensitive data.

Methodology whitechaitai

  1. Convert the content type from "application/json"/"application/x-www-form-urlencoded" to "applcation/xml".

  2. File Uploads allows for docx/xlcs/pdf/zip , unzip the package and add your evil xml code into the xml files.

  3. If svg allowed in picture upload , you can inject xml in svgs.

  4. If the web app offers RSS feeds , add your milicious code into the RSS.

  5. Fuzz for /soap api , some applications still running soap apis

  6. If the target web app allows for SSO integration, you can inject your milicious xml code in the SAML request/reponse

Test Payload#

Using private External Entity#

<?xml version="1.0" ?>
<!DOCTYPE data [
<!ELEMENT data ANY >
<!ENTITY cat "Tom">
]>
<Contact>
<lastName>&cat;</lastName>
<firstName>Jerry</firstName>
</Contact>

Using a public External Entity#

<?xml version="1.0"?>
<!DOCTYPE data [
	<!ELEMENT data ANY >
	<!ENTITY cat SYSTEM "file:///etc/passwd">
]>
<Contact>
<lastName>&cat;</lastName>
<firstName>Jerry</firstName>
</Contact>

CDATA#

Top XXE reports from HackerOne:

  1. XXE on pulse.mail.ru to Mail.ru - 263 upvotes, $6000

  2. XXE on sms-be-vip.twitter.com in SXMP Processor to Twitter - 250 upvotes, $10080

  3. XXE on https://duckduckgo.com to DuckDuckGo - 209 upvotes, $0

  4. Phone Call to XXE via Interactive Voice Response to β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ - 170 upvotes, $0

  5. XXE in DoD website that may lead to RCE to U.S. Dept Of Defense - 89 upvotes, $0

  6. Blind XXE via Powerpoint files to Open-Xchange - 86 upvotes, $2000

  7. blind XXE in autodiscover parser to Mail.ru - 70 upvotes, $5000

  8. LFI and SSRF via XXE in emblem editor to Rockstar Games - 68 upvotes, $1500

  9. XXE Π½Π° webdav.mail.ru - PROPFIND/PROPPATCH to Mail.ru - 54 upvotes, $10000

  10. [rev-app.informatica.com] - XXE to Informatica - 44 upvotes, $0

  11. Authenticated XXE to WordPress - 39 upvotes, $600

  12. XML Parser Bug: XXE over which leads to RCE to drchrono - 32 upvotes, $700

  13. XXE on DoD web server to U.S. Dept Of Defense - 31 upvotes, $0

  14. [app.informaticaondemand.com] XXE to Informatica - 24 upvotes, $0

  15. Blind XXE on my.mail.ru to Mail.ru - 23 upvotes, $800

  16. XXE in upload file feature to Informatica - 21 upvotes, $0

Last updated