CVE-2021-31181

8.8 HIGH

📋 TL;DR

CVE-2021-31181 is a remote code execution vulnerability in Microsoft SharePoint Server that allows attackers to execute arbitrary code on affected systems by exploiting improper control of generation of code ('Code Injection'). This affects organizations running vulnerable SharePoint Server versions, potentially enabling complete system compromise.

💻 Affected Systems

Products:
  • Microsoft SharePoint Server
  • Microsoft SharePoint Foundation
Versions: SharePoint Server 2019, SharePoint Server 2016, SharePoint Server 2013 SP1
Operating Systems: Windows Server
Default Config Vulnerable: ⚠️ Yes
Notes: Affects SharePoint Server installations with default configurations. SharePoint Online is not affected.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete compromise of the SharePoint server, allowing attackers to execute arbitrary code with SYSTEM privileges, steal sensitive data, install malware, and pivot to other internal systems.

🟠

Likely Case

Attackers gain initial foothold on the SharePoint server, potentially accessing sensitive documents and user data, and establishing persistence for further attacks.

🟢

If Mitigated

With proper network segmentation, least privilege, and monitoring, impact is limited to the SharePoint application tier with minimal lateral movement potential.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires authentication to SharePoint, but multiple public proof-of-concept examples exist demonstrating the vulnerability.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: May 2021 Security Updates

Vendor Advisory: https://portal.msrc.microsoft.com/en-US/security-guidance/advisory/CVE-2021-31181

Restart Required: Yes

Instructions:

1. Apply the May 2021 security updates for SharePoint Server from Microsoft Update. 2. Restart the SharePoint server. 3. Verify the update was successfully installed.

🔧 Temporary Workarounds

Disable custom controls

windows

Restrict or disable unsafe custom controls in SharePoint to prevent exploitation vectors

🧯 If You Can't Patch

  • Implement strict network segmentation to isolate SharePoint servers from critical systems
  • Enforce strong authentication requirements and monitor for suspicious SharePoint activity

🔍 How to Verify

Check if Vulnerable:

Check SharePoint Server version and compare against patched versions. Unpatched versions prior to May 2021 updates are vulnerable.

Check Version:

Get-SPFarm | Select BuildVersion

Verify Fix Applied:

Verify that the May 2021 security updates for SharePoint are installed via Windows Update history or PowerShell Get-HotFix

📡 Detection & Monitoring

Log Indicators:

  • Unusual SharePoint control execution events
  • Suspicious PowerShell or command execution from SharePoint processes
  • Unexpected ViewState manipulation attempts

Network Indicators:

  • Unusual outbound connections from SharePoint servers
  • Suspicious HTTP requests to SharePoint with crafted parameters

SIEM Query:

source="SharePoint" AND (event_id=6398 OR event_id=6399) AND (process_execution OR command_injection)

🔗 References

📤 Share & Export