10 Years of Windows Privilege Escalation With Potatoes
10 Years of Windows Privilege Escalation With Potatoes
with Potatoes
Antonio Cocomazzi Andrea Pierini
Staff Offensive Security Researcher, SentinelOne Sr. Security Consultant, Semperis
Whoami
➔ Offensive Security Researcher @
SentinelOne
➔ Independent vulnerability
researcher
@splinter_code
Kernel
Protected Process
NT AUTHORITY\SYSTEM
Administrator
Windows Service
Hardening
User Account Control
Standard User
Anonymous
Layered Security model in Windows
Kernel
Protected Process
Not a Security Boundary
Reward: Swag Points
NT AUTHORITY\SYSTEM
Not a Security Boundary
??? “Safety Boundary” ???
Reward: Swag Points Administrator
Windows Service
Hardening
Security Boundary
User Account Control
Reward: 2k$
Standard User
Security Boundary
Reward: 20k$ (sometimes)
Sandbox (AppContainer, LPAC, Capabilities…)
Anonymous
Layered Security model in Windows
Kernel
Protected Process
NT AUTHORITY\SYSTEM
Not a Security Boundary
??? “Safety Boundary” ???
Reward: Swag Points Administrator
Windows Service
Hardening
Security Boundary
User Account Control
Reward: 2k$
Standard User
This talk
Sandbox (AppContainer, LPAC, Capabilities…)
This talk
Anonymous
Where it all began
CVE-2015-2370 - DCOM DCE/RPC Local NTLM Reflection Elevation of Privilege
https://bugs.chromium.org/p/project-zero/issues/detail?id=325
CVE-2015-2370 - Attack flow
Attacker NTLM
☠
Reflection
OLE Packager
Trigger DCOM
IObjectExporter::ResolveOxid2()
CVE-2015-2370 - Microsoft Fix
Attacker NTLM
☠
Reflection
OLE Packager
Trigger DCOM
IObjectExporter::ResolveOxid2()
The RPC/DCOM trigger
➔ It abuses the standard COM marshalling
➔ Craft a malicious OBJREF_STANDARD marshalled interface
➔ The malicious marshalled object contains the address+port of an
attacker controller RPC server as the Oxid Resolver address
➔ Oxid Resolution is needed for locating the binding information
of the COM object. This needs to be authenticated.
➔ Use CoGetInstanceFromIStorage to perform the resolution in the
security context of a privileged service. (DCOM activation)
➔ Privileged Oxid Resolution occurs from
IObjectExporter::ResolveOxid2() -> privileged authentication
comes to the attacker -> Profit!
➔ Use the NTLM for reflection back to the local SMB service
☹
Windows Service Hardening (WSH)
➔ Limited Service Accounts
◆ Introduction of the LOCAL SERVICE and NETWORK SERVICE accounts, less
privileges than SYSTEM account.
➔ Reduced Privileges
◆ Services run only with specified privileges (least privilege)
➔ Write-Restricted Token
➔ Per-Service SID
◆ Service access token has dedicated and unique owner SID. No SID
sharing across different services
➔ Session 0 Isolation
➔ System Integrity Level
➔ UIPI (User interface privilege isolation)
https://www.tiraniddo.dev/2020/01/empirically-assessing-windows-service.html
https://downloads.immunityinc.com/infiltrate-archives/WindowsServicesHacking.pdf
From Service -> SYSTEM
RottenPotato
➔ Released by @breenmachine and @vvalien1 in Sep 2016
➔ First potato exploit which leverages the DCOM trigger
with the Impersonation privileges.
➔ Use fixed BITS CLSID to trigger a SYSTEM auth
➔ Use fixed 6666 port for the relay server
➔ Relay to local Oxid Resolver (port 135) and perform a
MITM:
◆ Intercept NTLM SSP exchange and negotiate a SYSTEM token
➔ Initially designed to be run through
incognito+meterpreter shell
https://foxglovesecurity.com/2016/09/26/rotten-potato-privilege-escalation-from-service-accounts-to-system/
https://www.youtube.com/watch?v=8Wjs__mWOKI
JuicyPotato (abusing the golden privileges)
➔ Released by @decoder_it and @Giutro in Aug 2018
https://decoder.cloud/2018/08/10/juicy-potato/
https://github.com/ohpe/juicy-potato
Demo 1 - JuicyPotato
JuicyPotato - the silent fix
~4 Years
~8 Years
https://decoder.cloud/2018/10/29/no-more-rotten-juicy-potato/
https://twitter.com/decoder_it/status/1493916092493877248
JuicyPotato - the silent fix
➔ The ninja patch is inside rpcss.dll
[1] https://itm4n.github.io/printspoofer-abusing-impersonate-privileges/
https://decoder.cloud/2020/05/11/no-more-juicypotato-old-story-welcome-roguepotato/
https://github.com/antonioCoco/RoguePotato
Demo 2 - RoguePotato
JuicyPotatoNG
➔ Uses RPC over TCP (ncacn_ip_tcp)
[1] https://googleprojectzero.blogspot.com/2021/10/windows-exploitation-tricks-relaying.html
[2] https://decoder.cloud/2022/09/21/giving-juicypotato-a-second-chance-juicypotatong/
JuicyPotatoNG - trick to recover INTERACTIVE sid
➔ LogonUserW documentation about NewCredentials logon type:
◆ “This logon type allows the caller to clone its current token and
specify new credentials for outbound connections…” MSDN
https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-logonuserw
Demo 3 - JuicyPotatoNG
JuicyPotatoNG - the silent fix
➔ Starting from Win 11 22H2 a new change in
lsasrv.dll!LsapAuAddStandardIds():
https://github.com/antonioCoco/JuicyPotatoNG/issues/4
JuicyPotatoNG - the silent fix???
➔ Starting from Win 11 / Server 2022 a new available CLSID:
◆ Universal Print Management Service (McpManagementService) - CLSID:
{A9819296-E5B3-4E67-8226-5E72CE9E1FB7}
https://twitter.com/decoder_it/status/1602673748234190848
JuicyPotatoNG - the silent fix???
https://github.com/antonioCoco/JuicyPotatoNG/issues/4
And the Potato dynasty is not over…
➔ SweetPotato
◆ https://github.com/CCob/SweetPotato
➔ GodPotato
◆ https://github.com/BeichenDream/GodPotato
➔ PrintNotifyPotato
◆ https://github.com/BeichenDream/PrintNotifyPotato
➔ PetitPotato
◆ https://github.com/wh0amitz/PetitPotato
➔ EfsPotato
◆ https://github.com/zcgonvh/EfsPotato
➔ DCOMPotato
◆ https://github.com/zcgonvh/DCOMPotato
18 Months
https://twitter.com/splinter_code/status/1583555613950255104
RemotePotato0 - the silent fix
https://twitter.com/splinter_code/status/1583555613950255104
RemotePotato0 - the ?accidental? fix
https://techcommunity.microsoft.com/t5/windows-it-pro-blog/dcom-authentication-hardening-what-you-need-to-know/ba-p/3657154
RemotePotato0 - the ?accidental? fix
https://techcommunity.microsoft.com/t5/windows-it-pro-blog/dcom-authentication-hardening-what-you-need-to-know/ba-p/3657154
RemotePotato0 - exploitation scenarios
➔ Relay to an LDAP remote server with cross session
activation
https://www.localpotato.com/localpotato_html/LocalPotato.html
https://github.com/decoder-it/LocalPotato
LocalPotato - attack flow
➔ Again, using the DCOM trigger locally to coerce a SYSTEM
authentication, trick by James Forshaw [1]
➔ Targets the local SMB server to perform an arbitrary file
write
➔ Specify the SPN “cifs/127.0.0.1” in the COM server
authentication information [1] -> bypass NTLM Anti-
Reflection SMB protection
➔ Exploit the context swap bug to authenticate as SYSTEM
➔ Hijack a dll from a privileged service and start the
service, e.g. PrintConfig.dll
[1] https://googleprojectzero.blogspot.com/2021/10/windows-exploitation-tricks-relaying.html
https://www.localpotato.com/localpotato_html/LocalPotato.html
https://github.com/decoder-it/LocalPotato
Demo 6 - LocalPotato SMB edition
LocalPotato - CVE-2023-21746 fix
➔ The fix is in msv1_0.dll and function
SsprHandleChallengeMessage()
https://msrc.microsoft.com/update-guide/en-US/vulnerability/CVE-2023-21746
LocalPotato - exploitation scenarios
➔ Context swap vs local SMB Server
https://msrc.microsoft.com/update-guide/en-US/vulnerability/CVE-2023-21746
RemotePotato0 - after the CVE-2023-21746 fix
➔ Context swap vs local SMB Server
https://techcommunity.microsoft.com/t5/windows-it-pro-blog/the-evolution-of-windows-authentication/ba-p/3926848
Conclusion
➔ Potatoes broke the boundaries!
◆ Safety
◆ Security
@splinter_code
splintercod3@gmail.com