# CVE-2024-58135: Mojolicious versions from 7.28 through 9.45 for Perl will generate weak HMAC session cookie secrets via "mojo generate app" by default

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** MEDIUM 5.3
- **CVSS:** 5.3 (v3.1, CNA) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N`
- **CVSS metrics:** Attack vector: Network; Attack complexity: Low; Privileges required: None; User interaction: None; Scope: Unchanged; Confidentiality impact: Low; Integrity impact: None; Availability impact: None
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** Yes (see exploit references)
- **Remote exploitation:** Remote, no login needed
- **EPSS:** 1.01% (percentile 62, 2026-11-26)
- **CWE:** CWE-338
- **Published:** 2025-05-03T10:16:10.636Z
- **Modified:** 2026-06-17T08:14:41.497Z

## Who should check

- Anyone running SRI Mojolicious \>= 7.28, \<= 9.45

## 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.

## Affected and fixed versions

- SRI Mojolicious: \>= 7.28, \<= 9.45 (cvelist)

## Mitigation

- Vendor workaround: 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.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2024-58135. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2024-58135.md
Affected: SRI Mojolicious >= 7.28, <= 9.45
Fixed in: no fixed version listed yet

Steps:
1. Search this machine and project for SRI Mojolicious: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2024-58135 being exploited?

There is no confirmed exploitation: CVE-2024-58135 is not in the CISA Known Exploited Vulnerabilities catalog. Public exploit code or a proof of concept is available. EPSS estimates a 1.01% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2024-58135?

Medium: CVSS 5.3 (v3.1, scored by CNA). Remote, no login needed.

### Which versions are affected by CVE-2024-58135?

SRI Mojolicious \>= 7.28, \<= 9.45.

### Is there a fix for CVE-2024-58135?

No fixed version is listed in the sources yet. Vendor workaround: 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.

### How do I check if I'm affected by CVE-2024-58135?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://github.com/mojolicious/mojo/pull/2200>
- patch: <https://github.com/mojolicious/mojo/commit/fb3733f92cc8a3344e6d615b3c7dac9d538eeab0.patch>
- patch: <https://github.com/mojolicious/mojo/commit/789cfa43f9118852b38cbd1fd0a2596bcb9821ea.patch>
- exploit: <https://github.com/hashcat/hashcat/pull/4090>
- article: <https://security.metacpan.org/docs/guides/random-data-for-security.html>
- other: <https://perldoc.perl.org/functions/rand>
- other: <https://metacpan.org/release/SRI/Mojolicious-9.39/source/lib/Mojo/Util.pm#L181>
- other: <https://metacpan.org/release/SRI/Mojolicious-9.38/source/lib/Mojolicious/Command/Author/generate/app.pm#L202>
- other: <https://metacpan.org/release/SRI/Mojolicious-7.28/source/lib/Mojolicious/Command/generate/app.pm#L220>
- other: <https://lists.debian.org/debian-perl/2025/05/msg00016.html>
- other: <https://lists.debian.org/debian-perl/2025/05/msg00017.html>
- other: <https://lists.debian.org/debian-perl/2025/05/msg00018.html>
- other: <https://metacpan.org/release/SRI/Mojolicious-9.46/source/Changes>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2024-58135>

HTML: <https://flawdb.com/CVE-2024-58135> · JSON: <https://flawdb.com/api/v1/entries/CVE-2024-58135>
