Sitecore Experience Platform Pre-Auth RCE - CVE-2021-42237
An unauthenticated HTTP handler in Sitecore XP deserialised attacker-supplied XML using NetDataContractSerializer, allowing remote code execution. An attacker could send a crafted request to execute arbitrary commands on the server.
Published on blog.assetnote.io
The advisory for this issue can be found here.
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 Report.ashx handler passed unauthenticated user input to NetDataContractSerializer.ReadObject, which can instantiate arbitrary types and execute code via gadget chains.
Impact
An unauthenticated attacker could execute arbitrary commands on the server, leading to full compromise.
What the attacker needed
Network access to the Sitecore instance; No authentication required
The fix
The Report.ashx file should be removed from /sitecore/shell/ClientBin/Reporting/ as it is no longer used.
How it was found
- Send a POST request to /sitecore/shell/ClientBin/Reporting/Report.ashx with XML content.
- The XML contains a query element, a source element, and a parameters element with a parameter.
- The parameter value is a serialised .NET object generated by ysoserial using the NetDataContractSerializer formatter and TypeConfuseDelegate gadget.
- The server deserialises the object, triggering command execution.
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.
The web server had a file that accepted data from anyone without asking for a password. That file turned the data into live objects in the server's memory, and a malicious object could make the server run commands. This is called insecure deserialisation.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.