CVE-2024-27354: phpseclib a large prime can cause a denial of service

Published Mar 1, 2024
·
Updated

Duplicate Advisory This advisory has been withdrawn because it is a duplicate of GHSA-2528-jw5q-ww88. This link is maintained to preserve external references.

Original Description An issue was discovered in phpseclib 1.x before 1.0.23, 2.x before 2.0.47, and 3.x before 3.0.36. An attacker can construct a malformed certificate containing an extremely large prime to cause a denial of service (CPU consumption for an isPrime primality check). NOTE: this issue was introduced when attempting to fix CVE-2023-27560.

Other sources

Impact Anyone trying to generate a prime and testing the primality of a number.

Patches https://github.com/phpseclib/phpseclib/commit/ad5dbdf2129f5e0fb644637770b7f33de8ca8575

Workarounds Using the GMP extension would probably help, assuming that one has its own guardrails.

Resources https://github.com/phpseclib/phpseclib/commit/ad5dbdf2129f5e0fb644637770b7f33de8ca8575 https://www.usenix.org/system/files/conference/usenixsecurity25/sec25cycle1-prepub-599-shi-bing.pdf

— GitHub

phpseclib a large prime can cause a denial of service

— Packagist

Affected Software

22 affected componentsFixes available
composer/phpseclib/phpseclib>=3.0.0<3.0.36
3.0.36
composer/phpseclib/phpseclib>=2.0.0<2.0.47
2.0.47
composer/phpseclib/phpseclib>=1.0.0<1.0.23
1.0.23
phpseclib phpseclib>=1.0.0<1.0.23
phpseclib phpseclib>=2.0.0<2.0.47
phpseclib phpseclib>=3.0.0<3.0.36
Debian Debian Linux=10.0
composer/phpseclib/phpseclib>=0.1.1<1.0.23
1.0.23
composer/phpseclib/phpseclib>=3.0.0, <3.0.36
3.0.36
composer/phpseclib/phpseclib>=2.0.0, <2.0.47
2.0.47
composer/phpseclib/phpseclib>=1.0.0, <1.0.23
1.0.23
debian/php-phpseclib<2.0.42-1+deb12u2
2.0.42-1+deb12u2
debian/php-phpseclib<2.0.47-1
2.0.47-1
debian/php-phpseclib<2.0.47-1
2.0.47-1
debian/php-phpseclib3<3.0.19-1+deb12u3
3.0.19-1+deb12u3
debian/php-phpseclib3<3.0.36-1
3.0.36-1
debian/php-phpseclib3<3.0.36-1
3.0.36-1
debian/phpseclib<1.0.20-1+deb12u2
1.0.20-1+deb12u2
debian/phpseclib<1.0.23-1
1.0.23-1
debian/php-phpseclib
2.0.42-1+deb12u52.0.42-1+deb12u32.0.48-3+deb13u32.0.48-3+deb13u12.0.55-12.0.56-1
debian/php-phpseclib3
3.0.19-1+deb12u63.0.19-1+deb12u43.0.43-2+deb13u33.0.43-2+deb13u13.0.57-13.0.58-1
debian/phpseclib
1.0.20-1+deb12u51.0.20-1+deb12u31.0.23-6+deb13u31.0.23-6+deb13u11.0.31-1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade composer/phpseclib/phpseclib to a version that resolves this vulnerability.

    Fixed in 3.0.36
  2. Upgrade

    Upgrade composer/phpseclib/phpseclib to a version that resolves this vulnerability.

    Fixed in 2.0.47
  3. Upgrade

    Upgrade composer/phpseclib/phpseclib to a version that resolves this vulnerability.

    Fixed in 1.0.23
  4. Upgrade

    Upgrade debian/php-phpseclib to a version that resolves this vulnerability.

    Fixed in 2.0.42-1+deb12u2
  5. Upgrade

    Upgrade debian/php-phpseclib to a version that resolves this vulnerability.

    Fixed in 2.0.47-1
  6. Upgrade

    Upgrade debian/php-phpseclib3 to a version that resolves this vulnerability.

    Fixed in 3.0.19-1+deb12u3
  7. Upgrade

    Upgrade debian/php-phpseclib3 to a version that resolves this vulnerability.

    Fixed in 3.0.36-1
  8. Upgrade

    Upgrade debian/phpseclib to a version that resolves this vulnerability.

    Fixed in 1.0.20-1+deb12u2
  9. Upgrade

    Upgrade debian/phpseclib to a version that resolves this vulnerability.

    Fixed in 1.0.23-1
  10. Upgrade

    Upgrade debian/php-phpseclib to a version that resolves this vulnerability.

    Fixed in 2.0.42-1+deb12u5Fixed in 2.0.42-1+deb12u3Fixed in 2.0.48-3+deb13u3Fixed in 2.0.48-3+deb13u1Fixed in 2.0.55-1Fixed in 2.0.56-1
  11. Upgrade

    Upgrade debian/php-phpseclib3 to a version that resolves this vulnerability.

    Fixed in 3.0.19-1+deb12u6Fixed in 3.0.19-1+deb12u4Fixed in 3.0.43-2+deb13u3Fixed in 3.0.43-2+deb13u1Fixed in 3.0.57-1Fixed in 3.0.58-1
  12. Upgrade

    Upgrade debian/phpseclib to a version that resolves this vulnerability.

    Fixed in 1.0.20-1+deb12u5Fixed in 1.0.20-1+deb12u3Fixed in 1.0.23-6+deb13u3Fixed in 1.0.23-6+deb13u1Fixed in 1.0.31-1
  13. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 1.0.23
  14. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 2.0.47
  15. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 3.0.36
  16. Compensating control

    Use the GMP extension for primality testing, with appropriate guardrails.

Event History

Mar 1, 2024
CVE Published
via MITRE·12:00 AM
Data Sourced
via MITRE·12:00 AM
Description
Data Sourced
via NVD·11:15 PM
DescriptionSeverityWeaknessAffected Software
Data Sourced
via OSV·11:15 PM
DescriptionSeverityAffected Software
Mar 2, 2024
Advisory Published
via GitHub·12:31 AM
Data Sourced
via GitHub·12:31 AM
DescriptionSeverityWeaknessAffected Software
Data Sourced
via Packagist·12:31 AM
DescriptionSeverityAffected Software
May 6, 2026
Withdrawn
via GitHub·05:56 PM
Advisory Published
via GitHub·05:57 PM

Peer vulnerabilities

Found alongside the following vulnerabilities.

Frequently Asked Questions

1

What is the severity of CVE-2024-27354?

CVE-2024-27354 has a moderate severity level due to its potential for denial of service via high CPU consumption.

2

How do I fix CVE-2024-27354?

To mitigate CVE-2024-27354, upgrade phpseclib to version 3.0.36, 2.0.47, or 1.0.23 as appropriate.

3

Which versions of phpseclib are vulnerable to CVE-2024-27354?

phpseclib versions before 1.0.23, 2.0.47, and 3.0.36 are vulnerable to CVE-2024-27354.

4

What types of attacks does CVE-2024-27354 allow?

CVE-2024-27354 allows attackers to perform denial of service attacks by exploiting malformed certificates with large primes.

5

Is my application at risk if I use an affected version of phpseclib with CVE-2024-27354?

Yes, using an affected version of phpseclib puts your application at risk for denial of service due to CVE-2024-27354.

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