CVE-2024-27354: phpseclib · guardrails needed on isPrime and randomPrime
Affects phpseclib/phpseclibSource GCVE Database
Not known to be exploited · CVSS 7.5 High : upgrade to 1.0.23 soon.
Data as of 27 Oct 2026, 02:11 UTC
- Patch
- Available – fixed in 1.0.23, 2.0.47, 3.0.36
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:HExploitation evidence
Disclosed: evidence found.
CVE published 6 May 2026
Detectable: no evidence on record.
No public nuclei template indexed
Weaponised: no evidence on record.
No public exploit code indexed in Metasploit or Exploit-DB
Exploited in the wildExploited: no evidence on record.
Not in CISA KEV and no source reports exploitation
Observed by OffSeq MirageSeen by Mirage: no evidence on record.
No attack traffic recorded by OffSeq Mirage sensors
A missing step is not evidence of safety. Sources: cve.org (opens in a new tab), the Metasploit, Exploit-DB and nuclei-templates index as of 26 Oct 2026.
What to do
Upgrade phpseclib/phpseclib to 1.0.23; phpseclib/phpseclib to 2.0.47; phpseclib/phpseclib to 3.0.36.
Affected software
| Product | Affected | Fixed in |
|---|---|---|
| Packagistphpseclib/phpseclib | Affected
| Fixed in
|
| Packagistphpseclib/phpseclib | Affected
| Fixed in
|
| Packagistphpseclib/phpseclib | Affected
| Fixed in
|
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
AI-suggested
Upgrade phpseclib to versions 1.0.23, 2.0.47, or 3.0.36 or later where the vulnerability is fixed. Alternatively, use the GMP extension for prime number operations if it includes proper guardrails. No other specific mitigations are indicated by the vendor advisory.
Description
CVE-2024-27354 is a high-severity vulnerability in phpseclib affecting the isPrime and randomPrime functions used for prime number generation and primality testing. The flaw impacts versions >=0.1.1 <1.0.23, >=2.0.0 <2.0.47, and >=3.0.0 <3.0.36. A patch is available in versions 1.0.23, 2.0.47, and 3.0.36. The vulnerability does not affect confidentiality or integrity but can cause denial of service (availability impact). Using the GMP extension may mitigate the issue if proper guardrails are in place.
References
- github.com/phpseclib/phpseclib/security/advisories/GHSA-2528-jw5q-ww88 (opens in a new tab)
- nvd.nist.gov/vuln/detail/CVE-2024-27354 (opens in a new tab)
- github.com/phpseclib/phpseclib/commit/2870c8fab3f132d2ed40a66c97a36fe5ab625698 (opens in a new tab)
- github.com/phpseclib/phpseclib/commit/ad5dbdf2129f5e0fb644637770b7f33de8ca8575 (opens in a new tab)
- github.com/phpseclib/phpseclib/commit/c55b75199ec8d12cec6eadf6da99da4a3712fe56 (opens in a new tab)
- gist.github.com/katzj/ee72f3c2a00590812b2ea3c0c8890e0b (opens in a new tab)
- github.com/FriendsOfPHP/security-advisories/blob/master/phpseclib/phpseclib/CVE-2024-27354.yaml (opens in a new tab)
- github.com/phpseclib/phpseclib (opens in a new tab)
- github.com/phpseclib/phpseclib/blob/master/phpseclib/Math/PrimeField.php (opens in a new tab)
- lists.debian.org/debian-lts-announce/2024/03/msg00002.html (opens in a new tab)
- lists.debian.org/debian-lts-announce/2024/03/msg00003.html (opens in a new tab)