XXE’den SSRF’e: Sunucunun Gizli Dünyasına Adım Adım Sız�
The stock-check feature accepted XML input and resolved external entities, so an attacker could make the server fetch an internal cloud metadata address. By walking the metadata paths step by step, the attacker could read the cloud instance's access key, secret key and token.
Published on medium.com
Selamlar! Bugün PortSwigger Academy serüvenimin en öğretici ve “bulmaca” tadındaki lablarından birini birlikte çözeceğiz: “Exploiting XXE to perform SSRF attacks”.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the XML parser was left with external entity resolution enabled, so user-supplied XML could define an entity pointing at an internal URL that the server then fetched.
Impact
An attacker could read the cloud instance's temporary credentials, which may allow access to cloud resources depending on their permissions.
What the attacker needed
Access to the stock-check request; Burp Suite or similar proxy
The fix
External entity resolution should be disabled in the XML parser, and outbound requests from the server should be restricted.
How it was found
- Open a product page and use the Check Stock button while intercepting traffic in Burp Suite.
- Send the captured XML request to Repeater.
- Add a DOCTYPE with an external entity pointing at the cloud metadata address and place the entity in the productId field.
- Send the request and read the returned path segment from the error message.
- Append the next path segment to the entity URL and resend, repeating through meta-data, iam and security-credentials.
- Append the final segment to retrieve the access key, secret key and token.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Some web features accept XML, a structured text format. If the server is not configured carefully, it will follow special 'entity' references inside that XML and fetch whatever address they point to, even internal ones. Here that let the author make the server read its own cloud metadata, which holds temporary credentials.
What is XXE?
An XML parser resolves entities the attacker defines, reading local files or making the server send requests.