forked from orangetw/My-CTF-Web-Challenges
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
41 lines (36 loc) · 970 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<meta name="author" content="Orange Tsai">
<title> Use After FLEE</title>
<style>
html,body{
font-family: 'Courier New', Courier, 'Lucida Sans Typewriter', 'Lucida Typewriter', monospace;
}
</style>
</head>
<body>
<div>
Upload your SHELL and bypass the restriction :)
</div>
<br>
<form method='POST' enctype='multipart/form-data'>
<input type='file' name='name'><br>
<input type='submit'>
</form>
<br><br>
</body>
</html>
<?php
$dir = 'sandbox/' . $_SERVER['REMOTE_ADDR'];
if ( !file_exists($dir) )
mkdir($dir);
$file = $_FILES['name'];
if ($file){
$name = basename($file['name']);
$name = $dir . '/' . $name;
move_uploaded_file($file['tmp_name'], $name);
echo 'Congratulations, your shell is at ' . $name;
}
?>