【靶场训练_DVWA】Command Execution
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的更多相关文章
- PowerShell vs. PsExec for Remote Command Execution
Posted by Jianpeng Mo / January 20, 2014 Monitoring and maintaining large-scale, complex, highly dis ...
- 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 ...
- 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 ...
- MYSQL报Fatal error encountered during command execution.错误的解决方法
{MySql.Data.MySqlClient.MySqlException (0x80004005): Fatal error encountered during command executio ...
- 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 ...
- JMX/RMI Nice ENGAGE <= 6.5 Remote Command Execution
CVE ID : CVE-2019-7727 JMX/RMI Nice ENGAGE <= 6.5 Remote Command Execution description=========== ...
- Fatal error encountered during command execution
MySQL + .net + EF 开发环境,调用一处sql语句报错: Fatal error encountered during command execution[sql] view plain ...
- [EXP]Apache Spark - Unauthenticated Command Execution (Metasploit)
## # This module requires Metasploit: https://metasploit.com/download # Current source: https://gith ...
- [EXP]Jenkins 2.150.2 - Remote Command Execution (Metasploit)
## # This module requires Metasploit: https://metasploit.com/download # Current source: https://gith ...
随机推荐
- mariadb(二)增删改
一.表的结构的增删改 添加数据类型 alter table 表名 add 字段 数据类型: #如果字段存在则会报错 Duplicate column name '字段' #修改数据类型 alter t ...
- Win10.设置(放大)
1.ZC:我从感觉,我在Win10 里面截图 貌似被放大了,尤其是 在往cnblogs里面贴图的时候 比较明显,于是 度娘“Win10 自动放大”,找到如下帖子,里面有 2种设置方式: win10系 ...
- JS截取与分割字符串
1.substr 方法 返回一个从指定位置开始的指定长度的子字符串. stringvar.substr(start [, length ]) start :必选项.所需的子字符串的起始位置.字符串中的 ...
- ubuntu server 12.04安装任何软件都出现the following packages have unmet dependencies的解决方法
虽然目前没太弄清这到底是怎么回事,但是暂时可以给出一个解决的方法, 如果在安装任何软件都会出现这个问题,那么尝试着输入sudo apt-get install -f试一下. 在该命令执行完成后,我这边 ...
- Django文件上传下载与富文本编辑框
django文件上传下载 上传 配置settings.py # 设定文件的访问路径,如:访问http://127.0.0.1:8000/media/就可以获取文件 MEDIA_URL = '/medi ...
- CodeChef GCD2
GCD2 Problem code: GCD2 Submit All Submissions All submissions for this problem are available. ...
- python学习第一天变量命名规范和变量作用
变量的命名 python中的变量跟其他编程语言变量一样 1,由字母,下划线,数字组成 2,数字不能做变量名开头 3,变量名尽量有意义和短,,也可以驼峰,不要很low ,比如说是 中文,变量名很长 py ...
- JavaScript 中的 Function.prototype.bind() 方法
转载自:https://www.cnblogs.com/zztt/p/4122352.html Function.prototype.bind()方法 bind() 方法的主要作用就是将函数绑定至某个 ...
- docker镜像源设置
由于docker默认镜像源为国外官方源,下载速度较慢.设置国内镜像源可加速 修改文件 /etc/docker/daemon.json vi /etc/docker/daemon.json 添加以下内容 ...
- JAVA-第一期学习(上)
前言 果然,flag这个东西不能随便立,在我立志要学习java的第4天,我终于打开了我的eclipse.. 本章学习的内容是红框,第一期学习.真好,7月份需要学习完的东西,现在连helloworld还 ...