Skip to content
XXE Write-up Intermediate

The Regex Said Safe. The Parser Disagreed. NASA’s Earth Science Platform Had a Critical Vulnerability.

A regex-based sanitizer failed to remove multi-line DOCTYPE declarations because the dot metacharacter does not match newlines, allowing XML external entity injection. An attacker could make the NASA server fetch external DTDs, leading to SSRF, cloud metadata exposure, internal service enumeration, blind file reads, and denial of service.

Dewank Pant Follow

Published on infosecwriteups.com

Every parser has an opinion about what input means. Every filter has a different opinion.

Dewank Pant, on infosecwriteups.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

The sanitizer used a regex where the dot did not match newlines, so multi-line DOCTYPE declarations bypassed removal, and the XML parser was not configured to disable external entity resolution.

Impact

The vulnerability allowed SSRF from production, out-of-band exfiltration of cloud metadata and local files, internal service enumeration, and denial of service; some tests were done on a local instance to avoid production impact.

What the attacker needed

No authentication required; Publicly reachable endpoint; Attacker-controlled server for DTD and callback

The fix

The fix was to use a secure SAX parser that disables external entity processing, with the regex change as defence-in-depth; the text states it was fixed and merged.

How it was found

  1. Send XML to the public AQL search endpoint.
  2. Use a multi-line DOCTYPE to bypass regex-based sanitization.
  3. Define an external parameter entity referencing an attacker-controlled DTD.
  4. Cause the XML parser to fetch the external DTD during parsing.
  5. Observe the outbound callback from NASA production infrastructure.
  6. Use the DTD to define a second entity that reads a local resource and delivers its contents as a URL parameter to a callback endpoint.

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 allows a document to define special 'entities' that pull in content from other places, including files or web addresses. If a server processes these without restrictions, an attacker can trick it into fetching internal resources or sending data out. Here, a filter tried to block the dangerous part but missed a version split across lines, so the server still processed it.

What is XXE?

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

More by Dewank Pant

View all

1 more disclosed report, best first.

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.