目录
命令注入(Command Injection),是指在某些需要输入数据的位置,还构造了恶意的代码破坏了原先的语句结构。而系统缺少有效的过滤,最终达到破坏数据、信息泄露甚至掌控电脑的目的。许多内容管理系统CMS存在命令注入漏洞。
判断命令注入流程:
是否调用系统命令 函数或函数的参数是否可控 是否拼接注入命令
命令连接符
command1 && command2:&&表示先执行command1,执行成功后执行command 2,否则不执行command 2 ; command1 & command2:&表示先执行command 1,不管是否成功,都会执行command 2; command1 || command2:||表示先执行command1,执行失败后,执行command2; command1 | command2:|表示将command 1的输出作为command 2的输入,只打印command 2执行的结果。以上连接符在windows和linux环境下都支持。
Low
源码:
<?php
if( isset( $_POST[ 'Submit' ] ) ) {
// Get input
$target = $_REQUEST[ 'ip' ];
// Determine OS and execute the ping command.
if( stristr( php_uname( 's' ), 'Windows NT' ) ) {
// Windows