forked from vulhub/vulhub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: '2' | ||
services: | ||
nginx: | ||
image: vulhub/nginx:1.4.2 | ||
volumes: | ||
- ./nginx.conf:/usr/local/nginx/conf/nginx.conf | ||
ports: | ||
- "8080:80" | ||
php: | ||
build: ./php-fpm/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
worker_processes 1; | ||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
|
||
http { | ||
include mime.types; | ||
default_type application/octet-stream; | ||
|
||
sendfile on; | ||
keepalive_timeout 65; | ||
|
||
server { | ||
listen 80; | ||
server_name localhost; | ||
root html; | ||
index index.html index.htm index.php; | ||
|
||
charset utf-8; | ||
|
||
location ~ \.php$ { | ||
root html; | ||
include fastcgi_params; | ||
|
||
fastcgi_pass php:9000; | ||
fastcgi_index index.php; | ||
fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name; | ||
fastcgi_param DOCUMENT_ROOT /var/www/html; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM vulhub/php:5-fpm | ||
|
||
MAINTAINER phithon <[email protected]> | ||
|
||
RUN rm -rf /var/www/html/* \ | ||
&& mkdir -p /var/www/html/uploadfiles \ | ||
&& chmod 777 /var/www/html/uploadfiles | ||
|
||
COPY www.conf /usr/local/etc/php-fpm.d/www-2.conf | ||
COPY index.php /var/www/html/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
if (!empty($_FILES)): | ||
|
||
// Check for errors | ||
if($_FILES['file_upload']['error'] > 0){ | ||
die('An error ocurred when uploading.'); | ||
} | ||
|
||
// Check filesize | ||
if(!is_uploaded_file($_FILES['file_upload']['tmp_name'])) { | ||
die('File is not uploaded file'); | ||
} | ||
|
||
$ext = pathinfo($_FILES['file_upload']['name'], PATHINFO_EXTENSION); | ||
if (empty($ext) || !in_array($ext, ['php', 'php3', 'php5', 'phtml'])) { | ||
die('Unsupported filetype uploaded.'); | ||
} | ||
|
||
$new_name = __DIR__ . '/uploadfiles/' . $_FILES['file_upload']['name']; | ||
if(!move_uploaded_file($_FILES['file_upload']['tmp_name'], $new_name)){ | ||
die('Error uploading file - check destination is writeable.'); | ||
} | ||
|
||
die('File uploaded successfully: ' . $new_name); | ||
|
||
else: | ||
?> | ||
<form method="post" enctype="multipart/form-data"> | ||
File: <input type="file" name="file_upload"> | ||
<input type="submit"> | ||
</form> | ||
<?php | ||
endif; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[www] | ||
security.limit_extensions = |