受影响系统:
PHP PHP 7.3
PHP PHP 7.2
PHP PHP 7.1
PHP PHP 7.0
PHP php-fpm
描述:
--------------------------------------------------------------------------------
CVE(CAN) ID: CVE-2019-10043PHP-FPM(FastCGI Process Manager:FastCGI进程管理器)是一个PHPFastCGI管理器。
php-fpm在某些特定Nginx 配置中存在安全漏洞,该漏洞可能会导致远程代码执行。此漏洞存在于文件sapi/fpm/fpm/fpm_main.c (https://github.com/php/php-src/blob/master/sapi/fpm/fpm/fpm_main.c#L1140),其中假设env_path_info的前缀等于php脚本的路径,但是实际上代码不会检查此假设是否满足,缺少该检查会导致“path_info”变量中的指针无效。当在某些Nginx 配置中,攻击者可以使用换行符(编码格式为%0a)来破坏`fastcgi_split_path_info`指令中的regexp,regexp损坏将导致空PATH_INFO,从而触发该漏洞。
<*来源:Andrew Danau
*>
建议:
--------------------------------------------------------------------------------
厂商补丁:
PHP
---
目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载:
https://bugs.php.net/patch-display.php?bug_id=78599&patch=0001-Fix-bug-78599-env_path_info-underflow-can-lead-to-RC.patch&revision=latest
另请检查 nginx 配置,如果存在上述易受攻击配置,建议删除
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
参考:
https://lab.wallarm.com/php-remote-code-execution-0-day-discovered-in-real-world-ctf-exercise