CVE-2021-21703 php: Local privilege escalation via PHP-FPM

Publication Date2021-10-20
SeverityCritical
TypePrivilege Escalation
Affected PHP Versions
  • 5.6.0 - 5.6.40
  • 7.0.0 - 7.0.33
  • 7.1.0 - 7.1.33
  • 7.2.0 - 7.2.34
  • 7.3.0 - 7.3.31
  • 7.4.0 - 7.4.24
  • 8.0.0 - 8.0.11

CVE Details

In PHP versions 7.3.x up to and including 7.3.31, 7.4.x below 7.4.25 and 8.0.x below 8.0.12, when running the PHP-FPM SAPI with the main FPM daemon process running as root and child worker processes running as lower-privileged users, it is possible for the child processes to access memory shared with the main process and write to it, modifying it in a way that would cause the root process to conduct invalid memory reads and writes, which can be used to escalate privileges from a local unprivileged user to the root user.

This vulnerability is hard to exploit as the attack needs to escape the FPM sandbox mechanism. When a complete attack is achieved it may lead to risk for confidentiality, data integrity, and system availability.

Recommendations

Upgrade to PHP 7.3.32 or later, 7.4.25 or later, or 8.0.12 or later.

Alternately, run your php-fpm daemon as a non-root user.