In today's lab walkthrough we will be taking another look at the BTLO lab called "Paranoid". Instead of using Kali Purple like last time we'll be using REMnux, a VM specifically made for analysis; like last time, if you want to try these out for yourself I urge you to isolate any malware or files inside a virtual machine. This can ensure that your host stays secure.
Today, we'll be diving into exploits, privledge escalation, and how to identify these kind of attacks. One thing you should know this is not a "real" attacker, only simulated. These attacks can and do happen out in the wild.
I'm not paranoid, you are.
(My note - I figured there would be more to the scenario)
What account was compromised? Question 1
We have a file called "audit.log", instead of executing the file to open we'll be using 'cat' to read it in our terminal. Boy, I just opened it and it is a long one. So we'll do a few things here, using only 'grep'. Using 'grep' to actively search for key words throughout the file is the easiest thing we can do when sifting through this log. When we use the command 'grep -rnw login' we get this output:
audit.log:2698:type=USER_LOGIN msg=audit(1633393374.700:465885): pid=809339 uid=0 auid=4294967295 ses=4294967295 subj=unconfined msg='op=login acct="btlo" exe="/usr/sbin/sshd" hostname=? addr=192.168.4.155 terminal=sshd res=failed'
audit.log:2708:type=USER_LOGIN msg=audit(1633393374.700:465889): pid=809335 uid=0 auid=4294967295 ses=4294967295 subj=unconfined msg='op=login acct="btlo" exe="/usr/sbin/sshd" hostname=? addr=192.168.4.155 terminal=sshd res=failed'
audit.log:2718:type=USER_LOGIN msg=audit(1633393374.744:465893): pid=809346 uid=0 auid=4294967295 ses=4294967295 subj=unconfined msg='op=login acct="btlo" exe="/usr/sbin/sshd" hostname=? addr=192.168.4.155 terminal=sshd res=failed'
audit.log:2728:type=USER_LOGIN msg=audit(1633393374.744:465897): pid=809344 uid=0 auid=4294967295 ses=4294967295 subj=unconfined msg='op=login acct="btlo" exe="/usr/sbin/sshd" hostname=? addr=192.168.4.155 terminal=sshd res=failed'
audit.log:2738:type=USER_LOGIN msg=audit(1633393374.752:465901): pid=809347 uid=0 auid=4294967295 ses=4294967295 subj=unconfined msg='op=login acct="btlo" exe="/usr/sbin/sshd" hostname=? addr=192.168.4.155 terminal=sshd res=failed'
audit.log:2748:type=USER_LOGIN msg=audit(1633393374.752:465905): pid=809349 uid=0 auid=4294967295 ses=4294967295 subj=unconfined msg='op=login acct="btlo" exe="/usr/sbin/sshd" hostname=? addr=192.168.4.155 terminal=sshd res=failed'
audit.log:2758:type=USER_LOGIN msg=audit(1633393374.756:465909): pid=809348 uid=0 auid=4294967295 ses=4294967295 subj=unconfined msg='op=login acct="btlo" exe="/usr/sbin/sshd" hostname=? addr=192.168.4.155 terminal=sshd res=failed'
audit.log:2768:type=USER_LOGIN msg=audit(1633393374.888:465913): pid=809350 uid=0 auid=4294967295 ses=4294967295 subj=unconfined msg='op=login acct="btlo" exe="/usr/sbin/sshd" hostname=? addr=192.168.4.155 terminal=sshd res=failed'
audit.log:5089:type=USER_LOGIN msg=audit(1633393378.287:466633): pid=809336 uid=0 auid=4294967295 ses=4294967295 subj=unconfined msg='op=login acct="btlo" exe="/usr/sbin/sshd" hostname=? addr=192.168.4.155 terminal=sshd res=failed'
audit.log:5138:type=USER_LOGIN msg=audit(1633393378.335:466649): pid=809337 uid=0 auid=4294967295 ses=4294967295 subj=unconfined msg='op=login acct="btlo" exe="/usr/sbin/sshd" hostname=? addr=192.168.4.155 terminal=sshd res=failed'
audit.log:5159:type=USER_LOGIN msg=audit(1633393378.351:466656): pid=809345 uid=0 auid=4294967295 ses=4294967295 subj=unconfined msg='op=login acct="btlo" exe="/usr/sbin/sshd" hostname=? addr=192.168.4.155 terminal=sshd res=failed'
audit.log:5169:type=USER_LOGIN msg=audit(1633393378.351:466660): pid=809343 uid=0 auid=4294967295 ses=4294967295 subj=unconfined msg='op=login acct="btlo" exe="/usr/sbin/sshd" hostname=? addr=192.168.4.155 terminal=sshd res=failed'
audit.log:5234:type=USER_LOGIN msg=audit(1633393378.431:466682): pid=809340 uid=0 auid=4294967295 ses=4294967295 subj=unconfined msg='op=login acct="btlo" exe="/usr/sbin/sshd" hostname=? addr=192.168.4.155 terminal=sshd res=failed'
audit.log:5280:type=USER_LOGIN msg=audit(1633393378.495:466696): pid=809338 uid=0 auid=4294967295 ses=4294967295 subj=unconfined msg='op=login acct="btlo" exe="/usr/sbin/sshd" hostname=? addr=192.168.4.155 terminal=sshd res=failed'
audit.log:7029:type=USER_LOGIN msg=audit(1633393388.110:467229): pid=809533 uid=0 auid=4294967295 ses=4294967295 subj=unconfined msg='op=login acct="btlo" exe="/usr/sbin/sshd" hostname=? addr=192.168.4.155 terminal=sshd res=failed'
audit.log:10761:type=USER_LOGIN msg=audit(1633393396.416:468383): pid=809533 uid=0 auid=1001 ses=49 subj=unconfined msg='op=login id=1001 exe="/usr/sbin/sshd" hostname=192.168.4.155 addr=192.168.4.155 terminal=/dev/pts/1 res=success'
audit.log:44611:type=EXECVE msg=audit(1633393543.218:474591): argc=3 a0="grep" a1="^PASS_MAX_DAYS\|^PASS_MIN_DAYS\|^PASS_WARN_AGE\|^ENCRYPT_METHOD" a2="/etc/login.defs"
audit.log:46749:type=EXECVE msg=audit(1633393545.038:475019): argc=3 a0="ls" a1="-ld" a2="/home/btlo/.local/share/keyrings/login.keyring"
audit.log:48889:type=EXECVE msg=audit(1633393546.494:475469): argc=3 a0="grep" a1="auth=" a2="/etc/login.conf"
Now this is too much to look at so we will be choosing a small snippet with the user login inside.
Here you can see near the middle of the snippet you have 'acc="btlo"', this is the account that has been compromised. We now have our answer to the first question of the BTLO Lab.
The answer is: btlo
What attack type was used to gain initial access? Question 2 / What is the attacker's IP address? Question 3
The next question asks us to figure our how the attacker has gained intitial access and what kinf of attack they did. We can actually see what they service they used to gain intital access by looking at the data snippet we already collected from our 'grep' command earlier.
Do you see that '/res=success' at the end? We see that the attacker was using what is known as a SSH Brute Force Attack, also leaving their IP Address discoverable due to the brute force. Their IP Address?
With this section complete we can now move onto the next question.
What tool was used to perform system enumeration? Question 4
When it comes to finding what tool was used on the system we'll go back and look at the log again, just another small snippet. Specifically this "exe".
Again we'll use grep to search for all the executed commands that happened on the server. Before we do that we may want to backtrack just a tad bit and go back to the successful brute force attack. This will allow us to see exactly where they started.