微笑一下就过了

请使用微笑过关源代码
以上为题目
打开的界面为
在这里插入图片描述

额 先看源码吧
在这里插入图片描述
发现这里指向了一个新的链接
得到php源码

<?php  
    header("Content-type: text/html; charset=utf-8");
    if (isset($_GET['view-source'])) { 
        show_source(__FILE__); 
        exit(); 
    } 

    include('flag.php'); 

    $smile = 1;  

   if (!isset ($_GET['^_^'])) $smile = 0;  
    if (preg_match ('/\./', $_GET['^_^'])) $smile = 0;  
    if (preg_match ('/%/', $_GET['^_^'])) $smile = 0;  
    if (preg_match ('/[0-9]/', $_GET['^_^'])) $smile = 0;  
    if (preg_match ('/http/', $_GET['^_^']) ) $smile = 0;  
    if (preg_match ('/https/', $_GET['^_^']) ) $smile = 0;  
    if (preg_match ('/ftp/', $_GET['^_^'])) $smile = 0;  
    if (preg_match ('/telnet/', $_GET['^_^'])) $smile = 0;  
    if (preg_match ('/_/', $_SERVER['QUERY_STRING'])) $smile = 0; 
    if ($smile) { 
        if (@file_exists ($_GET['^_^'])) $smile = 0;  
    }  
    if ($smile) { 
        $smile = @file_get_contents ($_GET['^_^']);  
        if ($smile === "(●'◡'●)") die($flag);  
    }  
?>  
<!doctype html> 
<html lang="en"> 

<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
<title>Show me your smile :)</title> 
<link rel="stylesheet" href="style.css"> 
</head> 

<body> 
<br><br><br><br><br><br><br> 
<div class="loginform cf"> 
    <form name="login" action="index.php" method="POST" accept-charset="utf-8"> 
        <ul> 
            <li> 
                <label for="SMILE">请使用微笑过关<a href="?view-source">源代码</a></label> 
                <input type="text" name="T_T" placeholder="where is your smile" required> 
            </li> 
            <li><input type="submit" value="Show"> </li> 
        </ul> 
    </form> 
</div> 
<div style="text-align:center;clear:both"> 
</div> 
</body> 

</html> 

1.必须对"^_^"赋值 2."^_^"的值不能有 . % [0-9] http https ftp telnet 这些东西 3.$_SERVER['QUERY_STRING'],即"^_^=(输入的值)"这个字符串不能有 _ 这个字符 4.满足$smile!=0 5.file_exists ($_GET['^_^'])必须为0.也就是$_GET['^_^']此文件不存在 6."$smile"必须等于"(●'◡'●)".也就是file_get_contents($_GET['^_^'])必须为"(●'◡'●)"

仔细分析可以发现,第3点与第1点矛盾了,既要对"^_^"赋值,又得想办法去掉"^_^"中的"_",那么可以采用Url编码变为"%5f".这样第3点就满足了.所以我们输入就应该为 "^%5f^".继续分析第2点,这个地方把 http https ftp telnet 这些给过滤了,而第6点又要通过file_get_contents()取出$_GET['^_^']里的值.而根据第5点,$_GET['^_^']又必须不存在.所以$_GET['^_^']只能是字符串"(●'◡'●)",不可能是文件名.那么file_get_contents()里的参数应该是啥呢.查了一下,发现data://完美符合.所以我们输入就应该为"^%5f^=data:,(●'◡'●)"

正确的payload
http://lab1.xseclab.com/base13_ead1b12e47ec7cc5390303831b779d47/index.php?^%5f^=data:,(●'◡'●)

得到hkjasfhsa*&IUHKUH

参考资料

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值