From Windows

For credentialed enumeration, we must have a user's cleartext password, NTLM password hash, or SYSTEM access on a domain-joined host.

Once we have any of the above, we should start enumerating domain. We are interested in domain users and computers attributes, group membership, Group Policy Objects, permissions, ACLs, trusts and more.

ActiveDirectory PowerShell Module

Documentation for Windows AD Module

# List all available modules
Get-Module

# Loading AD module if not loaded
Import-Module Active-Directory

# If AD module is not available, install it
# Need Administrative privileges
Get-Module -ListAvailable -Name ActiveDirectory
Install-WindowsFeature RSAT-AD-PowerShell

# Get domain info
Get-ADDomain

# Get AD users
Get-ADUser

# Get user accounts with SPN property populated
Get-ADUser -Filter {ServicePrincipalName -ne "$null"} -Properties ServicePrincipalName

# Checking For Trust Relationships
Get-ADTrust -Filter *

# Get groups info
Get-ADGroup -Filter *

# Detailed group info
Get-ADGroup -Identity "Group Name"

# Get members of the group
Get-ADGroupMember -Identity "Group Name"

PowerView

PowerView is a tool written in PowerShell to help us gain situational awareness within an AD environment. Following are the commonly used commands of powerview:

Domain/LDAP Functions

GPO Functions

Computer Enumeration Functions

Threaded 'Meta'-Functions

Domain Trust Functions

Using filters with PowerView functions:

SharpView

SharpView is a .NET port of PowerView. Many of the same functions supported by PowerView can be used with SharpView.

Enumerating shares using Snaffler

Snaffler is a tool that can help us acquire credentials or other sensitive data in an Active Directory environment. Snaffler works by obtaining a list of hosts within the domain and then enumerating those hosts for shares and readable directories. Snaffler requires that it be run from a domain-joined host or in a domain-user context.

BloodHound

Bloodhound is an exceptional open-source tool that can identify attack paths within an AD environment by analyzing the relationships between objects.

  • First, we must authenticate as a domain user from a Windows attack host that is positioned within the network but it doesn't need to be joined to the domain as long as creds are provided.

  • Now we can upload zipfile to bloodhound and start analysis

  • Type domain: $DOMAIN_NAME in search bar to filter info related to a specific domain

  • There are some pre-built queries in Analysis tab.

  • Some queries that are useful:

Things to Keep in mind:

  • If you find a host running old OS, report it as it can cause issues. It is better to segement it from rest of the network.

  • Make sure the host is Live before reporting it.

  • Sometimes users are provided local admin roles for some specific task but it was not revoked. YOu will sometimes also find excessive local admin rights.

Misconfiguration Module HTB

Exchange Groups

  • The group Exchange Windows Permissions is not listed as a protected group, but members are granted the ability to write a DACL to the domain object. This can be leveraged to give a user DCSync privileges.

  • The Exchange group Organization Management is another extremely powerful group (effectively the "Domain Admins" of Exchange) and can access the mailboxes of all domain users. This group also has full control of the OU called Microsoft Exchange Security Groups, which contains the group Exchange Windows Permissions.

Miscellaneous Misconfigurations

  • Finding Passwords in the Description Field using Get-Domain User

  • Domain accounts with the passwd_notreqd field set in the userAccountControl attribute are not subject to the current password policy length. They could have a shorter password or no password at all (if empty passwords are allowed in the domain).

  • Credentials in SMB Shares and SYSVOL Scripts

  • Group Policy Preferences (GPP) Passwords

  • Group Policy Object (GPO) Abuse

Use automated tools like group3r, ADRecon, PingCastle, SharpGPOAbuse

  • Check Deleted Objects in AD:

  • The PrivExchange attack results from a flaw in the Exchange Server PushSubscription feature, which allows any domain user with a mailbox to force the Exchange server to authenticate to any host provided by the client over HTTP.

  • Printer bug:

  • MS14-068 was a flaw in the Kerberos protocol, which could be leveraged along with standard domain user credentials to elevate privileges to Domain Admin. Tool

  • Sniffing LDAP Credentials, the application has a test connection function that we can use to gather credentials by changing the LDAP IP address to that of our attack host and setting up a netcat listener on LDAP port 389. When the device attempts to test the LDAP connection, it will send the credentials to our machine, often in cleartext.

  • Enumerate DNS records and find hidden records. Tool

Automated Scanning

  • We can create an AD Snapshot with Active Directory Explorer tool.

Last updated