DDCTF-web1


DDCTF-WEB1


首先观察链接发现可能存在文件包含,且jpg参数是经过一次base16,两次base64加密后的,所以构造payload读取index.php

base64解码后得到index.php

<?php
/*
 * https://blog.csdn.net/FengBanLiuYun/article/details/80616607
 * Date: July 4,2018
 */
error_reporting(E_ALL || ~E_NOTICE);


header('content-type:text/html;charset=utf-8');
if(! isset($_GET['jpg']))
    header('Refresh:0;url=./index.php?jpg=TmpZMlF6WXhOamN5UlRaQk56QTJOdz09');
$file = hex2bin(base64_decode(base64_decode($_GET['jpg'])));
echo '<title>'.$_GET['jpg'].'</title>';
$file = preg_replace("/[^a-zA-Z0-9.]+/","", $file);
echo $file.'</br>';
$file = str_replace("config","!", $file);
echo $file.'</br>';
$txt = base64_encode(file_get_contents($file));

echo "<img src='data:image/gif;base64,".$txt."'></img>";
/*
 * Can you find the flag file?
 *
 */

?>

在index.php源码中博客发现存在practice.txt.swp文件

然后继续使用文件包含读取f1ag!ddctf.php文件,(读取时要将!换成config,因为index.php替换了)

base64解码得到f1ag!ddctf.php文件源码

<?php
include('config.php');
$k = 'hello';
extract($_GET);
if(isset($uid))
{
    $content=trim(file_get_contents($k));
    if($uid==$content)
    {
        echo $flag;
    }
    else
    {
        echo'hello';
    }
}

?>

很明显变量覆盖,构造payload,得到flag.


文章作者: Danie1
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 Danie1 !
 上一篇
sqli-lab Less1-6 sqli-lab Less1-6
sqli-lab Less1-6 less-1 判断列数 payload : http://172.16.43.117/sql/Less-1/?id=-1' order by 3 --+ 回显正常 payload : http:
2019-08-24
下一篇 
CTF入坑 CTF入坑
CTF学习前言本内容主要以解题模式为学习重点,由Stalker-16成员(Danie1,7iny)整理。 day01–7iny解题模式CTF赛题目类别与能力对应· Web-Web应用的漏洞挖掘和利用· PWN-逆向分析、漏洞挖掘、漏洞
2019-08-05
  目录