XML External Entity
XML external entity injection (also known as XXE) is a web security vulnerability that allows an attacker to interfere with an application's processing of XML data. It often allows an attacker to view files on the application server filesystem, and to interact with any back-end or external systems that the application itself can access.
Hunt for XXEs
- Find data entry points that you can use to submit XML data.
- Determine whether the entry point is a candidate for a classic or blind XXE. The endpoint might be vulnerable to classic XXE if it returns the parsed XML data in the HTTP response. If the endpoint does not return results, it might still be vulnerable to blind XXE, and you should set up a callback listener for your tests.
- Try out a few test payloads to see if the parser is improperly configured. In the case of classic XXEs, you can check whether the parser is processing external entities. In this case of blind XXEs, you can make the server send requests to your callback listener to see if you can trigger outbound interaction.
- If the XML parser has the functionalities that make it vulnerable to XXE attacks, try to exfiltrate a common system file, like
/etc/hostname. - You can also try to retrieve some more sensitive system files, like
/etc/shadowor.bash_history. - If you can exfiltrate the entire file with a simple XXE payload, try to use an alternative data exfiltration method.
- See if you can launch an SSRF attack using the XXE.