Fragility

Description

In the monitoring team at our company, each member has access to Splunk web UI using an admin Splunk account. Among them, John has full control over the machine that hosts the entire Splunk system. One day, he panicked and reported to us that an important file on his computer had disappeared. Moreover, he also discovered a new account on the login screen. Suspecting this to be the result of an attack, we proceeded to collect some evidence from his computer and also obtained network capture. Can you help us investigate it?

Files

➜ 7z x .\fragility.zip -o"fragility" -p"hacktheblue"
➜ ls

    Directory: ~\VBoxShare\fragility

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d----          26.06.2024    17:27                [root]
-----          15.04.2024    01:35         330196 capture.pcapng
-----          15.04.2024    01:58     1546908444 Challenge.7z

We are given pcap file and a filesystem for the investigation.

Only valid folders from filesystem is var, root, proc, opt. Anything else is empty files.

Writeup-4.png

Tasks

Task 1. What CVE did the attacker use to exploit the vulnerability?

Logically first we should take a look at network traffic to identify how the attacker got into the system.

Writeup.png

For HTTP we see unusual traffic, python script seems to be authenticating on the server as John (admin). We can suspect that this wasn't attacker, rather monitoring script doing automated task with John's credentials.

Writeup-1.png

In the last POST request the user enters odd search query which starts with runshellscript

Writeup-2.png

Splunk CVEs: https://advisory.splunk.com/advisoriesarrow-up-right | SVD-2023-0806arrow-up-right | 2023-08-30 | Absolute Path Traversal in Splunk Enterprise Using runshellscript.pyarrow-up-right\ | High\ | CVE-2023-40597arrow-up-right |

The CVE-2023-40597arrow-up-right particularly stands out as an attack vector which attackers used, but this CVE would have been last part of the chain.

Before this CVE we can we XML document uploaded with XXE payload.

SVD-2023-1104arrow-up-right | 2023-11-16 | Remote code execution (RCE) in Splunk Enterprise through Insecure XML Parsingarrow-up-right | High | CVE-2023-46214arrow-up-right

Writeup-3.png
circle-check

Task 2. What MITRE technique does the attacker use to maintain persistence?

The adversaries added nginx user to system, with sudo group. Established SSH persistence and deleted their tracks.

T1136arrow-up-right | Create Accountarrow-up-right | Adversaries may create an account to maintain access to victim systems. With a sufficient level of access, creating such accounts may be used to establish secondary credentialed access that do not require persistent remote access tools to be deployed on the system.

For persistence they used new account so T1136 fits the MITRE technique.

circle-check

Task 3. John has adjusted the timezone but hasn't rebooted the computer yet, which has led to some things either being updated or not updated with the new timezone. Identifying the timezone can assist you further in your investigation. What was the default timezone and the timezone after John's adjustment on this machine?

Since /etc directory is virtually empty we have to look at other files.

/var/log/syslog and /var/log/messages store all global system activity data, including startup messages. Debian-based systems like Ubuntu store this in /var/log/syslog, while Red Hat-based systems like RHEL or CentOS use /var/log/messages.

The journal is a component of systemd. It's a centralized location for all messages logged by different components in a systemd-enabled Linux system. This includes kernel and boot messages, messages coming from syslog, or different services. srcarrow-up-right

circle-check

Task 4. When did the attacker SSH in? (UTC)

/var/log/auth.log or /var/log/secure: Keep authentication logs for both successful or failed logins, and authentication processes. Storage depends on system type. For Debian/Ubuntu, look in /var/log/auth.log. For Redhat/CentOS, go to /var/log/secure. srcarrow-up-right

nginx user makes first connection on Apr 14 08:00:21, but we need UTC so +7 hours.

04-14 15:00:21

Task 5. How much time has passed from when the user was first created to when the attacker stopped using SSH?

circle-check

Task 6. What is the password for the account that the attacker used to backdoor?

In the detection phase (XXE injection) the user password was added in an obfuscate manner:

circle-check

Task 7. There is a secret in the exfiltrated file, what is its content?

Data is exfiltrated to remote server: ip.dst == 192.168.222.130 and tcp.dstport == 8080, but it's encrypted.

Writeup-5.png

Follow conversation and extract stream:

Writeup-6.png

EBCDIC wasn't valid or something so I exported the data as raw again and started cooking:

Writeup-7.png

We know KEY/IV from auth.log:

Unzip and view contents.

Writeup-8.png
circle-check

Task 8. What are the username and password that the attacker uses to access Splunk?

The only valid credentials we saw during HTTP traffic analysis was John's, that must have been the entry point for attackers.

circle-check

Last updated