HTB Sherlock Brutus - Analyzing SSH Brute-Force and Unix Logs
Explore how to detect SSH brute-force attacks and track post-compromise actions using Unix logs in HackTheBox's Sherlock Brutus challenge. From access tracing to privilege escalation, uncover critical insights.
š¹
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.
Analyzing the auth.log, can you identify the IP address used by the attacker to carry out a brute force attack?
65.2.161.68
The brute force attempts were successful, and the attacker gained access to an account on the server. What is the username of this account?
root
Can you identify the timestamp when the attacker manually logged in to the server to carry out their objectives?
First, decode the wtmp file with utmpdump
The wtmp file indicates that at 2024-03-06T06:32:45, a shell was spawned.
2024-03-06 06:32:45
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?
37
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 user and groups created, cyberjunkie added to sudo group, indicating persistence
cyberjunkie
What is the MITRE ATT&CK sub-technique ID used for persistence?
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)
279
The attacker logged into their backdoor account and utilized their higher privileges to download a script. What is the full command executed using sudo?
Looking through this script, it looks like a tool for post exploitation to scan and assist the user to maintain persistence in the machine. Take a look!
shadow() {
if $(find /etc/shadow -readable | grep -qi shadow)
then
if [ "$DRYRUN" -eq 0 ];
then
echo -e "\e[92m[+]\e[0m Accounts with Passwords from /etc/shadow"
egrep -v "\*|\!" /etc/shadow
else
echo -e "\e[92m[+]\e[0m You Can Read /etc/shadow"
fi
echo "-----------------------"
fi
}
Comments ()