SOAP (Medium)
- Challenge Link: https://play.picoctf.org/practice/challenge/376?category=1&difficulty=2&page=1
- Challenge Description: The web project was rushed and no security assessment was done. Can you read the /etc/passwd file?
- Hints:
- XML external entity Injection
Solution
After some quick googling, XML external entity injection (XXE) is a web security vulnerability that allows an attacker to interfere with an application's processing of XML data. Allows an attacker to view files on the application server filesystem and interact with any back-end or external systems that the application itself can access.
Some applications use the XML format to transmit data between the browser and the server. Applications that do this virtually always use a standard library or platform API to process the XML data on the server. XXE vulnerabilities arise because the XML specification contains various potentially dangerous features, and standard parsers support these dangerous features even if they are not normally used by the application.
The application performs no particular defenses against XXE attacks, so you can exploit the XXE vulnerability to retrieve the /etc/passwd file by submitting the following XXE payload:
On the website, one of the pages uses XML, we know this because we used BurpSuite to look at our request. Now we can try to modify our request to include the XXE injection:
<!DOCTYPE foo [ <!ENTITY xxe SYSTEM "/etc/passwd"> ]>
picoCTF{XML_3xtern@l_3nt1t1ty_55662c16}