Featured image of post HackTheBox: PCAP Analysis - LetsDefend Sherlock Walkthrough

HackTheBox: PCAP Analysis - LetsDefend Sherlock Walkthrough

Investigating a Suspicious File Upload with Wireshark: PCAP Analysis, HTTP Traffic Inspection, File Upload Analysis, and Network Conversation Analysis

Introduction:

Welcome to my weekly walkthrough! If you’ve stumbled across this blog while looking for a detailed guide to the PCAP Analysis LetsDefend sherlock from HackTheBox, you’re in the right place.

For this challenge, we’re popping into the network forensics world to make sense of some captured network traffic. The scenario doesn’t give us much to work with beyond the username P13 and a PCAPNG file, so our job is to follow the packets and piece together what happened.

Throughout the investigation, we’ll spend our time in Wireshark, searching packet data and analyzing HTTP traffic to identify P13’s IP address, follow a file upload to a web server, identify the uploaded file and destination directory, fingerprint the web server software, and determine how long the associated network conversation lasted.

I’ll walk through each step of the investigation, explain the reasoning behind the analysis, and show how we can pivot between packet contents, HTTP streams, and conversation statistics to answer the challenge questions. By the end, you’ll have a better understanding of PCAP analysis, HTTP traffic analysis, and some of the features Wireshark provides for investigating network activity.

Sounds like fun, right? Let’s go!

Thanks for reading and going on this investigation with me!

This write-up is for educational purposes only. All intellectual property related to the challenge belongs to the respective owners HackTheBox


Challenge Scenario:

We have captured this traffic from P13’s computer. Can you help him?


Setup the Analysis Environment & Extract the Challenge File:

Safety first! It’s always important when working with lab/challenge files from [HTB] (or any educational lab/challenge/range), to keep yourself protected by performing these tasks in a dedicated, isolated virtual machine environment. As this is a Windows-based challenge, I’m using FLARE-VM for this challenge which is “a collection of software installations scripts for Windows systems that allows you to easily setup and maintain a reverse engineering environment on a virtual machine (VM).” 

To keep this write-up focused I’m going to skip the step-by-step setup of FLARE-VM but if you’d like to set up your own environment, please follow the directions provided directly by FLARE-VM on _GitHub.

https://github.com/mandiant/flare-vm

Once you have a safe virtual environment created, updated, isolated, and snapshotted, we can extract the challenge file and start the investigation!


Question 1: In network communication, what are the IP addresses of the sender and receiver?

Let’s kick this challenge off and extract the challenge artifact, PCAP_Analysis.zip. We’re left with a network packet capture file, Pcap_Analysis.pcapng, that we can open with Wireshark for our analysis.

The only clue we’re given is the username P13.

That’s not much to go on, so we’ll start by leveraging Wireshark’s search functionality using the magnifying glass on the toolbar. Then, we’ll perform a string search against the packet bytes for P13.

Wireshark: Performing a packet details string search

This gives us a hit, with the first appearing in packet 2402. It seems to contain the contents of some kind of chat between another user and P13, which puts him on some kind of scavenger hunt.

Based on the traffic and the context of our investigation, this establishes that P13 is the sender at 192.168.235.137, while the recipient is at 192.168.235.131.

Question 2: P13 uploaded a file to the web server. What is the IP address of the server?

Now that we’ve identified P13’s IP address, we can pivot on that to determine the IP address of the web server they uploaded a file to.

To do this, we’ll start by using Wireshark’s display filter to search for HTTP POST requests, which are commonly used to send data to a server. This might help us identify the file upload traffic.

http.request.method == "POST"

Wireshark: Identifying the POST request endpoint that P13 uploaded a file to

This leads us to packet 3513, where we’ll see a POST request to a PHP endpoint by the IP associated with P13. We can find the IP address of the server in the destination column.

Question 3: What is the name of the file that was sent through the network?

Let’s dig into the packet stream to determine the name of the file that was uploaded.

Right-click on packet 3513 and select Follow > HTTP Stream.

Wireshark: Inspecting the HTTP stream

When the HTTP stream window opens, we’ll find the name of the uploaded file in the Content-Disposition header of the multipart form data: filename="file".

Question 4: What web server software is running on the target machine?

Now we’ve identified the IP address and some of the endpoints on the web server, but we still need to identify what web server software is running.

Fortunately, we can find this information in the HTTP stream we’ve already got open. Scroll down to the Server header, where we’ll see that the web server identifies itself as Apache.

Wireshark: Identifying the web server application

Question 5: What directory was the file uploaded to?

Next up, we need to identify the directory where P13 uploaded the file named file.

We can find this just below the response headers, where we’ll see that the file was uploaded to the uploads directory.

Wireshark: Identifying the file upload directory

Question 6: How long did it take the sender to send the encrypted file?

We’ve made it to the last question! Our final task is to determine how long it took the sender to upload the file.

What we can’t see from the HTTP stream alone is how long the conversation associated with the upload lasted. For this, we’ll need to locate the specific conversation and check its duration.

To do this, we’ll pivot to Statistics > Conversations > IPv4 and locate the conversation between the sender (192.168.235.137) and the web server (192.168.1.7).

Wireshark: Using the Conversations view to identify the send duration

Under the Duration column, we can see that the conversation lasted 0.0073 seconds.

With that, we’ve completed all our objectives and can wrap up this investigation. Great job!


Conclusion:

How fun was that! A big thank you to HackTheBox for another awesome challenge.

PCAP Analyzed! This was a short investigation, but a fun example of how much information we can pull from a packet capture. Starting with nothing more than the username P13, we used Wireshark to identify the IP address associated with the user, follow a file upload to a web server, inspect the HTTP traffic to identify the uploaded file and destination directory, fingerprint the web server, and finally examine the conversation statistics associated with the transfer.

I chose this week’s challenge for something light and to continue practicing my network forensics skills and get some more hands-on practice working with Wireshark. Packet captures can contain boatloads of information, and I always enjoy challenges that force you to start with a small clue and figure out where to pivot next. This one was straightforward, but the progression from a username to the HTTP traffic and ultimately the file transfer made for a nice investigation.

My biggest takeaway was how useful it can be to combine different views within Wireshark rather than just relying on display filters. Searching the packet bytes gave us our initial lead, following the HTTP stream filled in the details of the file upload, and the Conversations view was completely new to me in terms of identifying conversation durations. It was a nice trick to learn about and while these are simple techniques, they provide a nice workflow for quickly getting oriented in an unfamiliar packet capture when combined.

Thanks for your support and partnering on this investigation. If you found this walkthrough helpful — please give it a clap and consider following me! Your feedback is invaluable, and it pumps me up to support your security journey. Remember, cybersecurity is a team sport, and we’re in this together!

Until next week’s challenge — stay curious and be safe out there!

Stumblesec


Tools & References:

Challenge Link: https://app.hackthebox.com/sherlocks/PCAP%2520Analysis

Flare-VM: https://github.com/mandiant/flare-vm

Wireshark: https://www.wireshark.org/

Licensed under CC BY-NC-SA 4.0
Built with Hugo
Theme Stack designed by Jimmy