您当前的位置: 首页 >  php

Z3eyOnd

暂无认证

  • 2浏览

    0关注

    117博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

php特性<2>--ctfshow

Z3eyOnd 发布时间:2021-11-01 20:33:33 ,浏览量:2

文章目录
    • 1.sha1的绕过
      • web104,106
    • 2.php变量覆盖
      • web105
    • 3.parse_str的绕过
      • web107
    • 4.ereg %00正则截断
      • web108
    • 5.php异常类
      • web109
    • 6.FilesystemIterator类的使用
      • web110
    • 7.GLOBALS超全局变量
      • web111
    • 8.php伪协议
      • WEB112
    • 9./proc/self/root绕过
      • web113
    • 10. php伪协议--filter
      • web114
    • 11.trim函数的绕过+is_numeric的绕过
      • web115
    • 12.gettext拓展的使用
      • web128
    • 13.stripos()函数
    • web129
    • 14.正则最大回溯次数绕过
      • web130,131
    • 15.&&与||的优先级
      • web132

1.sha1的绕过 web104,106
highlight_file(__FILE__);
include("flag.php");

if(isset($_POST['v1']) && isset($_GET['v2'])){
    $v1 = $_POST['v1'];
    $v2 = $_GET['v2'];
    if(sha1($v1)==sha1($v2) && $v1!=$v2){
        echo $flag;
    }
} 

利用了sha1弱类型比较,跟MD5加密是一样的

利用数组绕过或者弱类型绕过

payload

GET:v2[]=1
POST:v1[]=2
还有一些字符串
aaroZmOk
aaK1STfY
aaO8zKZF
aa3OFF9m

如果是强类型转换

if(sha1($v1)===sha1($v2) && $v1!=$v2){
        echo $flag;
    }
使用数组绕过,v1[]=1&v2[]=2

但是还有一种,直接把数组过滤了

if(is_array($_GET['name']) || is_array($_GET['password']))
        die('There is no way you can sneak me, young man!');
 else if (sha1($_GET['name']) === sha1($_GET['password']))
      	echo $flag;

我们不能用数组了

还有一种payload

name=%25PDF-1.3%0A%25%E2%E3%CF%D3%0A%0A%0A1%200%20obj%0A%3C%3C/Width%202%200%20R/Height%203%200%20R/Type%204%200%20R/Subtype%205%200%20R/Filter%206%200%20R/ColorSpace%207%200%20R/Length%208%200%20R/BitsPerComponent%208%3E%3E%0Astream%0A%FF%D8%FF%FE%00%24SHA-1%20is%20dead%21%21%21%21%21%85/%EC%09%239u%9C9%B1%A1%C6%3CL%97%E1%FF%FE%01%7FF%DC%93%A6%B6%7E%01%3B%02%9A%AA%1D%B2V%0BE%CAg%D6%88%C7%F8K%8CLy%1F%E0%2B%3D%F6%14%F8m%B1i%09%01%C5kE%C1S%0A%FE%DF%B7%608%E9rr/%E7%ADr%8F%0EI%04%E0F%C20W%0F%E9%D4%13%98%AB%E1.%F5%BC%94%2B%E35B%A4%80-%98%B5%D7%0F%2A3.%C3%7F%AC5%14%E7M%DC%0F%2C%C1%A8t%CD%0Cx0Z%21Vda0%97%89%60k%D0%BF%3F%98%CD%A8%04F%29%A1
&password=%25PDF-1.3%0A%25%E2%E3%CF%D3%0A%0A%0A1%200%20obj%0A%3C%3C/Width%202%200%20R/Height%203%200%20R/Type%204%200%20R/Subtype%205%200%20R/Filter%206%200%20R/ColorSpace%207%200%20R/Length%208%200%20R/BitsPerComponent%208%3E%3E%0Astream%0A%FF%D8%FF%FE%00%24SHA-1%20is%20dead%21%21%21%21%21%85/%EC%09%239u%9C9%B1%A1%C6%3CL%97%E1%FF%FE%01sF%DC%91f%B6%7E%11%8F%02%9A%B6%21%B2V%0F%F9%CAg%CC%A8%C7%F8%5B%A8Ly%03%0C%2B%3D%E2%18%F8m%B3%A9%09%01%D5%DFE%C1O%26%FE%DF%B3%DC8%E9j%C2/%E7%BDr%8F%0EE%BC%E0F%D2%3CW%0F%EB%14%13%98%BBU.%F5%A0%A8%2B%E31%FE%A4%807%B8%B5%D7%1F%0E3.%DF%93%AC5%00%EBM%DC%0D%EC%C1%A8dy%0Cx%2Cv%21V%60%DD0%97%91%D0k%D0%AF%3F%98%CD%A4%BCF%29%B1 
2.php变量覆盖 web105
highlight_file(__FILE__);
include('flag.php');
error_reporting(0);
$error='你还想要flag嘛?';
$suces='既然你想要那给你吧!';
foreach($_GET as $key => $value){
    if($key==='error'){
        die("what are you doing?!");
    }
    $$key=$$value;
}foreach($_POST as $key => $value){
    if($value==='flag'){
        die("what are you doing?!");
    }
    $$key=$$value;
}
if(!($_POST['flag']==$flag)){
    die($error);
}
echo "your are good".$flag."\n";
die($suces);

首先审计代码,先读懂 k e y = key= key=value


$foo in global scope: Example content
$foo in current scope: local variable
如果全局变量的foo没有,函数中$GLOBALS输出不了
13.stripos()函数 web129

代码

             
关注
打赏
1651657201
查看更多评论
0.0483s