CVE-2024-27354: phpseclib a large prime can cause a denial of service
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
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
composer/phpseclib/phpseclibto a version that resolves this vulnerability.Fixed in 3.0.36 - Upgrade
Upgrade
composer/phpseclib/phpseclibto a version that resolves this vulnerability.Fixed in 2.0.47 - Upgrade
Upgrade
composer/phpseclib/phpseclibto a version that resolves this vulnerability.Fixed in 1.0.23 - Upgrade
Upgrade
debian/php-phpseclibto a version that resolves this vulnerability.Fixed in 2.0.42-1+deb12u2 - Upgrade
Upgrade
debian/php-phpseclibto a version that resolves this vulnerability.Fixed in 2.0.47-1 - Upgrade
Upgrade
debian/php-phpseclib3to a version that resolves this vulnerability.Fixed in 3.0.19-1+deb12u3 - Upgrade
Upgrade
debian/php-phpseclib3to a version that resolves this vulnerability.Fixed in 3.0.36-1 - Upgrade
Upgrade
debian/phpseclibto a version that resolves this vulnerability.Fixed in 1.0.20-1+deb12u2 - Upgrade
Upgrade
debian/phpseclibto a version that resolves this vulnerability.Fixed in 1.0.23-1 - Upgrade
Upgrade
debian/php-phpseclibto 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 - Upgrade
Upgrade
debian/php-phpseclib3to 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 - Upgrade
Upgrade
debian/phpseclibto 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 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 1.0.23 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 2.0.47 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 3.0.36 - Compensating control
Use the GMP extension for primality testing, with appropriate guardrails.
Event History
Frequently Asked Questions
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.
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.
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.
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.
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.