矛盾
Q7nl1s admin

问题描述

php弱比较

解法

巧用弱比较

进入界面可以看到其既要使num是否为数字或者数字字符串,又要num弱比较等于0产生矛盾才输出flag

矛盾

看官方文档

is_numeric

这里看弱比较总结

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
0x01 字符串和数字比较
var_dump('a' == 0); //bool(true)
var_dump('1a' == 1); //bool(true)
var_dump('12a' == 1); //bool(false)

0x02 布尔true和任意比较
var_dump(True == 0); //bool(false)
var_dump(True == 'False'); //bool(true)
var_dump(True == 2); //bool(true)

0x03 hash值和字符串“0”比较
$str1 = "a";
echo md5($str1); //0cc175b9c0f1b6a831c399e269772661
var_dump(md5($str1) == '0'); //bool(false)
---------------------------------------------------------
$str2 = "s224534898e";
echo md5($str2); //0e420233178946742799316739797882
var_dump(md5($str2) == '0'); //bool(true)
---------------------------------------------------------
$str3 = 'a1b2edaced';
echo md5($str3); //0e45ea817f33691a3dd1f46af81166c4bool
var_dump(md5($str3) == '0'); //bool(false)
---------------------------------------------------------
var_dump('0e111111111111' == '0'); //bool(true)

了解以上知识快速得到flag

矛盾1

 Comments
Comment plugin failed to load
Loading comment plugin
Powered by Hexo & Theme Keep
Unique Visitor Page View