Skip to content
XXE Write-up Intermediate

The File That Answered Back — XXE Hidden in Cell A2

An unauthenticated Excel upload endpoint parsed XLSX files with external entity resolution enabled, allowing an attacker to read arbitrary files from the server. The attacker could retrieve files such as win.ini and hosts by placing an XXE payload inside the worksheet XML.

medium.com

Published on medium.com

Almost every asset was behind the same wall: Imperva, a web application firewall so common in enterprise deployments that you almost expect it now. On its own, a WAF isn’t an ending.

Alvin Ferdiansyah, 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 .NET XML parser used to process the uploaded XLSX had external entity resolution enabled by default, and the developer did not disable it.

Impact

An unauthenticated attacker could read arbitrary files from the server, though attempts to read web.config failed due to XML parsing errors and outbound connections were blocked by the load balancer.

What the attacker needed

None

The fix

The fix is to disable DTD processing and set XmlResolver to null in the XML parser settings, or use a hardened XLSX library, and add authentication to the upload endpoint.

How it was found

  1. Build a valid XLSX ZIP structure with five XML files, where sheet1.xml contains a DOCTYPE entity declaration targeting a local file.
  2. POST the crafted XLSX file to the CombineExcelUpload endpoint using multipart form data.
  3. Observe the JSON response containing the contents of the targeted file.

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.

An XLSX file is actually a ZIP archive containing XML files. If the server's XML parser is configured to allow external entities, an attacker can put a special instruction in the XML that tells the parser to read a local file and insert its contents into a cell. The server then returns that cell value in its response, leaking the file.

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.