CVE-2021-31165

7.8 HIGH

📋 TL;DR

This vulnerability allows an authenticated attacker to escalate privileges on Windows systems by exploiting a flaw in the Container Manager Service. Attackers can gain SYSTEM-level access by sending specially crafted RPC calls. It affects Windows 10 and Windows Server systems with the Container feature enabled.

💻 Affected Systems

Products:
  • Windows 10
  • Windows Server 2019
  • Windows Server 2022
Versions: Windows 10 versions 1809, 1909, 2004, 20H2, 21H1; Windows Server 2019; Windows Server 2022
Operating Systems: Windows
Default Config Vulnerable: ✅ No
Notes: Only vulnerable if Windows Containers feature is installed/enabled. Many standard Windows installations do not have this feature by default.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full SYSTEM-level compromise of the host, allowing complete control over the system, installation of malware, credential theft, and lateral movement across the network.

🟠

Likely Case

Privilege escalation from a standard user or service account to SYSTEM, enabling persistence, data exfiltration, and further exploitation of the compromised system.

🟢

If Mitigated

Limited impact if proper network segmentation, least privilege principles, and endpoint protection are in place, though local privilege escalation remains possible.

🌐 Internet-Facing: LOW - Exploitation requires authenticated access to the target system, making direct internet exploitation unlikely without prior compromise.
🏢 Internal Only: HIGH - Once an attacker gains initial access to a vulnerable system (through phishing, credential theft, etc.), they can exploit this to gain full control.

🎯 Exploit Status

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

Public proof-of-concept code exists on Packet Storm. Exploitation requires authenticated access but is relatively straightforward once access is obtained.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: May 2021 security updates (KB5003173 for Windows 10 20H2, KB5003197 for Windows 10 2004, etc.)

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

Restart Required: Yes

Instructions:

1. Apply the May 2021 Windows security updates from Microsoft. 2. Restart the system. 3. Verify the update is installed via Windows Update history or system information.

🔧 Temporary Workarounds

Disable Windows Containers feature

windows

Remove or disable the Container Manager Service if not required for operations

Disable-WindowsOptionalFeature -Online -FeatureName Containers
Restart-Computer

Restrict RPC access

windows

Use Windows Firewall to block unnecessary RPC traffic to the Container Manager Service

New-NetFirewallRule -DisplayName "Block Container Manager RPC" -Direction Inbound -Protocol TCP -LocalPort 135 -Action Block

🧯 If You Can't Patch

  • Implement strict network segmentation to isolate systems with Windows Containers enabled
  • Enforce least privilege principles and monitor for unusual privilege escalation attempts

🔍 How to Verify

Check if Vulnerable:

Check if Windows Containers feature is installed: Get-WindowsOptionalFeature -Online -FeatureName Containers | Select-Object State

Check Version:

systeminfo | findstr /B /C:"OS Name" /C:"OS Version"

Verify Fix Applied:

Verify May 2021 security updates are installed: Get-HotFix | Where-Object {$_.HotFixID -like "KB5003*"}

📡 Detection & Monitoring

Log Indicators:

  • Unusual RPC calls to Container Manager Service (CmsRpcSrv)
  • Process creation with SYSTEM privileges from non-SYSTEM accounts
  • Event ID 4688 with elevated privileges

Network Indicators:

  • RPC traffic to port 135/TCP associated with Container Manager Service from unexpected sources

SIEM Query:

EventID=4688 AND NewProcessName="*" AND SubjectUserName!="SYSTEM" AND TokenElevationType="%%1938"

🔗 References

📤 Share & Export