【靶场训练_DVWA】Command Execution
发布时间:2020-12-13 21:29:41 所属栏目:PHP教程 来源:网络整理
导读:low 利用: ; ls ../../ ? ? ?源码分析: ? php if ( isset ( $_POST [ ‘submit‘ ] ) ) { // 将ip对应的值复制给target $target = $_REQUEST [ ‘ip‘ ]; if ( stristr ( php_uname (‘s‘),‘Windows NT‘ )) { // 如果是winds就直接ping $cmd = shell_ex
low利用:;ls ../../
? ? ?源码分析:<?php if( isset( $_POST[ ‘submit‘ ] ) ) { //将ip对应的值复制给target $target = $_REQUEST[ ‘ip‘ ]; if (stristr(php_uname(‘s‘),‘Windows NT‘)) { //如果是winds就直接ping $cmd = shell_exec( ‘ping ‘ . $target ); echo ‘<pre>‘.$cmd.‘</pre>‘; } else { //如果是Linux就默认ping 3个包 $cmd = shell_exec( ‘ping -c 3 ‘ . $target ); echo ‘<pre>‘.$cmd.‘</pre>‘; } } ?>
? Medium利用:|| 或者 &;& 或者 & ? 源码分析:?就多了一点过滤,但是没过滤完整 <?php if( isset( $_POST[ ‘submit‘] ) ) { $target = $_REQUEST[ ‘ip‘ ]; // 过滤了 &&,;命令分割符 $substitutions = array( ‘&&‘ => ‘‘,‘;‘ => ‘‘, ); $target = str_replace( array_keys( $substitutions ),$substitutions,$target ); // Determine OS and execute the ping command. if (stristr(php_uname(‘s‘),‘Windows NT‘)) { $cmd = shell_exec( ‘ping ‘ . $target ); echo ‘<pre>‘.$cmd.‘</pre>‘; } else { $cmd = shell_exec( ‘ping -c 3 ‘ . $target ); echo ‘<pre>‘.$cmd.‘</pre>‘; } } ?> High无能为力了Orz,只有诸如“数字.数字.数字.数字”的输入才会被接收执行. <?php if( isset( $_POST[ ‘submit‘ ] ) ) { $target = $_REQUEST["ip"]; /* stripslashes() 函数删除由 addslashes() 函数添加的反斜杠。 */ $target = stripslashes( $target ); // Split the IP into 4 octects $octet = explode(".",$target); // Check IF each octet is an integer if ((is_numeric($octet[0])) && (is_numeric($octet[1])) && (is_numeric($octet[2])) && (is_numeric($octet[3])) && (sizeof($octet) == 4) ) { // If all 4 octets are int‘s put the IP back together. $target = $octet[0].‘.‘.$octet[1].‘.‘.$octet[2].‘.‘.$octet[3]; // Determine OS and execute the ping command. if (stristr(php_uname(‘s‘),‘Windows NT‘)) { $cmd = shell_exec( ‘ping ‘ . $target ); echo ‘<pre>‘.$cmd.‘</pre>‘; } else { $cmd = shell_exec( ‘ping -c 3 ‘ . $target ); echo ‘<pre>‘.$cmd.‘</pre>‘; } } else { echo ‘<pre>ERROR: You have entered an invalid IP</pre>‘; } } ?> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |