πŸ₯³Authenticated

Steps for GreyBox penetration testing in Active Directory environments.

Basic Bloodhound

Once you got a valid domain account, you can send LDAP Request. This means you are able to use Bloodhound. Very simple, remotely, with bloodhound-python :

bloodhound-python -c All -d DOMAIN -u USER -p PASSWORD 

Somestimes you may have some errors. You should try with --dns-tcp parameter and specify the name server IP address :

bloodhound-python -c All -d DOMAIN -u USER -p PASSWORD -ns DNS_IP --dns-tcp

This will create some .json files that you will upload in Bloodhound. Before lauching Bloodhound GUI, you have to start neo4j :

sudo neo4j start

Then, just launch bloodhound. Do not bother yourself to download it from github, just install it with apt :

sudo apt-get install bloodhound

Then, upload .json files (you can drag and drop) and enjoy.

Extended Bloodhound

Extended Bloodhound includes PKI stuff. This has been created by Olivier Lyak. You can find the fork here : https://github.com/ly4k/BloodHound

To collect data, you can use certipy :

certipy find -u username@domain -p password -bloodhound

Then you can use Lyak's custom Bloodhound GUI to visualize ESC 1 to 10.

Shares

A very useful module in netexec is spider_plus. This module will automatically dump small files accessible in the shares. Theses small files are likely to contain password/secrets.

Theses files will be saved in /tmp/nxc_spider_plus directory. You can then search for password with grep, using multiple keywords like "admin", "pass", "ftp", "sql" and many others :

Dumping credentials

Remotely

Many options are available to you for credential dumping when you are admin. Here are some with netexec :

Also, do not forget DPAPI. Either with netexec or with DonPAPI :

In case there is an EDR or something making you impossible to retrieve SAM, SYSTEM and security, you can use esentutl.exe with nxc :

Then grab it with smbclient for example.

Using domain backup key

With netexec, it will automatically detect if you are using a domain admin account. So just use it with --dpapi parameter. Otherwise, export the domain backup key :

Then, use the domain backup key on all machine, with one command. Extract all FQDN in a file (targets for example) and then :

You can parse the output by using this magic one-liner :

Locally

In case you are trying to dump passwords locally, you can use cmd :

Or retrieve them manually :

Then, you can retrieve passwords with secretsdump on your host :

You can also try to dump lsass memory from the task manager. Once you got the .DMP file, you can parse it with pypykatz :

Impersonation

To execute commands with another account :

Kerberos Attacks

Kerberoast

GetUserSPNs and get hashes :

Once you hot hashes, you can try to crack them with hashcat :

ASP-REP Roasting

Look for users without Kerberos pre-authentication required attribute (using credential, low privilege) :

Constrained Delegation

Find delegations :

Forge a Service Ticket and log in :

RBCD

This attack require to own a powerful user.

First, add a new computer to the domain or use a computer account you own (not recommanded) :

Then, add the new computer to the trusted list :

Request a service ticket and log in :

Silver Tickets

Once you got a service account, like a machine account, you are able to forge a TGS impersonating any user on this machine :

Errors

If you get any error regarding clock screw :

NTDS Exfiltration

Remotely

Many options. With impacket :

With netexec :

Locally

Extract theses files and retrieve them on your host :

Once you get these two files, you are able to extract all the informations using impacket. The β€˜LOCAL’ at the end allows you to use local ntds file :

Cracking Passwords

Use this magic one-liner to parse your NTDS file and get hashes ready to be cracked :

Dumping credentials on a Samba DC

If you got domain admin credential, you can do it remotely by using the net command, included in the samba package. You will also need the klist command from krb5-user package. Just install them :

Then, you can dump the DC with the 'vampire' option included in net command :

Then, to extract hashes from test.tab, use the klist command :

And you will get what you want πŸ‘

Last updated