Skip to content
XXE Write-up Beginner

How Secure is Java’s SecureProcessing?

The SecureProcessing flag in Java's XML parser does not prevent XXE attacks, as demonstrated by a Spring Boot endpoint that still reads local files after enabling the flag. An attacker could exploit this to read arbitrary files from the server.

dub-flow Follow

Published on medium.com

If you’ve ever worked with secure XML parsing in Java (to prevent XXE Injections), you probably have come across an XML parser flag named SecureProcessing and thought “Huh, that sounds useful”. But soon after, you were wondering what this flag actually does and, most importantly, if it actually secures your XML parser…

Florian Walter, on medium.com

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 SecureProcessing feature only limits some resource usage (like entity expansion) but does not disable external entity resolution, which is the core of XXE.

What the attacker needed

Java XML parser with SecureProcessing enabled; endpoint that parses user-supplied XML

The fix

The parser should be configured according to the OWASP XXE prevention cheat sheet, which includes disabling external entities and DTDs.

How it was found

  1. Create a Spring Boot endpoint that parses XML input and returns it as a string.
  2. Send an XXE payload that references an external entity pointing to /etc/passwd.
  3. Observe that the file contents are returned in the response.
  4. Enable SecureProcessing on the DocumentBuilderFactory.
  5. Send the same XXE payload again and observe that it still works.

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 parsers can be tricked into reading local files or making network requests, which is called XXE. A setting called SecureProcessing sounds like it should stop this, but the author shows it does not for file reading. You need to use specific parser settings recommended by OWASP instead.

What is XXE?

An XML parser resolves entities the attacker defines, reading local files or making the server send requests.

Similar reports

View all

Same bug class and techniques, clearest first.

XML external entities (XXE)

The lesson behind this report.

An XML parser resolves entities the attacker defines, reading local files or making the server send requests.