CVE-2024-27354
phpseclib: guardrails needed on isPrime and randomPrime
Reported by mitre · Published March 1, 2024
phpseclib/phpseclib is fixed in 3.0.36, 2.0.47 and 1.0.23 (Packagist)
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.
Fixed versions
Upgrade to a fixed version or later. Language registries are listed first, then Linux distributions, then vendor products.
| Package | Ecosystem | Fixed in |
|---|---|---|
| phpseclib/phpseclib | Packagist | 3.0.36, 2.0.47, 1.0.23 |
| 1x | phpseclib | 1.0.23 |
Risk scores
Affected products
| Vendor | Product | Versions |
|---|---|---|
| n/a | n/a | n/a |
| phpseclib | 1x | 0 |
| n/a | n/a | * |
| phpseclib | 3x | 0 |
| phpseclib | phpseclib | 0.1.1, 2.0.0, 3.0.0 |
| phpseclib | 2x | 0 |
Timeline
- Feb 29, 2024 GitHub Gist PoC
- Mar 1, 2024 CVE Published
- Mar 2, 2024 EPSS Score (30 in total, the first dated here)
- Mar 2, 2024 PoC Published (3 in total, the first dated here)
- Oct 4, 2024 Coalition ESS Score (8 in total, the first dated here)
- Sep 15, 2025 CVE Updated
- Mar 17, 2026 Security Advisory
Query this with the API
The same record, from the CLI:
vulnetix vdb vuln CVE-2024-27354
vulnetix vdb fixes CVE-2024-27354
Or with curl, using the org id and key from your account page:
curl -s -H "Authorization: ApiKey ${VULNETIX_ORG_ID}:${VULNETIX_API_KEY}" \
"https://api.vdb.vulnetix.com/v2/vuln/CVE-2024-27354/fixes/registry"
The Community plan is free and allows 50 queries a day. Get a free API key · API quickstart
References
- [debian-lts-announce] 20240305 [SECURITY] [DLA 3749-1] phpseclib security update mailing-list
- [debian-lts-announce] 20240305 [SECURITY] [DLA 3750-1] php-phpseclib security update mailing-list
- https://nvd.nist.gov/vuln/detail/CVE-2024-27354 advisory
- https://github.com/advisories/GHSA-2528-jw5q-ww88 advisory
- https://github.com/phpseclib/phpseclib/security/advisories/GHSA-2528-jw5q-ww88 url
- https://github.com/phpseclib/phpseclib/commit/2870c8fab3f132d2ed40a66c97a36fe5ab625698 patch
- https://github.com/phpseclib/phpseclib/commit/ad5dbdf2129f5e0fb644637770b7f33de8ca8575 patch
- https://github.com/phpseclib/phpseclib/commit/c55b75199ec8d12cec6eadf6da99da4a3712fe56 patch
- https://github.com/FriendsOfPHP/security-advisories/blob/master/phpseclib/phpseclib/CVE-2024-27354.yaml url
- https://github.com/phpseclib/phpseclib url