DarkCorp
Recon
HTTP (80)

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

RoundCube version is 1.6.7

Government Emails at Risk: Critical Cross-Site Scripting Vulnerability in Roundcube Webmail
Unintended Sidetrack
You could register as almost any user, if we use root we can login and see cronjob reports sent to root...

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?

Hmmm... playing around with XSS yielded nothing using payload from blog.
From the main page /contact is sending emails to specified recipient

Test if we can receive it and yes:

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

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

More XSS - Forgot Password

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

Send and list emails again
Read the email

http://dev-a3f1-01.drip.htb/reset/ImJjYXNlQGRyaXAuaHRiIg.Z6fxAA.W9dAyVvWlL82g0CDFyPAK832d98
Creds:
bcase:Password123$
SQLi (Postgres)

Searching for test crashed the app (?)

Looks like we have to do SQLi. Psycopg is the most popular PostgreSQL database adapter for the Python programming language. PayloadsAllTheThings/SQL Injection/PostgreSQL Injection
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-postgresql
https://learnomate.org/documentation-of-postgresql-conf-file/
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 -- -

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.net -> 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

aspnet_client folder enumeration and fuzzing
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!

New users
Creds:
victor.r:victor1gustavo@#
SMB
We have some certificates related to DC-01
Some ASP code
LDAP

TRUSTED_FOR_DELEGATION is interesting.. https://www.netexec.wiki/ldap-protocol/unconstrained-delegation

taylor.b.adm is our next target since we can
RDPWinRM as her
Get all the users:
Hmmm... odd. netexec seems to have missed few accounts? 🤔
Users from ldap:
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!

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


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-suite

NTLM Relaying to LDAP
NTLM Relaying to LDAP - The Hail Mary of Network Compromise
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 krbrelayxRelaying Kerberos over SMB using krbrelayx
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

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

I had to disable
dnsmasqso krbrelayx would work 😶
Pass The Certificate
https://www.thehacker.recipes/ad/movement/kerberos/pass-the-certificate
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/silverhttps://www.netexec.wiki/ldap-protocol/find-domain-sid
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
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-~-dpapihttps://tools.thehacker.recipes/mimikatz/modules/dpapi/masterkey
Note: I think the following keys would have worked if I used
token::elevatefirst in::credand 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)

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.

Privilege Escalation (angela.w.adm)
sAMAccountName spoofing
The Hacker Recipes: sAMAccountName spoofing - User accountDEF CON 31 - A Broken Marriage Abusing Mixed Vendor Kerberos Stacks - Ceri CoburnA broken marriage. Abusing mixed vendor Kerberos stacks: If NT_ENTERPRISE is used as the hint, userPrincipalName is searched first.
https://github.com/CravateRouge/bloodyAD/wiki/User-Guide#set-object
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)


SSSD (System Security Services Daemon)
https://github.com/ricardojoserf/SSSD-creds
Great, out target was taylor and we can probably can crack the hash.
Privilege Escalation (DC Administrator)
Update bloodhound
GPO Abuse



SharpGPOAbuse gets deleted as soon as it's uploaded, AV is ON.
https://www.thehacker.recipes/ad/movement/group-policieshttps://ppn.snovvcrash.rocks/pentest/infrastructure/ad/gpo-abuse
https://github.com/gwillgues/Reverse-Shells.git
Note: Never mind this binary,
GPOwnedfailed to execute it so useless
Root.txt
Last updated