File tree Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change 6060* [ Challenge 54] ( php/challenge-54.md )
6161* [ Challenge 55] ( php/challenge-55.md )
6262* [ Challenge 56] ( php/challenge-56.md )
63+ * [ Challenge 57] ( php/challenge-57.md )
6364
6465## PYTHON
6566
Original file line number Diff line number Diff line change 1+ # Challenge
2+ ``` php
3+ <?php
4+ /*//设置open_basedir
5+ ini_set("open_basedir", "/home/shawn/www/index/");
6+ */
7+
8+ if (isset($_GET['file'])) {
9+ $file = trim($_GET['file']);
10+ } else {
11+ $file = "main.html";
12+ }
13+
14+ // disallow ip
15+ if (preg_match('/^(http:\/\/)+([^\/]+)/i', $file, $domain)) {
16+ $domain = $domain[2];
17+ if (stripos($domain, ".") !== false) {
18+ die("Hacker");
19+ }
20+ }
21+
22+ if( @file_get_contents($file)!=''){
23+ echo file_get_contents($file);
24+
25+ }else{
26+
27+ $str=<<<EOF
28+ <html >
29+ <head ><title >403 Forbidden</title ></head >
30+ <body bgcolor =" white" >
31+ <center ><h1 >403 Forbidden</h1 ></center >
32+ <hr ><center >nginx/1.13.5</center >
33+ </body >
34+ </html >
35+ <!-- a padding to disable MSIE and Chrome friendly error page -->
36+ <!-- a padding to disable MSIE and Chrome friendly error page -->
37+ <!-- a padding to disable MSIE and Chrome friendly error page -->
38+ <!-- a padding to disable MSIE and Chrome friendly error page -->
39+ <!-- a padding to disable MSIE and Chrome friendly error page -->
40+ <!-- a padding to disable MSIE and Chrome friendly error page -->
41+ EOF;
42+ echo $str;
43+ }
44+ ```
45+
46+ # Refference
47+ + 2017 XDCTF web3
You can’t perform that action at this time.
0 commit comments