shacker_shen

导航

攻防世界Web_fakebook

一、题目:

解题思路:

 

  1.先使用dirsearch扫描一下目录。

 

  

 

 

  发现有以下几个页面:

 

  

           

 

    

 

  

 

 

  发现/flag.php 访问发现返回空白页面。这种情况一般要么就本身是空白内容,要么就是访问权限不够,显然是后者。

 

  然后发现/robots.txt访问一下。

 

  

 

 

    不允许访问/user.php.bak  这是个用户备份文件,访问一下看看。

   

   直接下载打开,内容如下: 

<?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_setopt($ch, CURLOPT_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);
    }

}
// 代码审计一下:
// 定义了一个UserInfo的类,类中有3个变量 4个函数 __construct()函数:实例化对象,会序列化对象 get()函数:获取url getBlogContents()函数:获取blog内容 isValidBlog()函数:正则匹配判断是否是有效blog

 

解法一:

   先注册1个账号登入,只对blog做了正则匹配,但好像只要有.就可以绕过,其他内容都没做过滤。

  

 

   

 

 发现有连接,点击一下看看。发现?no=1 应该是个注入点,尝试sql注入。

 

 1)盲注 判断是否注入点  no=1 and 1=1# 成功     no=1 and 1=2# 失败

 

 

 

 发现报错回显到age blog内容中了,还发现路径,即flag应该在 /var/www/html/flag.php下。

 

 2)order by 判断有4个表项

 

 

  3)union select 查询数据库, 发现应该做了防护,测试发现过滤了大小写的union select ,可以通过 union /**/ select  或union ++ select绕过

 

 

 发现2的位置可以利用。

4)爆出数据库  用户名

 

 

 发现是管理员用户,权限很大。mysql中load_file()函数读取/var/www/html/flag.php返回字符串。

 

 发现空白view-source:http://url查看一下源码。

 

 找到flag.

解法二:WP上的反序列化可以找到,直接贴图了。

 

posted on 2022-03-02 18:08  shacker_shen  阅读(169)  评论(0编辑  收藏  举报