Lab: Exploiting XXE using external entities to retrieve files


This lab has a "Check stock" feature that parses XML input and returns any unexpected values in the response.

To solve the lab, inject an XML external entity to retrieve the contents of the /etc/passwd file.


  1. Visit a product page, click "Check stock", and intercept the resulting POST request in Burp Suite.
  2. Insert the following external entity definition in between the XML declaration and the stockCheck element:

    <!DOCTYPE test [ <!ENTITY xxe SYSTEM "file:///etc/passwd"> ]>
  3. Replace the productId number with a reference to the external entity: &xxe;. The response should contain "Invalid product ID:" followed by the contents of the /etc/passwd file.

Community solutions

Michael Sommer (no audio)