Technical Analysis of "CVE-2024-30043: Abusing URL Parsing Confusion to Exploit XXE on SharePoint Server and Cloud"

Overview:
The Zero Day Initiative’s write-up discusses CVE-2024-30043, a vulnerability discovered in SharePoint Server that leverages URL parsing confusion to exploit XML External Entity (XXE) vulnerabilities. The detailed analysis explains how the flaw arises, the technical means by which it can be exploited, and the potential impacts on both on-premises and cloud deployments of SharePoint.

Key Technical Details:

  1. URL Parsing Confusion:
    The vulnerability hinges on discrepancies in the way different components of SharePoint and the underlying libraries parse URLs. This inconsistency can be manipulated to bypass security mechanisms that are otherwise in place.

  2. Differing Parsers: URL parsing inconsistencies often happen when different components or libraries interpret the same URL in different ways, leading to unintended behavior. In this case, differences in parsing between URL validation logic and actual URL usage in SharePoint's XML processing infrastructure are exploited.

  3. Encoding Issues: Encoding schemes (like percent encoding) can further contribute to this disparity, enabling an attacker to craft URLs that appear benign to validation checks but are interpreted differently by parsers handling XML entities.

  4. XML External Entity (XXE) Vulnerability:
    XXE is a well-known attack vector where an attacker can influence XML data processing to access restricted resources or execute malicious actions. In the context of SharePoint:

  5. External DTDs: By manipulating XML data structures to include external entities, attackers can trick the XML parser into fetching arbitrary files or resources from the server or external sources.

  6. Data Exfiltration: These entities might be crafted to read sensitive files or send internal data to an external attacker-controlled server.

  7. Specific Exploitation Pathway:

  8. Upload Mechanism: The vulnerability focuses on the SharePoint document upload mechanisms. When users upload files, the server parses document metadata, which often involves XML processing.

  9. Manipulated Metadata: By embedding a crafted XML payload within a document's metadata that includes a malicious external entity, the attacker can exploit the discrepancy in URL parsing. This can cause the XML parser to resolve the external entity using the attacker's controlled URL.

  10. Real-World Exploitation & Impact:

  11. On-Premises Server Exploitation: For on-premises SharePoint installations, exploiting this vulnerability could allow attackers to read sensitive configuration files or exfiltrate data stored within the internal network.

  12. Cloud Configuration: In SharePoint Online, though direct access to the underlying server files might be limited, the attacker could still leverage XXE to read certain whitelisted internal configurations or perform SSRF (Server-Side Request Forgery) attacks.

  13. Example Payload: The typical attack payload might involve an XML structure like: xml <?xml version="1.0"?> <!DOCTYPE foo [ <!ELEMENT foo ANY > <!ENTITY xxe SYSTEM "file:///etc/passwd" >]> <foo>&xxe;</foo> This attempts to read the contents of /etc/passwd. Variations of this can be constructed to target specific configurations or internal endpoints.

Key Takeaways:

Mitigation Strategies:

Conclusion:

The write-up demonstrates a sophisticated exploitation technique leveraging URL parsing confusion to trigger XXE vulnerabilities in SharePoint. The attack underlines the importance of consistent parsing mechanisms and robust sanitization practices, particularly in web applications dealing with user-supplied data.

For full details, refer to the original blog post here.