Skip to content
XXE Write-up Advanced

CVE-2024-30043: Abusing URL Parsing Confusion to Exploit XXE on SharePoint Server and Cloud | Piotr Bazydło

An XXE vulnerability in SharePoint's BaseXmlDataSource allowed a low-privileged user to read files with the farm service account's permissions and perform SSRF. The flaw was that DTD prohibition was bypassed when a resolver was set, and a malformed URL confused SPXmlDataSource and XmlSecureResolver to grant unrestricted access.

zerodayinitiative.com

Published on zerodayinitiative.com

Yes, the title is right. This blog covers an XML eXternal Entity (XXE) injection vulnerability that I found in SharePoint.

The author, on zerodayinitiative.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 XML parser resolved parameter entities before enforcing DTD prohibition, and a URL parsing mismatch between SPXmlDataSource and XmlSecureResolver allowed an attacker to supply a malformed URL that granted unrestricted resolver permissions.

Impact

A low-privileged user could read files with the SharePoint Farm Service account permission, perform SSRF, NTLM relaying, and other side effects; the exploit worked on both on-prem and cloud instances.

What the attacker needed

A low-privileged SharePoint account; ability to upload files to a SharePoint site

The fix

Microsoft patched it by adding more URL parsing controls for SPXmlDataSource and making XmlTextReader also prohibit DTD usage.

How it was found

  1. Upload a malicious XML file to a SharePoint site.
  2. Create an SPXmlDataSource and set its DataFile to a malformed URL that points to the uploaded XML.
  3. The malformed URL causes XmlSecureResolver to create an unrestricted access policy.
  4. The XML is parsed and the XXE payload is executed, allowing file read or SSRF.

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 documents can include special instructions called DTDs that define entities, which are like variables. If an attacker can control an entity, they can make the XML parser fetch external resources, such as local files or URLs. This is called XXE. In this case, SharePoint's parser was supposed to block DTDs, but a coding mistake let some entities through, and a URL parsing confusion allowed full exploitation.

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.