漏洞简介本漏洞是由escapeshellarg()和escapeshellcmd()两个函数对同一个需要过滤的shell命令字符串依次进行转义导致的参数逃逸问题,可以执行主命令的其他选修参数。escapeshellarg()与escapeshellcmd()escapeshellarg() 将给字符串增加一个单引号并且能引用或者转码任何已经存在的单引号,这样以确保能够直接将一个字符串传入shell函数,并且还是确保安全的。对于用户输入的部分参数就应该使用这个函数。shell 函数包含 exec(), system() 执行运算符 。127.0.0.1' -d -v test =>'127.0.0.1'\'' -v -d a=1'escapeshellcmd() 对字符串中可能会欺骗 shell 命令执行任意命令的字符进行转义。 此函数保证用户输入的数据在传送到 exec() 或 system() 函数,或者 执行操作符 之前进行转义。反斜线(\)会在以下字符之前插入: \`|*?~<>^()[]{}$\, \x0A 和 \xFF。 ' 和 " 仅在不配
前置知识可变变量这是PHP的一个特性,允许一个变量中的内容作为变量名使用,作用上类似于其他的指针。代码示例$a = "Cat"; $b = "a"; $$b = "Dog"; echo $a;运行结果:Dogextract()函数extract()函数从数组中将变量导入到当前的符号表。该函数使用数组键名作为变量名,使用数组键值作为变量值。针对数组中的每个元素,将在当前符号表中创建对应的一个变量。该函数返回成功设置的变量数目。用PHP代码进行实现的话:foreach($my_array as $x => $y) { $$x = $y; }参考: 菜鸟教程代码示例$a = "Original"; $my_array = array("a" => "Cat","b" => "Dog", "c" => "Horse"); extract($my_array); e
Equinox
一个乐于分享的网安人