Vulnerable-Web-Application/CommandExecution/CommandExec-2.php

34 lines
1.3 KiB
PHP
Raw Normal View History

2018-11-27 13:32:55 +00:00
<html>
<head>
2018-11-29 13:51:09 +00:00
<link rel="shortcut icon" href="../Resources/hmbct.png" />
2018-11-27 13:32:55 +00:00
<title>CommandExec-2</title>
</head>
2018-11-29 23:46:54 +00:00
<body>
<div style="background-color:#afafaf;padding:15px;border-radius:20px 20px 0px 0px">
2018-11-27 14:46:15 +00:00
<button type="button" name="homeButton" onclick="location.href='../homepage.html';">Home Page</button>
<button type="button" name="mainButton" onclick="location.href='commandexec.html';">Main Page</button>
2018-11-27 13:32:55 +00:00
</div>
2018-11-30 00:05:11 +00:00
<div align="center" style="background-color:#c9c9c9;padding:20px;">
2018-11-29 23:50:05 +00:00
<h1 align="center">I think there is a vuln here!</h1>
2018-11-27 13:32:55 +00:00
<form align="center" action="CommandExec-2.php" method="$_GET">
2018-11-30 00:05:11 +00:00
<label align="center">Write Field:</label>
<input align="center" type="text" name="typeBox" value=""><br>
<input align="center" type="submit" value="Submit">
2018-11-27 13:32:55 +00:00
</form>
</div>
2018-11-29 23:46:54 +00:00
<div style="background-color:#ecf2d0;padding:20px;border-radius:0px 0px 20px 20px" align="center">
2018-11-27 13:32:55 +00:00
<?php
if(isset($_GET["typeBox"])){
$target =$_GET["typeBox"];
2018-11-29 23:46:54 +00:00
$substitutions = array('&&' => '',';' => '','/' => '','\\' => '' );
2018-11-27 13:32:55 +00:00
$target = str_replace(array_keys($substitutions),$substitutions,$target);
echo shell_exec($target);
2018-11-29 23:46:54 +00:00
if($_GET["typeBox"] == "Trochilidae")
2018-11-29 23:42:39 +00:00
echo "Welldone! You did great job.";
2018-11-27 13:32:55 +00:00
}
2018-11-29 23:46:54 +00:00
?>
2018-11-27 13:32:55 +00:00
</div>
</body>
</html>