Currently working as a Senior Consultant at Netcompany spending my full-time job solving the SharePoint riddles. In the free time I'm expanding my understanding of cybersecurity through hacking activities. Git fanboy.
This write-up is a part of the HTB Sherlocks series. Sherlocks are investigative challenges that test defensive security skills. I encourage you to try them out if you like digital forensics, incident response, post-breach analysis and malware analysis. Are you ready to start the investigation?
Incident Details
Name: MisCloud Category: DFIR Difficulty: Medium (Solved)
My name is John. I am a student who started an e-commerce startup business named "DummyExample" with my partner, James. Initially, I was using WordPress and shared hosting. After experiencing good traffic, I decided to migrate from WordPress to a customized website on Google Cloud Platform (GCP). Currently, my partner and I are working on the website, contributing to a Gitea server hosted on GCP. I migrated all customer data to cloud storage. Recently, my data was breached, and I have no clue how it happened or what was vulnerable. My GCP infrastructure consists of five VM instances and a single Cloud Storage. There is one Windows machine for my partner to use, with very restricted permissions over GCP, only allowing access to his Gitea account. I have two Linux machines for my work, one for hosting the Gitea server and another for packet mirroring. All the machines have public IPs but very restricted access due to firewalls in place. Due to budget constraints, I can't use the Google Security Command Center service, so I am providing you with the VPC network traffic capture and the Google Cloud logs.
01. What's the private IP address of the Windows machine?
Seen in the broadcast message: 10.128.0.3.
02. Which CVE was exploited by the threat actor?
Searching for the “Gitea 1.2.0 vulnerabilities” I landed at the CVEdetails
Because I’ve already seen the RCE I’m looking at those four from code executions category. This one looks like what we have here.
03. What is the hostname and port number to which the reverse shell was connecting?
Already discovered: 0.tcp.eu.ngrok.io:14509
04. From which IP address was the CVE exploited, and is this threat an insider or outsider attack?
Packet from which the revshell request originates from is sourced at 10.128.0.3. And it’s a private address, so “inside job”.
05. Which account helped the threat actor to pivot?
Let’s browse the revshell communication.
Here we can see the commands and responses in plaintext.
Packet 13385: gcloud auth list
Packet 13392:
Credentialed Accounts
ACTIVE ACCOUNT
* 257145238219-compute@developer.gserviceaccount.com
06. Which machines did the threat actor log into? (sorted alphabetically)
That requires more revshell analysis. At some point, we can see that threat actor creates an id_rsa key for SSH purposes and continues from the SSH (revshell traffic gets quieter).
Because question asks which machines being logged into - that is safely to assume that apart from “current” system (10.128.0.4 as stated in the revshell packets) there are other SSHed servers. ip.src == 10.128.0.4 && ssh && ssh.protocol == "SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.3"
Unfortunately, gitea-vm is not accepted in the answer, despite being the first one in the chain - so the correct answer is linux-machine1,linux-machine2,packet-mirror-instance
07. What's the original name of the sensitive file?
From the included Google Cloud Services logs:
08. Which gcloud role did the threat actor try to assign to the storage bucket to make it publicly accessible?
09. Which account led to the cloud storage data breach?
Searching for the exfiltrated file, leads to the principalEmail
10. Which port number was exploited by the attacker to exfiltrate data that is allowed by default ingress traffic rules in the default VPC network?
I think this one was already found as well in the packet 20213 - 3389 (it is default RDP port).
11. What is the key to decrypt the encrypted file?