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. ArrayList 源码解读

    ArrayList 源码解读     基于JDk 1.7.0_80 public class ArrayList<E> extends AbstractList<E> impl ...

  2. IsAjaxRequest

    具体来说,IsAjaxRequest代码可以分解为以下功能: public static bool IsAjaxRequest(this HttpRequestBase request) { if ( ...

  3. 远控CVE整理

    Windows: CVE-2017-8464(通过快捷方式,可U盘/共享等途径传播)

  4. C++学习笔记(四)--指针

    1.指针(变量的地址): 指针变量:存放指针(地址)的变量 直接存取(访问):按变量地址取值 间接存取(访问):将变量的地址放入指针变量中 定义指针变量:基类型 *指针变量名 2.与指针有关的运算符: ...

  5. ssh公私钥免密登陆

    简介ssh Secure Shell(简写SSH) 为一项建立在应用层和传输层基础上的安全协议,专门为远程登录会话和其他网络服务提供安全性的协议. SSH安全机制分为两种,一种是基于口令的安全认证,一 ...

  6. spring cloud gateway获取response body

    网关发起请求后,微服务返回的response的值要经过网关才发给客户端.本文主要讲解在spring cloud gateway 的过滤器中获取微服务的返回值,因为很多情况我们需要对这个返回进行处理.网 ...

  7. 阿里巴巴离线数据同步工具/平台datax安装、使用笔记

    废话不多说,直接上笔记,先来看下参考链接GitHub: https://github.com/alibaba/DataX.此链接有较详细的安装使用方法,还有json参数编写的文档说明,建议多看. Fi ...

  8. no suitable HttpMessageConverter found for response type

    在使用 RestTemplate 或者 Spring Cloud 的时候,经常会出现这个错误. 基本上出现的场景都是,我们要json,结果来了个 text/html. 两个原因: 第一个就是:服务器返 ...

  9. 20191114PHP文件操作

    <meta charset="utf-8"><?php// $fn=fopen("c:\\abc.txt","w"); / ...

  10. Git--02 Devops介绍及git安装部署

    目录 1. Devops介绍 01. 运维介绍 02. Devops是什么 03. Devops能干嘛 04. Devops如何实现 2. Git版本控制系统 01. 版本控制系统简介 02. 为什么 ...