Open to everyone Reading, lesson 72 of 100, 2 min read
Reading an authentication log
A worked example
Here is part of a Linux server's authentication log (/var/log/auth.log on Ubuntu, or the journal for the SSH service). The addresses are from ranges reserved for documentation.
Nov 2 03:10:01 web1 sshd[2210]: Failed password for invalid user admin from 198.51.100.23 port 51122 ssh2
Nov 2 03:10:03 web1 sshd[2212]: Failed password for invalid user oracle from 198.51.100.23 port 51130 ssh2
Nov 2 03:10:05 web1 sshd[2214]: Failed password for root from 198.51.100.23 port 51141 ssh2
Nov 2 03:10:07 web1 sshd[2216]: Failed password for invalid user test from 198.51.100.23 port 51152 ssh2
Nov 2 07:45:12 web1 sshd[3301]: Accepted publickey for ada from 192.0.2.10 port 60211 ssh2
Nov 2 13:02:44 web1 sshd[4120]: Failed password for tunde from 203.0.113.77 port 40022 ssh2
Nov 2 13:02:51 web1 sshd[4122]: Failed password for tunde from 203.0.113.77 port 40031 ssh2
Nov 2 13:03:02 web1 sshd[4125]: Accepted password for tunde from 203.0.113.77 port 40040 ssh2
Nov 2 13:03:30 web1 sudo: tunde : TTY=pts/0 ; PWD=/home/tunde ; USER=root ; COMMAND=/usr/sbin/useradd -m support2What the lines say
- 03:10: one address tries common account names (
admin,oracle,root,test) every two seconds. That is an automated scan guessing passwords. It failed, but it shows that password sign-in is open to the internet. - 07:45: Ada signs in with a key, from the usual office address. Normal.
- 13:02 to 13:03: two failed passwords for
tunde, then success, from an address not seen before. - 13:03:30: thirty seconds later,
tundeusessudoto create a new account calledsupport2.
Questions an analyst asks
- Is
203.0.113.77a place Tunde normally works from? Was he working at 13:00? - Why did Tunde sign in with a password when Ada uses a key? Are passwords allowed for SSH on this server?
- Did Tunde really create
support2? A new account straight after a suspicious sign-in is a classic sign of an attacker setting up persistence.
Useful commands on your own practice server
bash
sudo grep "Failed password" /var/log/auth.log | wc -l
sudo grep "Accepted" /var/log/auth.log
sudo journalctl -u ssh --since today
lastlogNote
This module's assignment gives you a longer log and asks you to write up what happened, what you would check next and what you would change.