此漏洞为文件名逻辑漏洞,该漏洞在上传图片时,修改其16进制编码可使其绕过策略,导致解析为 php。当Nginx 得到一个用户请求时,首先对 url 进行解析,进行正则匹配,如果匹配到以**.php**后缀结尾的文件名,会将请求的PHP文件交给 PHP-CGI 去解析。
影响版本:Nginx 0.8.41 ~ 1.4.3 / 1.5.0 ~ 1.5.7
漏洞复现
进入vulhub靶场
cd /vulhub-master/nginx/CVE-2013-4547
docker-compose build
docker-compose up -d
docker ps -a
上传 info.php 抓包,修改后缀为 jpg 并且添加空格,发送,然后上传成功

在 .jpg 后面添加两个空格并添加 .php 后缀,在16进制修改中将原本连个空格的 0x20 0x20 修改为如下即 0x20 0x00 ,然后发包



访问上传后的文件,由于url会将其编码,需要继续抓包修改 0x20 0x20 为 0x20 0x00
192.168.109.133:8080/uploadfiles/info.jpg%20%20.php
抓包后在BP中将原来的%20%20删除,改成两个空格方便修改

修改后再发包
