Spray, Login, Backdoor
An alert fired on web01: a new account was added to the sudo group in the middle of the night. Nobody on the team made that change.
Below is /var/log/auth.log for that window. Two different IP addresses were attacking SSH using two different methods. Work out which one succeeded, which account it used and what it did after logging in.
Brute force = many passwords against one account. Password spraying = one or two common passwords against many accounts.
Nov 19 03:05:12 web01 sshd[2011]: Accepted publickey for hamza from 192.0.2.10 port 50122 ssh2: ED25519 SHA256:q8Vn3kq2bXo1yF0tW7sQeJm4hR9cL5aZpD6uK2nE1vM Nov 19 03:05:12 web01 sshd[2011]: pam_unix(sshd:session): session opened for user hamza(uid=1000) by (uid=0) Nov 19 03:09:40 web01 sshd[2011]: pam_unix(sshd:session): session closed for user hamza Nov 19 03:12:01 web01 sshd[2101]: Failed password for root from 198.51.100.23 port 51022 ssh2 Nov 19 03:12:04 web01 sshd[2101]: Failed password for root from 198.51.100.23 port 51022 ssh2 Nov 19 03:12:07 web01 sshd[2101]: Failed password for root from 198.51.100.23 port 51022 ssh2 Nov 19 03:12:09 web01 sshd[2101]: error: maximum authentication attempts exceeded for root from 198.51.100.23 port 51022 ssh2 [preauth] Nov 19 03:12:15 web01 sshd[2108]: Failed password for root from 198.51.100.23 port 51040 ssh2 Nov 19 03:12:18 web01 sshd[2108]: Failed password for root from 198.51.100.23 port 51040 ssh2 Nov 19 03:12:21 web01 sshd[2108]: Failed password for root from 198.51.100.23 port 51040 ssh2 Nov 19 03:12:23 web01 sshd[2108]: error: maximum authentication attempts exceeded for root from 198.51.100.23 port 51040 ssh2 [preauth] Nov 19 03:12:30 web01 sshd[2115]: Failed password for root from 198.51.100.23 port 51066 ssh2 Nov 19 03:12:33 web01 sshd[2115]: Failed password for root from 198.51.100.23 port 51066 ssh2 Nov 19 03:15:02 web01 sshd[2140]: Failed password for invalid user admin from 203.0.113.61 port 40112 ssh2 Nov 19 03:15:31 web01 sshd[2146]: Failed password for invalid user test from 203.0.113.61 port 40180 ssh2 Nov 19 03:16:03 web01 sshd[2151]: Failed password for invalid user ubuntu from 203.0.113.61 port 40233 ssh2 Nov 19 03:16:34 web01 sshd[2155]: Failed password for invalid user oracle from 203.0.113.61 port 40271 ssh2 Nov 19 03:17:05 web01 sshd[2160]: Failed password for backup from 203.0.113.61 port 40308 ssh2 Nov 19 03:17:13 web01 sshd[2115]: error: maximum authentication attempts exceeded for root from 198.51.100.23 port 51066 ssh2 [preauth] Nov 19 03:17:36 web01 sshd[2164]: Failed password for invalid user git from 203.0.113.61 port 40350 ssh2 Nov 19 03:17:44 web01 sshd[2170]: Accepted password for deploy from 203.0.113.61 port 40391 ssh2 Nov 19 03:17:44 web01 sshd[2170]: pam_unix(sshd:session): session opened for user deploy(uid=1001) by (uid=0) Nov 19 03:18:30 web01 sudo: deploy : TTY=pts/0 ; PWD=/home/deploy ; USER=root ; COMMAND=/usr/bin/cat /etc/shadow Nov 19 03:18:30 web01 sudo: pam_unix(sudo:session): session opened for user root(uid=0) by deploy(uid=1001) Nov 19 03:18:30 web01 sudo: pam_unix(sudo:session): session closed for user root Nov 19 03:19:02 web01 sudo: deploy : TTY=pts/0 ; PWD=/home/deploy ; USER=root ; COMMAND=/usr/sbin/useradd -m -s /bin/bash -G sudo support Nov 19 03:19:02 web01 useradd[2201]: new group: name=support, GID=1003 Nov 19 03:19:02 web01 useradd[2201]: new user: name=support, UID=1003, GID=1003, home=/home/support, shell=/bin/bash, from=/dev/pts/0 Nov 19 03:19:02 web01 useradd[2201]: add 'support' to group 'sudo' Nov 19 03:19:20 web01 sudo: deploy : TTY=pts/0 ; PWD=/home/deploy ; USER=root ; COMMAND=/usr/bin/passwd support Nov 19 03:19:31 web01 passwd[2207]: pam_unix(passwd:chauthtok): password changed for support Nov 19 03:20:11 web01 sshd[2170]: pam_unix(sshd:session): session closed for user deploy Nov 19 03:24:57 web01 sshd[2230]: Accepted password for support from 203.0.113.61 port 40502 ssh2 Nov 19 03:24:57 web01 sshd[2230]: pam_unix(sshd:session): session opened for user support(uid=1003) by (uid=0)
Need help? Review: Detecting Brute Force · Incident Response Basics · Users, Processes and Services · Lab: Brute Force Detective
Q1. Which IP address was password spraying (trying many different usernames)?
Q2. Which account was compromised by the spraying attack?
Q3. At what time did the attacker first log in successfully? Use HH:MM:SS.
Q4. Which sensitive file did the attacker read with sudo straight after logging in?
Q5. What is the name of the backdoor account the attacker created?
Q6. Which response plan is right?