Office

Recon

nmap_scan.log
└─$ grep office /etc/hosts
10.10.11.3	office.htb	DC.office.htb	hostmaster.office.htb

DNS (53)

HTTP (80)

Writeup.png

Only /administrator/ is valid, others are 404 or not listing directories.Writeup-1.png

Joomla Credentials

We know that Joomla is used.

Looking up the Joomla version we get CVE-2023-23752-EXPLOITarrow-up-right

The Administrator:H0lOgrams4reTakIng0Ver754! credentials didn't work for anything on web app.

Kerbrute

enum4linux failed because null auth is not valid for smb and RID bruteforce also wasn't successful. Only valid option left was kerbrute for usernames:

Creds: dwolfe:H0lOgrams4reTakIng0Ver754!

We got valid user with credential from Joomla.

RID Brute

SMB

PCAP Analysis

First we look at Protocol Hierarchy from Statistics.

Writeup-2.png

There's Kerberos packet found in pcap:

Writeup-3.png

AS-REQ Roasting from a router.arrow-up-rightAS_REQ_Roastarrow-up-right script

Crack the hash:

Joomla

The credentials still didn't work for anything, no winrm on box or Joomla.

But if we use Administrator:playboy69 to login into the Joomla we are logged in.

Writeup-4.png

Joomla only has 1 user and email seems to have different domain.

Writeup-5.png

Go to System > Site Templates

Writeup-6.png

I usually go for 404 page since it's easier to trigger and hide backdoor in it.

Writeup-7.png

Reverse Shell (web_account)

Catch the reverse shell and stabilize it.

Writeup-8.png

The web_account doesn't have anything interesting, but there's tstark user on this system and we could try using RunasCs to run commands as him.

Privilege Escalation (tstark)

User.txt

Privilege Escalation (ppotts)

There's some application ran by apache on port 8083.

Create tunnel to access the application on port 8083:

Writeup-9.png

Note: 0xdf: Tunneling with Chisel and SSFarrow-up-right

HTTP (8083)

Writeup-10.png

We have an upload form

Writeup-11.png

This application only allows certain extension of files and uploads the final renamed files to C:\xampp\htdocs\internal\applications directory.

No direct write access to the directory.

Get versions:

Note: 3 easy ways to find out what Microsoft Word version you have on Windowsarrow-up-right

Get windows build version:

Welp, office doesn't seem to be exploitable. But LibreOffice on the other hand, yes: CVE-2023-2255arrow-up-right

The php thingy wasn't working so I decided to use straight up reverse shell. Since we are on windows we need exe to get connection and didn't really want to use msfvenom. Golang is perfect for cross platform and that's what I used.https://github.com/gwillgues/reverse-shells/blob/742b83866b56/revshell.goarrow-up-right

Compile:

Create exploit:

Upload and wait, took some time to get connection back.

Privilege Escalation (hhogan)

https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalationarrow-up-righthttps://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation/dpapi-extracting-passwordsarrow-up-right

Writeup-12.png

The approach didn't work.

I think meterpreter would have been nice here...

DPAPI

Master Keys:

Usually each master keys is an encrypted symmetric key that can decrypt other content. Therefore, extracting the encrypted Master Key is interesting in order to decrypt later that other content encrypted with it. srcarrow-up-right

Creds: hhogan:H4ppyFtW183#

TLDR;

  1. Find master keys

  2. Inject master keys via /rpc

  3. If lucky it will get decrypted and will be in cache

  4. Dump creds file for credentials

-- Turns out if user is logged in then we are indeed "Lucky"!

Privilege Escalation (system)

Start bloodhound to get idea of AD and maybe pwn GPO

Show all users: MATCH (u: User) RETURN u

Writeup-13.png

User > Outbound Object Control > Transitive Object Control.

The user has GenericWrite permission on domain policies.

Writeup-14.png

Policy affects the domain controller

Writeup-15.png

GPO Abuse

Get group policy related commands:

Get-GPO -All can be used to view all the policies.

We can use SharpGPOAbuse.exearrow-up-right to get administrator access:

The original idea with Privilege Escalation was to add user to admin group and that's it, pwned. But since it's htb box has a cleanup script and doesn't let us do it.

Root.txt

Anyway, get the flag via reverse shell.


psexec could also have been used for privilege escalation:

Credits: h4x0r3rr0rarrow-up-right

Last updated