Post Exploitation
Post Exploitation in Active Directory
GPOs
Identify the OU containing the VICTIM-PC object:
PS > Add-WindowsFeature -Name "RSAT-AD-PowerShell"
PS > Import-Module ActiveDirectory
PS > Get-ADComputer -Identity VICTIM-PC | select DistinguishedNameCreate a GPO using GPMC:
Run >
gpmc.msc.Create a new GPO in the OU in which
VICTIM-PCresides.Remove
Authenticated Usersfrom Security Filtering and addVICTIM-PCthere.Link it to the OU and edit it.
Usually, it takes between 90 and 120 minutes for a new GPO to be applied. Force it with:
Cmd > gpudate.exe /force<POLICY_NAME>
Computer Configuration
Policies
Administrative Templates
Windows Components
Remote Desktop Services
Remote Desktop Session Host
Connections
Allow users to connect remotely using Remote Desktop Services
Enabled, OK<POLICY_NAME>
Computer Configuration
Policies
Windows Settings
Security Settings
Windows Defender Firewall with Advanced Security
Inbound Rules
(right-click) New Rule
Predefined (Remote Desktop)
Allow the connection, Finish<POLICY_NAME>
Computer Configuration
Preferences
Control Panel Settings
Local Users and Groups
(right-click) New > Local Group
Group name (...)
Members (Add), OK
Apply, OKReach a Locked-down Domain Computer
If you find yourself in a situation when you're already a domain admin and you need to access a locked-down domain computer (no RDP/WinRM, no SMB shares, no owned local admins, etc.), creating an evil GPO may help.
Create a GPO using PowerShell (will trigger a command when the victim user logs in):
Enable ADMIN shares manually by restoring AutoShareServer:
Shadow RDP
Enable Shadow RDP via group policies or by manually setting the registry and connect to an active session on the target machine.
Enable:
Shadow the RDP:
Cleanup:
RpcShadow2
Run on Domain Computers
An example PowerShell script to execute commands as a local admin on all domain computers pulling LAPS passwords automatically:
Locate DFS Targets
Locate a root target:
Locate a root folder:
One-liner:
House Cleaning
Remove the last tunnel while operating from it:
Last updated