CVE-2021-21703: PHP-FPM memory access in root process leading to privilege escalation
Fixed bug (PHP-FPM oob R/W in root process leading to privilege escalation) (CVE-2021-21703).
Other sources
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 PHP FPM SAPI with 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 local unprivileged user to the root user.
One can force the root FPM process to read/write at arbitrary locations using pointers located in the SHM, leading to a privilege escalation from www-data to root.
Upstream bug:
https://bugs.php.net/bug.php?id=81026
— Red Hat
PHP-FPM memory access in root process leading to privilege escalation
— Microsoft
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
PHPto a version that resolves this vulnerability.Fixed in 8.0.12 - Upgrade
Upgrade
alpine/php7to a version that resolves this vulnerability.Fixed in 7.3.32-r0 - Upgrade
Upgrade
alpine/php7to a version that resolves this vulnerability.Fixed in 7.4.25-r0 - Upgrade
Upgrade
alpine/php8to a version that resolves this vulnerability.Fixed in 8.0.12-r0 - Upgrade
Upgrade
alpine/php81to a version that resolves this vulnerability.Fixed in 8.1.0_rc5-r0 - Upgrade
Upgrade
redhat/phpto a version that resolves this vulnerability.Fixed in 7.4.25 - Upgrade
Upgrade
redhat/phpto a version that resolves this vulnerability.Fixed in 8.0.12 - Upgrade
Upgrade
debian/php7.4to a version that resolves this vulnerability.Fixed in 7.4.25-1+deb11u1 - Upgrade
Upgrade
debian/php7.0to a version that resolves this vulnerability.Fixed in 7.0.33-0+deb9u12 - Upgrade
Upgrade
debian/php7.3to a version that resolves this vulnerability.Fixed in 7.3.31-1~deb10u1 - Upgrade
Upgrade
debian/php7.4to a version that resolves this vulnerability.Fixed in 7.4.25-1+deb11u1Fixed in 7.4.26-1 - Upgrade
Upgrade
PHPto a version that resolves this vulnerability.Fixed in 7.4.25
Event History
Frequently Asked Questions
What is CVE-2021-21703?
CVE-2021-21703 is a vulnerability 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 that allows child worker processes running as lower-privileged users to access memory shared with the main FPM daemon process running as root, potentially leading to privilege escalation.
What is the severity of CVE-2021-21703?
CVE-2021-21703 has a severity rating of high, with a severity value of 7.
How can I fix CVE-2021-21703?
To fix CVE-2021-21703, you should upgrade to PHP version 8.0.12 or apply the appropriate patches for PHP versions 7.3.x, 7.4.x, and 8.0.x.
Where can I find more information about CVE-2021-21703?
You can find more information about CVE-2021-21703 on the official PHP website and the Openwall mailing list.
What are the CWE identifiers associated with CVE-2021-21703?
CVE-2021-21703 is associated with CWE-787 and CWE-284.