what you don't know can hurt you

Microsoft Windows Containers Privilege Escalation

Microsoft Windows Containers Privilege Escalation
Posted Mar 10, 2021
Authored by James Forshaw, Google Security Research

The standard user ContainerUser in a Windows Container has elevated privileges and High integrity level which results in making it administrator equivalent even though it should be a restricted user.

tags | exploit
systems | windows
advisories | CVE-2021-26891
SHA-256 | b317a2978a717df92a18c59b704df44df5773c6029128d2cc21c45a42ecce392

Microsoft Windows Containers Privilege Escalation

Change Mirror Download
Windows Containers: ContainerUser has Elevated Privileges

Windows Containers: ContainerUser has Elevated Privileges
Platform: Windows 10 20H2 (not tested other versions)
Class: Elevation of Privilege
Security Boundary: User

Summary:
The standard user ContainerUser in a Windows Container has elevated privileges and High integrity level which results in making it administrator equivalent even though it should be a restricted user.

Description:
Windows Containers setup two default user accounts, which are created by the CExecSvc service. The first user, ContainerAdministrator is a full administrator. The second user, ContainerUser you would assume is not supposed to be an administrator. However, both users are created as virtual service accounts, this results in ContainerUser being granted SeImpersonatePrivilege, SeCreateGlobalPrivilege and runs with a High integrity level.

At a minimum having SeImpersonatePrivilege is considered administrator equivalent. You can use public exploits such as RogueWinRM (https://github.com/antonioCoco/RogueWinRM) to get SYSTEM from ContainerUser, but I'm sure there are other techniques to do the same thing.

For example the following is the output from a ServerCore 20H2 image running in Hyper-V (but the container isolation doesn't seem to matter).

C:\\> ver
Microsoft Windows [Version 10.0.19042.685]

C:\\> whoami /groups /priv
GROUP INFORMATION
-----------------

Group Name Type SID Attributes
==================================== ================ ============ ==================================================
Mandatory Label\\High Mandatory Level Label S-1-16-12288
...

PRIVILEGES INFORMATION
----------------------
Privilege Name Description State
============================= ========================================= ========
SeChangeNotifyPrivilege Bypass traverse checking Enabled
SeImpersonatePrivilege Impersonate a client after authentication Enabled
SeCreateGlobalPrivilege Create global objects Enabled
SeIncreaseWorkingSetPrivilege Increase a process working set Disabled

The issue is as far as I understand it ContainerUser should not be administrator equivalent otherwise there seems little point to have two separate users. I'd recommend ensuring SeCreateGlobalPrivilege is also removed, while it's not as easy to exploit it could still provide a means of compromising the container. Also the CExecSvc looks to be code written and signed by Microsoft so I assume it's in scope as a Microsoft product.

Proof of Concept:

I just installed Docker Desktop on Windows 10 20H2. Then ran the command:
C:\\> docker run --user=ContainerUser -it mcr.microsoft.com/windows/servercore:20H2

Then in the container I ran the following command to display the user's details.
C:\\> whoami /groups /priv

Expected Result:
The ContainerUser does not have elevated privileges.

Observed Result:
The ContainerUser has SeImpersonatePrivilege.

This bug is subject to a 90 day disclosure deadline. After 90 days elapse,
the bug report will become visible to the public. The scheduled disclosure
date is 2021-03-14. Disclosure at an earlier date is also possible if
agreed upon by all parties.


Related CVE Numbers: CVE-2021-26891.



Found by: forshaw@google.com

Login or Register to add favorites

File Archive:

May 2022

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    May 1st
    0 Files
  • 2
    May 2nd
    15 Files
  • 3
    May 3rd
    19 Files
  • 4
    May 4th
    24 Files
  • 5
    May 5th
    15 Files
  • 6
    May 6th
    14 Files
  • 7
    May 7th
    0 Files
  • 8
    May 8th
    0 Files
  • 9
    May 9th
    13 Files
  • 10
    May 10th
    7 Files
  • 11
    May 11th
    99 Files
  • 12
    May 12th
    45 Files
  • 13
    May 13th
    7 Files
  • 14
    May 14th
    0 Files
  • 15
    May 15th
    0 Files
  • 16
    May 16th
    16 Files
  • 17
    May 17th
    26 Files
  • 18
    May 18th
    4 Files
  • 19
    May 19th
    17 Files
  • 20
    May 20th
    2 Files
  • 21
    May 21st
    0 Files
  • 22
    May 22nd
    0 Files
  • 23
    May 23rd
    6 Files
  • 24
    May 24th
    19 Files
  • 25
    May 25th
    5 Files
  • 26
    May 26th
    12 Files
  • 27
    May 27th
    12 Files
  • 28
    May 28th
    0 Files
  • 29
    May 29th
    0 Files
  • 30
    May 30th
    0 Files
  • 31
    May 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close