【靶场训练_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 ...
随机推荐
- socketpair
与pipe的区别 pipe产生的文件描述符是半双工的,需要pipe两次才能实现全双工,产生的两个描述符是一个读,一个写 socketpair直接就可以全双工,产生的两个文件描述符的任何一个都可读可写 ...
- IOS-swift5.1快速入门之旅
快速之旅 传统表明,新语言中的第一个程序应在屏幕上打印“Hello,world!”字样.在Swift中,这可以在一行中完成: print("Hello, world!") // P ...
- bfs(火星撞地球)
Meteor Shower 链接:https://ac.nowcoder.com/acm/contest/997/I来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 327 ...
- BZOJ 1109 (LIS)
题面 传送门 分析 设dp[i]是第i个积木在自己的位置上时,前i个积木中最多能回到自己位置的数目. \(dp[i]=max(dp[j])+1 (i>j,a[i]>a[j],a[i]-a[ ...
- /dev/random vs /dev/urandom
If you want random data in a Linux/Unix type OS, the standard way to do so is to use /dev/random or ...
- 2019牛客暑期多校训练营(第一场) - B - Integration - 数学
https://ac.nowcoder.com/acm/contest/881/B https://www.cnblogs.com/zaq19970105/p/11210030.html 试图改写多项 ...
- 关于Echarts的使用和遇到的问题
对于插件工具,感觉按着官方的教程,便可以使用,但是看这个Echarts有点晕乎乎的,还是不能快速的学习啊. 一.在webpack中使用ECharts //通过 npm 获取 echartsnpm in ...
- JavaScript的变量作用域
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- 2. ZooKeeper基础
1. ZooKeeper的特性 ZooKeeper的特性主要从会话.数据节点,版本,Watcher,ACL权限控制,集群角色这些部分来了解,其中需要重点掌握的数据节点与Watcher 1.1 会话 客 ...
- 开源Futter项目
前段时间Flutter很火,所以在闲暇之余做了一个助学通的Flutter移动端应用,现在开源出来,希望对想要学习Flutter的朋友有所帮助. 我大致做个项目介绍: 学生签到系统:分java服务端提供 ...