This lab has a "Check stock" feature that parses XML input and returns any unexpected values in the response.
The lab server is running a (simulated) EC2 metadata endpoint at the default URL, which is http://169.254.169.254/. This endpoint can be used to retrieve data about the instance, some of which might be sensitive.
To solve the lab, exploit the XXE vulnerability to perform an that obtains the server's IAM secret access key from the EC2 metadata endpoint.
Approach
After accessing the lab, I quickly identified a POST request that sent XML data to the backend. Here's the request:
I attempted to exploit an XXE vulnerability by creating an external entity pointing to an internal system, http://169.254.169.254/. However, I encountered an unexpected response indicating an "Invalid product ID: latest".
The response revealed that the role name was 'admin'. By accessing http://169.254.169.254/latest/meta-data/iam/security-credentials/admin, I obtained valuable metadata:
By obtaining this information, I successfully solved the lab.
To proceed, I referred to an on exploiting AWS metadata endpoint SSRF vulnerabilities. It mentioned accessing http://169.254.169.254/latest/meta-data/iam/security-credentials/ to steal valid roles. Incorporating this into my payload, I crafted the following request: