DarkCorp

Recon

nmap_scan.log

HTTP (80)

Writeup.png

RoundCube

On /register we can sign up, and on mail.drip.htb we can login into RoundCube mail

Creds: test02:test02

Writeup-1.png

RoundCube version is 1.6.7

Writeup-2.png

Government Emails at Risk: Critical Cross-Site Scripting Vulnerability in Roundcube Webmailarrow-up-right

Unintended Sidetrack

You could register as almost any user, if we use root we can login and see cronjob reports sent to root...

Writeup-4.png

drip.darkcorp.htb redirects to drip.htb

There's 2 users: ebelford and support

Passive recon reveals that domain is serving some application

You could read http://drip.darkcorp.htb/dashboard/.env and any other source file you could find.

Probably unintended so didn't follow the path.

XSS - CVE-2024-42009

While testing for CVE-2024-42009 I messed up recipient and got email about user not existing, potential user enumeration if support fails?

Writeup-3.png

Hmmm... playing around with XSS yielded nothing using payload from blog.

From the main page /contact is sending emails to specified recipient

Writeup-5.png

Test if we can receive it and yes:

Writeup-6.png

I used following script to test many payloads, but none worked.

Going back to contact form it has field content=text, if switched to html then this XSS works.... ???

If we send to non existent email then it ends up in our mailbox (email field (?)) as failed send, here we get self XSS because it failed but confirms that XSS works from /contact

Writeup-7.png

support user does not generate callback, but bcase user does.

Script:

This user has 2 mails and then ours. Welcome email can be discarded. Analytics Dashboard is interesting from ebelford@drip.htb.

Read the email using preview action: fetch("/?_task=mail&_uid=2&_mbox=INBOX&_framed=1&_action=preview")

UID can be found in list action json

Writeup-8.png

More XSS - Forgot Password

http://dev-a3f1-01.drip.htb/arrow-up-right

Writeup-9.png

We can't login, only bcase can. There's Forgot Password on platform which requires email.

Writeup-10.png

Send and list emails again

Read the email

Writeup-11.png

http://dev-a3f1-01.drip.htb/reset/ImJjYXNlQGRyaXAuaHRiIg.Z6fxAA.W9dAyVvWlL82g0CDFyPAK832d98arrow-up-right

Creds: bcase:Password123$

SQLi (Postgres)

Writeup-12.png

Searching for test crashed the app (?)

Writeup-13.png

Looks like we have to do SQLi. Psycopgarrow-up-right is the most popular PostgreSQL database adapter for the Python programming language. PayloadsAllTheThings/SQL Injection/PostgreSQL Injectionarrow-up-right

Get tables (using default database)

List databases since default is empty

List public database

Database doesn't return anything...

SQLi -> LFI

Postgres allows writing and reading files.

Hmmmm... even if we could write files we can't do anything with it.

/etc/hosts

There are other hosts on network, I kind of forgot this was a Windows machine.

Read files:

Nothing so far with LFI...

Logs seems interesting - https://hacktricks.boitatech.com.br/pentesting/pentesting-postgresqlarrow-up-right

https://learnomate.org/documentation-of-postgresql-conf-file/arrow-up-right

The location of the postgresql.conf file can vary depending on the operating system and the installation method. Common locations include:

  • /etc/postgresql/<version>/main/postgresql.conf (Debian/Ubuntu)

  • /var/lib/pgsql/<version>/data/postgresql.conf (CentOS/Red Hat)

  • /usr/local/pgsql/data/postgresql.conf (custom source installations)

To leak the version use '' AND (SELECT version())::int=1 -- -

Writeup-14.png

When I attempt to read /etc/postgresql/15/main/postgresql.conf then application crashes with 502... SQLMap payload was successful at reading the file, but only managed to read up to 5500 bytes (not enough for log config).

Default location for version 15 seems to be /var/log/postgresql/postgresql-15-main.log

