Skip to content

Commit ef3105d

Browse files
committed
fixed a exploit in loader.php
1 parent dc4c012 commit ef3105d

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

js/loader.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
11
<?php
22

33
$url = urldecode(filter_var($_GET['src']));
4-
echo file_get_contents($url);
4+
if (strtolower(substr($url, 0, 7)) == 'http://' || strtolower(substr($url, 0, 8) == 'https://'))
5+
{
6+
$path = '/tmp/'.basename($url);
7+
$output = fopen($path, 'w+');
8+
$curl = curl_init($url);
9+
$options = array(CURLOPT_HEADER => false,
10+
CURLOPT_TIMEOUT => 30,
11+
CURLOPT_FILE => $output,
12+
CURLOPT_FOLLOWLOCATION => true);
13+
curl_setopt_array($curl, $options);
14+
$result = curl_exec($curl);
15+
$content_type = curl_getinfo($curl, CURLINFO_CONTENT_TYPE);
16+
curl_close($curl);
17+
fclose($output);
18+
header('Content-Type: '.$content_type);
19+
header('Content-Length: '.filesize($path));
20+
readfile($path);
21+
}

0 commit comments

Comments
 (0)