7.5high
phpseclib: guardrails needed on isPrime and randomPrime
- Severity
- 7.5high CVSS:3.1 by CISA-ADP
- Exploit likelihood
- 0.60% (higher than 50% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- mitre
- Also known as
- GHSA-2528-jw5q-ww88
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.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Unspecified product | n/a | CVE List |
| phpseclib 1x | before 1.0.23 | CVE List |
| phpseclib 2x | before 2.0.47 | CVE List |
| phpseclib 3x | before 3.0.36 | CVE List |
| phpseclib/phpseclib (Packagist) | from 0.1.1 before 1.0.23, from 2.0.0 before 2.0.47, from 3.0.0 before 3.0.36 | GitHub Advisory Database |
| phpseclib phpseclib | from 1.0.0 before 1.0.23, from 2.0.0 before 2.0.47, from 3.0.0 before 3.0.36 | NVD |
| debian debian_linux | 10.0 | NVD |
All scores
| CISA-ADP | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| GitHub | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| GitHub | high CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N |
Classification
SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial.
What each source says
CVE List
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.
GitHub Advisory Database
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
NVD (es)
Se descubrió un problema en phpseclib 1.x anterior a 1.0.23, 2.x anterior a 2.0.47 y 3.x anterior a 3.0.36. Un atacante puede crear un certificado con formato incorrecto que contenga un valor principal extremadamente grande para provocar una denegación de servicio (consumo de CPU para una verificación de primalidad de isPrime). NOTA: este problema se introdujo al intentar solucionar CVE-2023-27560.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2024-27354 changed 2025-04-22 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-2528-jw5q-ww88 changed 2026-05-06 | CC-BY-4.0 |
| NVD | CVE-2024-27354 changed 2026-06-17 | Public domain |