https://crackstation.netarrow-up-right -> 8bbd7f88841b4223ae63c8848969be86 -> ThePlague61780

SSH (22)

Creds: ebelford:ThePlague61780

Postgres

Enumerate Postgres

No hash is found in CrackStation database...

Network Enumeration~

We just got entrypoint into the network and if you remember there was 2 other hosts, from /etc/hosts. We can get nmap and start scanning them.

There's only these 3 devices on network.

Just in case we might have missed something enumerate with linpeas:

Back to scanning, .1 and .2 are both Windows machines (denoted by TTL=128) and we are on Linux (denoted by TTL=64)

SMB Enum~

Port forward and try tinkering with Windows

SMB is not accessible with guest user or anonymous login on both machines.

We are able to SSH into DC-01, but something is strange.. we are still on the same box. Same file system and everything.

There's webserver on .2 which is IIS default installation. There's also port 5000, but we don't have credentials.

Dirbusting Internal Servers

Writeup-15.png

aspnet_client folder enumeration and fuzzingarrow-up-right

Permission denied, but probably useful in smth?

Postgres Backup

Postgres owns /var/backups/postgres, since logs had credentials something could also be there?

Looks like we will need a private key to decrypt this file.

Postgres RCE

Postgres allows command execution too!

Writeup-16.png

New users

Creds: victor.r:victor1gustavo@#

SMB

We have some certificates related to DC-01

Some ASP code

LDAP

Writeup-17.png

TRUSTED_FOR_DELEGATION is interesting.. https://www.netexec.wiki/ldap-protocol/unconstrained-delegationarrow-up-right

Writeup-18.png

taylor.b.adm is our next target since we can RDP WinRM as her

Get all the users:

Hmmm... odd. netexec seems to have missed few accounts? 🤔

Users from ldap:

Users

bryce.c

eugene.b

taylor.b.adm

taylor.b

angela.w.adm

angela.w

john.w

svc_acc

victor.r

krbtgt

Guest

Administrator

HTTP (5000)

Using victor's credentials we can login into the port 5000 application!

Writeup-19.png

NTLM Authentication

I wanted to send requests to Burp, but was unsuccessful because we are already proxying SOCKS5

Writeup-21.png
Writeup-20.png

Authorization attempts were unsuccessful, but it's doing some kind of NTLM authentication...

Turns out you have to enable the NTLM auth in settings: https://portswigger.net/support/configuring-ntlm-with-burp-suitearrow-up-right

Writeup-22.png

NTLM Relaying to LDAP

NTLM Relaying to LDAP - The Hail Mary of Network Compromisearrow-up-right

Doesn't work because because the necessary flag is not set in sshd_config

We are essentially replacing SSH with Chisel, the path stays the same.

We get an interactive ldap shell \o/

I think we might need to do shadow credentials attack and this is not implemented in impacket for now I think (Speaking from Mist box)

Nothing works, permission denied on everything 😭

Previously bloodhound was not able to dump any data because it failed to find LDAP server. Turns out you have to edit dnat in proxychains configuration...

Relaying Kerberos over SMB using krbrelayx

Abusing multicast poisoning for pre-authenticated Kerberos relay over HTTP with Responder and krbrelayxarrow-up-rightRelaying Kerberos over SMB using krbrelayxarrow-up-right

This is why you RTFM... ntlmrelayx can add DNS records and svc_acc is part of DnsAdmins group meaning this action is possible, the Kerberos over SMB becomes possible.

interactive-ldap-shadow-creds branch doesn't have this option, use latest official source.

Note: proxychains somehow failed to start server on drip.htb, so port forward 8003 from your machine to drip

Writeup-23.png

Note: You have to perform this attack quickly, add domain and right after fire the PetitPotam (have krbrelayx ready) or it won't work.... Probably HTB cronjob running every 2 second or smth

Writeup-24.png

I had to disable dnsmasq so krbrelayx would work 😶

