Table of Contents

PHP数组特性

$stuff = $_POST["stuff"];
$array = ['admin', 'user'];
if($stuff === $array && $stuff[0] != 'admin') {

poc:

$stuff=array(0x100000000=>'admin',1=>'user');
$array = ['admin','user'];

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/28e1c297-79d9-48f6-9809-e546c279e5e3/rId21.png

image.png

isset&&empty特性

isset 判断变量是否已存在,如果变量存在则返回 TRUE,否则返回 FALSE。 empty 判断变量是否为空,如果变量是非空 或非零 的值,则 empty() 返回 FALSE。换句话说,"" 、0 、“0”、NULL 、FALSE 、array() 、var $var; 以及没有任何属性的对象 都将被认为是空的,如果变量为空,则返回TRUE。

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/fa220cdd-96ec-4984-9ead-df8b94438402/rId23.png

image.png

in_array()&&array_search()特性

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/96812b06-45a8-48f0-a4e2-e143bfe66884/rId25.png

image.png

https://github.com/wonderkun/CTF_web/tree/master/php4fun 题目心得:

PHP弱类型导致的BUG,当$var是一个字符串/数组的时候,访问$var[“any string”]跟访问$var[intval(“any string”)]效果是一样的

parse_url()的BUG

参考:http://www.am0s.com/functions/406.html

$_REQUEST特性

REQUEST的取值方式是按照$GET、$POST和$COOKIE的顺序取值$GET、$POST、_COOKIE中存在同名变量时,后面的变量会覆盖掉前面的变量。