XXE
Retrieve files
Introduce (or edit) a
DOCTYPE
element defining an external entity with the file path.Edit a data value in the XML returned in the app's response to use the defined external entity.
Note: to systematically test for XXE, test each data node in the XML individually using your defined entity to see if it appears in the response.
Original
Exploitation
Perform SSRF attacks
Blind XXE
Out-of-band (OAST) techniques
Detection
Detecting as SSRF
Regular entities are blocked? Bypass via XML parameter entities
This XXE payload declares an XML parameter entity called
xxe
and then uses the entity within the DTD
Exploitation
Start a web server and host on
http://attacker.com/example.dtd
this malicious dtd.
Add this external entity
Note: This technique might not work with multiline files.
Via error messages
Trigger an XML parsing error message with the file contents.
Note: This works if you notice an error in the response when detecting with OAST (e.g., the reflected URL entered).
Hidden attack surface
First case - Requests that contain data in XML format
Second case - Requests that do not contain any XML
Detection: Add entity reference that doesn't exist to cause an error -> ok it's XML
XInclude attacks
Some applications receive client-submitted data, embed it on the server-side into an XML document, and then parse the document.
XInclude
is a part of the XML specification that allows an XML document to be built from sub-documents.
Via file upload
Some common file formats use XML or contain XML subcomponents. Examples of XML-based formats are office document formats like DOCX and image formats like SVG.
This works if it's used image processing library & support SVG images & allow external entity.
Via modified content type
Some web app will tolerate other content types.
Expected request
Sumbit following request
Last updated