CVE-2018-8819
The web application accepted an X-Wap-Profile header and fetched an attacker-controlled XML file, which was parsed with external entity processing enabled. This allowed an attacker to read local files from the server and exfiltrate them to a remote FTP server.
I like to do bug bounties from time to time. Mostly when I am sacrificing sleep once the kids are finally out cold and this seemed like a worthy experience to document.
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 configured to process external entities and the application fetched untrusted URLs from the X-Wap-Profile header without validation.
Impact
An unauthenticated attacker could read local files from the server and exfiltrate them to a remote server.
What the attacker needed
Network access to the target; attacker-controlled server for hosting XML and DTD; attacker-controlled FTP server for exfiltration
The fix
The application should not fetch untrusted URLs from the X-Wap-Profile header and should disable external entity processing in its XML parser.
How it was found
- Add an X-Wap-Profile header pointing to an attacker-hosted XML file.
- The application fetches the XML file from the attacker's server.
- The XML file references an external DTD hosted on the attacker's server.
- The application fetches and parses the DTD, which defines an external entity.
- The entity causes the application to read a local file and send it to an attacker-controlled FTP server.
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.
The application trusted a special header that tells it where to find a device profile. It fetched that file from an attacker's server and processed it in a way that allowed the attacker to include instructions to read local files and send them out.
What is XXE?
An XML parser resolves entities the attacker defines, reading local files or making the server send requests.