CVE-2019-0604: Details of a Microsoft SharePoint RCE Vulnerability
A SharePoint method deserialised attacker-controlled data using XmlSerializer with a controllable expected type, allowing code execution. An attacker could send a crafted request to the Picker.aspx page to run code as the SharePoint application pool and farm account.
zerodayinitiative.com
Published on zerodayinitiative.com
When searching for new vulnerabilities, one approach is the bottom-up approach. It describes the approach of looking for an interesting sink and tracing the control and data flow backwards to find out if the sink can be reached.
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 EntityInstanceIdEncoder.DecodeEntityInstanceId method called XmlSerializer with a type name taken from user input, so the expected type could be controlled and a malicious object graph deserialised.
Impact
An attacker could execute arbitrary code in the context of the SharePoint application pool and the SharePoint server farm account; the original patch did not cover a second copy of the vulnerable type, so the exploit still worked after patching until Microsoft re-released the fix.
What the attacker needed
Access to the SharePoint site; ability to send a crafted request to Picker.aspx
How it was found
- Find a call to XmlSerializer(Type) where the expected type is not hard-coded.
- Trace the call back to EntityInstanceIdEncoder.DecodeEntityInstanceId and its encodedId argument.
- Follow the call chain to ItemPicker.ValidateEntity, EntityEditor.Validate and EntityEditor.LoadPostData.
- Identify that the hiddenSpanData form field controls the PickerEntity Key value.
- Locate the Picker.aspx page and choose an ItemPickerDialog type via the PickerDialogType parameter.
- Submit the form with a hiddenSpanData value beginning with two underscores to reach the sink.
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.
SharePoint is a Microsoft web application for documents and collaboration. A part of it took data from a web form and turned it back into an object without checking what kind of object it was, so an attacker could make it create a harmful object that runs commands. The attacker only needed to send a specially crafted web request.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.