0x00 漏洞介绍
nginx + php-fpm 配置不当,当nginx配置文件中有fastcgi_split_path_info
模块,在处理带%0a
的请求时,对换行符\n
处置不当使得将PATH_INFO
值置为空,从而导致可以通过FCGI_PUTENV
与PHP_VALUE
相结合,修改当前的php-fpm
进程中的php
配置,在特殊构造的配置生效的情况下可以触发任意代码执行。
0x01 影响范围
5.6 < PHP < 7.3.11
Nginx使用如下特定配置:
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass php:9000;
}
}
0x02 环境准备
使用docker配置环境,启动nginx+php-fpm
环境链接:https://github.com/vulhub/vulhub/tree/master/php/CVE-2019-11043
docker-compose build
docker-compose up -d
docker-compose ps