CVE-2021-21708: UAF due to php_filter_float() failing

Published Feb 14, 2022
·
Updated

Fix #81708: UAF due to phpfilterfloat() failing for ints. (CVE-2021-21708)

Other sources

In PHP versions 7.4.x below 7.4.28, 8.0.x below 8.0.16, and 8.1.x below 8.1.3, when using filter functions with FILTERVALIDATEFLOAT filter and min/max limits, if the filter fails, there is a possibility to trigger use of allocated memory after free, which can result it crashes, and potentially in overwrite of other memory chunks and RCE. This issue affects: code that uses FILTERVALIDATEFLOAT with min/max limits.

Use after free due to phpfilterfloat() failing for ints.

References:

https://bugs.php.net/bug.php?id=81708 https://www.php.net/ChangeLog-7.php

— Red Hat

Affected Software

11 affected componentsFixes available
debian/php7.3
7.3.31-1~deb10u17.3.31-1~deb10u5
debian/php7.4
7.4.33-1+deb11u4
PHP PHP>=7.4.0<7.4.28
PHP PHP>=8.0.0<8.0.16
PHP PHP>=8.1.0<8.1.3
PHP PHP<8.1.3
8.1.3
Microsoft cbl2 php
alpine/php7<7.4.32-r0
7.4.32-r0
alpine/php7<7.4.28-r0
7.4.28-r0
alpine/php8<8.0.16-r0
8.0.16-r0
redhat/php<7.4.28
7.4.28

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade debian/php7.3 to a version that resolves this vulnerability.

    Fixed in 7.3.31-1~deb10u1Fixed in 7.3.31-1~deb10u5
  2. Upgrade

    Upgrade debian/php7.4 to a version that resolves this vulnerability.

    Fixed in 7.4.33-1+deb11u4
  3. Upgrade

    Upgrade PHP to a version that resolves this vulnerability.

    Fixed in 8.1.3
  4. Upgrade

    Upgrade alpine/php7 to a version that resolves this vulnerability.

    Fixed in 7.4.32-r0
  5. Upgrade

    Upgrade alpine/php7 to a version that resolves this vulnerability.

    Fixed in 7.4.28-r0
  6. Upgrade

    Upgrade alpine/php8 to a version that resolves this vulnerability.

    Fixed in 8.0.16-r0
  7. Upgrade

    Upgrade redhat/php to a version that resolves this vulnerability.

    Fixed in 7.4.28
  8. Upgrade

    Upgrade PHP to a version that resolves this vulnerability.

    Fixed in 7.4.28
  9. Upgrade

    Upgrade PHP to a version that resolves this vulnerability.

    Fixed in 8.0.16

Event History

Feb 17, 2022
CVE Published
via PHP·12:00 AM
Data Sourced
via Red Hat·08:43 PM
DescriptionSeverityAffected Software
Feb 27, 2022
CVE Published
via MITRE·08:00 AM
Data Sourced
via MITRE·08:00 AM
DescriptionSeverityWeakness
Data Sourced
via OSV·08:15 AM
DescriptionSeverityAffected Software
Oct 1, 2025
Data Sourced
via Microsoft·11:11 PM
DescriptionSeverityWeakness
Data Sourced
via Microsoft·11:11 PM
Affected Software

Frequently Asked Questions

1

What is CVE-2021-21708?

CVE-2021-21708 is a vulnerability in PHP that allows for a use-after-free (UAF) issue due to php_filter_float() failing for ints.

2

How severe is CVE-2021-21708?

CVE-2021-21708 is considered a moderate severity vulnerability.

3

Which version of PHP is affected by CVE-2021-21708?

Versions of PHP up to and excluding 7.4.28 are affected by CVE-2021-21708.

4

How can I fix CVE-2021-21708?

To fix CVE-2021-21708, upgrade to PHP version 7.4.28 or apply the necessary patches as provided by the PHP project.

5

Where can I find more information about CVE-2021-21708?

More information about CVE-2021-21708 can be found in the PHP changelog at https://www.php.net/ChangeLog-7.php#7.4.28.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203