打开题目连接,获得源码:
<?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!';
}
?>
分析代码:
- $_GET[‘id’] = urldecode($_GET[‘id’]):需要注意$_GET本身会对用户传来的参数进行一次url解码,因此这相当于进行了两次url解码
- sha1( G E T