Mojolicious versions from 7.28 through 9.45 for Perl will generate weak HMAC session cookie secrets via "mojo generate app" by default
Summary
| CVE | CVE-2024-58135 |
|---|---|
| State | PUBLISHED |
| Assigner | CPANSec |
| Source Priority | CVE Program / NVD first with legacy fallback |
| Published | 2025-05-03 11:15:48 UTC |
| Updated | 2026-06-05 14:16:31 UTC |
| Description | Mojolicious versions from 7.28 through 9.45 for Perl will generate weak HMAC session cookie secrets via "mojo generate app" by default. When creating a default app skeleton with the "mojo generate app" tool, a weak secret is written to the application's configuration file using the insecure rand() function, and used for authenticating and protecting the integrity of the application's sessions. This may allow an attacker to brute force the application's session keys. Release 9.46 fixes the issue by providing high quality randomness, even in absence of CryptX. Users should be aware that the update does not replace previously generated weak secrets. A secret generated with the previous version MUST be replaced to ensure the updated version is using a strong secret. |
Risk And Classification
Primary CVSS: v3.1 5.3 MEDIUM from ADP
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
EPSS: 0.006810000 probability, percentile 0.720880000 (date 2026-06-10)
Problem Types: CWE-338 | CWE-338 CWE-338 Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG)
| Version | Source | Type | Score | Severity | Vector |
|---|---|---|---|---|---|
| 3.1 | ADP | DECLARED | 5.3 | MEDIUM | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N |
| 3.1 | 134c704f-9b21-4f2e-91b3-4a467353bcc0 | Secondary | 5.3 | MEDIUM | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N |
CVSS v3.1 Breakdown
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
NVD Known Affected Configurations (CPE 2.3)
| Type | Vendor | Product | Version | Update | Edition | Language |
|---|---|---|---|---|---|---|
| Application | Mojolicious | Mojolicious | All | All | All | All |
Vendor Declared Affected Products
| Source | Vendor | Product | Version | Platforms |
|---|---|---|---|---|
| CNA | SRI | Mojolicious | affected 7.28 9.45 custom | Not specified |
References
| Reference | Source | Link | Tags |
|---|---|---|---|
| lists.debian.org/debian-perl/2025/05/msg00016.html | 9b29abf9-4ab0-4765-b253-1875cd9b441e | lists.debian.org | |
| metacpan.org/release/SRI/Mojolicious-9.38/source/lib/Mojolicious/Command/A... | 9b29abf9-4ab0-4765-b253-1875cd9b441e | metacpan.org | Product |
| perldoc.perl.org/functions/rand | 9b29abf9-4ab0-4765-b253-1875cd9b441e | perldoc.perl.org | Product |
| metacpan.org/release/SRI/Mojolicious-9.46/source/Changes | 9b29abf9-4ab0-4765-b253-1875cd9b441e | metacpan.org | |
| github.com/hashcat/hashcat/pull/4090 | 9b29abf9-4ab0-4765-b253-1875cd9b441e | github.com | Issue Tracking, Patch |
| metacpan.org/release/SRI/Mojolicious-9.39/source/lib/Mojo/Util.pm | 9b29abf9-4ab0-4765-b253-1875cd9b441e | metacpan.org | Product |
| lists.debian.org/debian-perl/2025/05/msg00017.html | 9b29abf9-4ab0-4765-b253-1875cd9b441e | lists.debian.org | |
| github.com/mojolicious/mojo/commit/fb3733f92cc8a3344e6d615b3c7dac9d538ee... | 9b29abf9-4ab0-4765-b253-1875cd9b441e | github.com | |
| lists.debian.org/debian-perl/2025/05/msg00018.html | 9b29abf9-4ab0-4765-b253-1875cd9b441e | lists.debian.org | |
| security.metacpan.org/docs/guides/random-data-for-security.html | 9b29abf9-4ab0-4765-b253-1875cd9b441e | security.metacpan.org | Technical Description |
| github.com/mojolicious/mojo/commit/789cfa43f9118852b38cbd1fd0a2596bcb982... | 9b29abf9-4ab0-4765-b253-1875cd9b441e | github.com | |
| github.com/mojolicious/mojo/pull/2200 | 9b29abf9-4ab0-4765-b253-1875cd9b441e | github.com | Exploit, Issue Tracking, Patch |
| metacpan.org/release/SRI/Mojolicious-7.28/source/lib/Mojolicious/Command/g... | 9b29abf9-4ab0-4765-b253-1875cd9b441e | metacpan.org | Product |
| CVE Program record | CVE.ORG | www.cve.org | canonical |
| NVD vulnerability detail | NVD | nvd.nist.gov | canonical, analysis |
Additional Advisory Data
Solutions
CNA: Upgrade to version 9.46 and replace previously generated secrets.
Workarounds
CNA: Ensure that your secret, stored in the application's configuration file, is at least 128 bit of cryptographically secure random data. For example, to generate a 256 bit secret, one could use the output generated by the "openssl rand -base64 32" command.
CNA: As of version 9.39 of Mojolicious, if the optional CryptX distribution version 0.080 or later is available in the include path before calling the "mojo generate app" tool, then a secure 1024 bit long secret will be generated.