AMF parsing and XXE
The AMF parsing libraries BlazeDS and PyAMF were vulnerable to XML External Entity (XXE) injection, allowing an attacker to read local files and perform SSRF. The author demonstrated exploitation against a PyAMF gateway, a BlazeDS server, and a Java client (Burp Suite) using crafted AMF messages containing malicious XML.
Published on agarri.fr
I recently played with two libraries parsing the AMF (aka Action Message Format) binary format: BlazeDS and PyAMF. Both libraries were affected by XXE and SSRF vulnerabilities.
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
Impact
An attacker could read local files and perform SSRF, potentially leading to information disclosure and denial of service; in some setups, out-of-band exfiltration was possible.
What the attacker needed
Target runs vulnerable BlazeDS or PyAMF; attacker can send AMF messages to the target; for client-side, victim visits malicious page
How it was found
- Set up a PyAMF gateway with an echo service.
- Send an AMF message containing XML with an internal entity to confirm entity resolution.
- Send an AMF message with an external entity pointing to a local file to read it.
- For BlazeDS, send an AMF message with a parameter entity referencing an external DTD to leak files via error messages.
- For Burp Suite, host a malicious web page that loads an AMF response with a remote DTD to exfiltrate data out-of-band.
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.
XXE is a flaw where an application accepts XML input and processes special instructions called entities that can reference external files or URLs. Here, the AMF format (used for binary messaging) can carry XML, and the libraries parsed it without disabling these dangerous features. An attacker could send a crafted message to read files on the server or make the server send requests to internal systems.
What is XXE?
An XML parser resolves entities the attacker defines, reading local files or making the server send requests.