An attack vector on Santuario
Apache Santuario's XML signature processing dereferences file and HTTP URIs in KeyInfoReference and RetrievalMethod elements before signature validation, and a secureValidation bypass (CVE-2021-40690) allows this even when the protection is enabled. An attacker could read local XML files via an XPath timing oracle or exception messages, leading to information disclosure in products like PingFederate.
Apache Santuario, commonly known as Apache XML Security, is a widely used library to handle XML Digital Signature and XML Encryption. It's also one of the few external libraries bundled in the JDK under the repackaged com.sun namespace.
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 secureValidation flag is not propagated to the new KeyInfoReference object, leaving it disabled by default, and URI dereferencing occurs before signature verification.
Impact
An attacker could read local XML files, potentially leaking sensitive configuration and credentials, though the attack requires the target file to be valid XML and may be limited by application-specific defences.
What the attacker needed
Ability to send crafted XML to the target; target uses vulnerable Santuario or PingFederate; target file must be valid XML
The fix
The vulnerability was fixed in Santuario 2.2.3 and 2.1.7, and PingFederate released patches; users should upgrade.
How it was found
- Craft an XML message with a KeyInfoReference element pointing to a KeyInfo containing a RetrievalMethod with a file URI.
- Include a Transform with XPath or XSLT that conditionally causes a delay or exception based on the file content.
- Send the message to the vulnerable application (e.g., PingFederate) and observe timing or error responses to infer file contents.
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.
XML digital signatures can include references to external resources, and the library fetches them. A flaw let attackers make the library read local files without proper checks, and then leak their contents through error messages or timing. This could expose sensitive configuration data.
What is XXE?
An XML parser resolves entities the attacker defines, reading local files or making the server send requests.