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>'; } }
?>
  • $_REQUEST[]具用$_POST[] $_GET[]的功能,但是$_REQUEST[]比较慢。通过post和get方法提交的所有数据都可以通过$_REQUEST数组获得
  • php_uname — 返回运行 PHP 的系统的有关信息
  • stristr() 函数搜索字符串在另一字符串中的第一次出现
  • php_uname('s'):返回操作系统名称

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>';
} } ?>

【靶场训练_DVWA】Command Execution的更多相关文章

  1. PowerShell vs. PsExec for Remote Command Execution

    Posted by Jianpeng Mo / January 20, 2014 Monitoring and maintaining large-scale, complex, highly dis ...

  2. struts2 CVE-2012-0392 S2-008 Strict DMI does not work correctly allows remote command execution and arbitrary file overwrite

    catalog . Description . Effected Scope . Exploit Analysis . Principle Of Vulnerability . Patch Fix 1 ...

  3. struts2 CVE-2010-1870 S2-005 XWork ParameterInterceptors bypass allows remote command execution

    catalog . Description . Effected Scope . Exploit Analysis . Principle Of Vulnerability . Patch Fix 1 ...

  4. MYSQL报Fatal error encountered during command execution.错误的解决方法

    {MySql.Data.MySqlClient.MySqlException (0x80004005): Fatal error encountered during command executio ...

  5. My SQL和LINQ 实现ROW_NUMBER() OVER以及Fatal error encountered during command execution

    Oracle 和SQL server都有ROW_NUMBER() OVER这个功能函数,主要用于分组排序,而MySQL 却没有 SELECT * FROM (SELECT ROW_NUMBER() O ...

  6. JMX/RMI Nice ENGAGE <= 6.5 Remote Command Execution

    CVE ID : CVE-2019-7727 JMX/RMI Nice ENGAGE <= 6.5 Remote Command Execution description=========== ...

  7. Fatal error encountered during command execution

    MySQL + .net + EF 开发环境,调用一处sql语句报错: Fatal error encountered during command execution[sql] view plain ...

  8. [EXP]Apache Spark - Unauthenticated Command Execution (Metasploit)

    ## # This module requires Metasploit: https://metasploit.com/download # Current source: https://gith ...

  9. [EXP]Jenkins 2.150.2 - Remote Command Execution (Metasploit)

    ## # This module requires Metasploit: https://metasploit.com/download # Current source: https://gith ...

随机推荐

  1. Python算法每日一题--002--求众数

    给定一个大小为 n 的数组,找到其中的众数.众数是指在数组中出现次数大于 ⌊ n/2 ⌋ 的元素. 你可以假设数组是非空的,并且给定的数组总是存在众数. 示例 1: 输入: [3,2,3]输出: 3示 ...

  2. 使用pycharm调试远程服务器上的程序

    一.PyCharm实现远程调试代码 1. 和远程服务器建立连接,tools àDeploymentàConfiguration 2. 点击“+”号,按照远程服务器信息配置信息 点击“Advanced ...

  3. 自定义ThreadLocal和事务(基于自定义AOP)

    参考<架构探险--从零开始写javaweb框架>4.6章节 自定义ThreadLocal package smart; import java.util.Collections; impo ...

  4. spring-第二篇ApplicationContext国际化及事件机制

    1.ApplicationContext接口获取spring容器      ApplicationContext是BeanFactory接口的子接口,BeanFactory的常用实现类是Default ...

  5. SpringBoot实现上传下载(二)

    这篇写下载. **1.实现思路** 上一篇的数据库设计中,我们有一个字段始终没有用到fileName,这是用来给Layer对象存储文件名的,以此来完成文件与对象的对应, ![image.png](ht ...

  6. KNN算法案例--手写数字识别

    import numpy as np import matplotlib .pyplot as plt import pandas as pd from sklearn.neighbors impor ...

  7. 关于分布式唯一ID,snowflake的一些思考及改进(完美解决时钟回拨问题)

    1.写唯一ID生成器的原由 在阅读工程源码的时候,发现有一个工具职责生成一个消息ID,方便进行全链路的查询,实现方式特别简单,核心源码不过两行,根据时间戳以及随机数生成一个ID,这种算法ID在分布式系 ...

  8. C#中XmlTextWriter读写xml文件详细介绍

    XmlTextWriter类允许你将XML写到一个文件中去.这个类包含了很多方法和属性,使用这些属性和方法可以使你更容易地处理XML.为了使用这个类,你必须首先创建一个新的XmlTextWriter对 ...

  9. c#catch循环内捕获到异常继续循环

    一,如果我们将异常而不影响循环,如下代码: using System; using System.Collections.Generic; using System.Linq; using Syste ...

  10. 【问题解决方案】关于Python中的语句 ' %matplotlib inline '

    跟进小项目#GirlsInAI#-可视化时遇到的语句,之前没有遇到过 在Stack Overflow上看到了一个解释: IPython有一组预定义的"魔术函数",您可以使用命令行样 ...