Pass The Certificate

https://www.thehacker.recipes/ad/movement/kerberos/pass-the-certificatearrow-up-right

The machine account can't do much directly, but we can forge Silver Ticket and priv esc.

Silver Ticket

https://www.thehacker.recipes/ad/movement/kerberos/forged-tickets/silverarrow-up-righthttps://www.netexec.wiki/ldap-protocol/find-domain-sidarrow-up-right

Web-01 pwned

Dump hashes as Administrator

User.txt

Privilege Escalation (john.w)


When escalating the defender was disabled, and after some time it was not. Probably HTB players disabled it to avoid it deleting files.

Use following to disable it:


Upload WinPeas

appcmd

There are some files I have not yet seen in IIS configs

https://www.netspi.com/blog/technical-blog/network-pentesting/decrypting-iis-passwords-to-break-out-of-the-dmz-part-2/arrow-up-right

Password Reuse (Attempt)

We can login we svc_acc, but since it's only part of DnsAdmins there's not much we can do.

Nothing

There was some exe file in Admin's directory we could check out

Unfortunately the binary is not written in C#, but in Golang

Rabbit hole :/

Update bloodhound data

Nothing new...

Winpeas.bat

exe didn't work, but bat version worked with WinPeas

DPAPI (struggle)

https://github.com/gentilkiwi/mimikatz/wiki/module-~-dpapiarrow-up-righthttps://tools.thehacker.recipes/mimikatz/modules/dpapi/masterkeyarrow-up-right

Note: I think the following keys would have worked if I used token::elevate first in ::cred and also I think we were not supposed to see these keys, probably other players...

There's administrator keys and there's system32 keys

Admin Password

Get the system DPAPI key: 1004cecdc9b33080d25a4a29126d4590eb555c5f7f3f9f871ea1dafaea01ae4ccf6e3f7ee535e472

Now we have the master key, let's find blob and decrypt:

Admin Blobs

Same can be done for admin blobs

john.w pwned

Privilege Escalation (angela.w)

Writeup-25.png

We can reset the user's password, but considering we are on HTB that's not a good idea. Instead we can use shadow credentials attack and get NTLM password for user.

Update bloodhound

Nothing new...

Angela has second user with .adm suffix indicating higher privileges, but password doesn't work.

Writeup-26.png

Privilege Escalation (angela.w.adm)

sAMAccountName spoofing

The Hacker Recipes: sAMAccountName spoofing - User accountarrow-up-rightDEF CON 31 - A Broken Marriage Abusing Mixed Vendor Kerberos Stacks - Ceri Coburnarrow-up-rightA broken marriage. Abusing mixed vendor Kerberos stacksarrow-up-right: If NT_ENTERPRISE is used as the hint, userPrincipalName is searched first.

https://github.com/CravateRouge/bloodyAD/wiki/User-Guide#set-objectarrow-up-right

Remote kerberos authentication via ssh was tricky -k or -K flag didn't want to work...

Linux (Root)

We can ksu locally

Privilege Escalation (taylor.b.adm)

Writeup-27.png
Writeup-28.png

SSSD (System Security Services Daemon)

https://github.com/ricardojoserf/SSSD-credsarrow-up-right

Great, out target was taylor and we can probably can crack the hash.

Privilege Escalation (DC Administrator)

Update bloodhound

GPO Abuse

Writeup-29.png
Writeup-30.png
Writeup-31.png

SharpGPOAbusearrow-up-right gets deleted as soon as it's uploaded, AV is ON.

https://www.thehacker.recipes/ad/movement/group-policiesarrow-up-righthttps://ppn.snovvcrash.rocks/pentest/infrastructure/ad/gpo-abusearrow-up-right

https://github.com/gwillgues/Reverse-Shells.gitarrow-up-right

Note: Never mind this binary, GPOwned failed to execute it so useless

Root.txt

Last updated