您的位置:首页 > 游戏 > 游戏 > 北京app制作_专业公司网站设计企业_外贸网络营销平台_国内新闻摘抄

北京app制作_专业公司网站设计企业_外贸网络营销平台_国内新闻摘抄

2025/2/13 17:51:24 来源:https://blog.csdn.net/yzasts/article/details/145568509  浏览:    关键词:北京app制作_专业公司网站设计企业_外贸网络营销平台_国内新闻摘抄
北京app制作_专业公司网站设计企业_外贸网络营销平台_国内新闻摘抄

一、命令执行

low

该级别没有对输入进行任何过滤。

输入:127.0.0.1 && whoami

源码分析

<?phpif( isset( $_POST[ 'Submit' ]  ) ) { //检测是否已经提交// Get input$target = $_REQUEST[ 'ip' ]; #接受ip参数值,赋值给target// Determine OS and execute the ping command. 确定操作系统并执行ping命令。if( stristr( php_uname( 's' ), 'Windows NT' ) ) { #判断是否为windows操作系统// Windows$cmd = shell_exec( 'ping  ' . $target );}else {// *nix$cmd = shell_exec( 'ping  -c 4 ' . $target );}// Feedback for the end userecho "<pre>{$cmd}</pre>"; ##前端回显结果
}?> 

isset() 函数用于检测变量是否已设置并且非 NULL。

php_uname() 返回运行 PHP 的系统的有关信息。

  • ‘a’:此为默认。包含序列 “s n r v m” 里的所有模式。

  • ’s’:操作系统名称。例如: FreeBSD。

  • ‘n’:主机名。例如: localhost.example.com。

  • ‘r’:版本名称,例如: 5.1.2-RELEASE。

  • ‘v’:版本信息。操作系统之间有很大的不同。

  • ‘m’:机器类型。例如:i386。

stristr("Hello world!","WORLD") 查找 "world" 在 "Hello world!" 中的第一次出现,并返回字符串的剩余部分

medium

源码分析

<?phpif( isset( $_POST[ 'Submit' ]  ) ) {// Get input$target = $_REQUEST[ 'ip' ];// Set blacklist$substitutions = array( #创建一个关联数组,每个键对应一个值'&&' => '',';'  => '',);// Remove any of the charactars in the array (blacklist). 删除数组中的任何字符(黑名单)$target = str_replace( array_keys( $substitutions ), $substitutions, $target );#将&& ; 替换为空// Determine OS and execute the ping command.if( stristr( php_uname( 's' ), 'Windows NT' ) ) {// Windows$cmd = shell_exec( 'ping  ' . $target );}else {// *nix$cmd = shell_exec( 'ping  -c 4 ' . $target );}// Feedback for the end userecho "<pre>{$cmd}</pre>";
}?>

array() 函数用于创建数组

创建关联数组:

array_keys() 返回包含数组中所有键名的一个新数组

str_replace() 把字符串 "Hello world!" 中的字符 "world" 替换成 "Peter"

<?phpecho str_replace("world","Peter","Hello world!");?>

此关对&& ; 替换为空。所以输入 127.0.0.1 & whoami进行绕过

high

源码分析

<?phpif( isset( $_POST[ 'Submit' ]  ) ) {// Get input$target = trim($_REQUEST[ 'ip' ]);// Set blacklist$substitutions = array('&'  => '',';'  => '','| ' => '','-'  => '','$'  => '','('  => '',')'  => '','`'  => '','||' => '',

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com