Solving Portswigger Academy: Exploiting XXE using external entities to retrieve files

Vishal
2 min readSep 24, 2024

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.

When you access the lab, you will see the below page.

The vulnerability is in check stock feature, so lets view details any application. When you clicked on view details, there is a Check Stock option.Click on it and see the request and response in burp.

Request containing XML and response

It is clear the application is using XML to fetch number of units, we can use XXE payload to exploit this. Send the request in repeater and will add XXE payload just before the starting of the tag.

First we test it at Product ID and after that in Store ID.

contents of /etc/passwd file using XXE

I also tested it in store id, but it did not work.

This is how we solved the lab.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response