CVE-2024-58135
JSON

5.3medium

Mojolicious versions from 7.28 through 9.45 for Perl will generate weak HMAC session cookie secrets via "mojo generate app" by default

Severity
5.3medium CVSS:3.1 by CISA-ADP
Exploit likelihood
0.58% (higher than 49% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
CPANSec

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

Product or packageVersionsReported by
Mojoliciousfrom 7.28 up to 9.45CVE List
mojolicious mojoliciousfrom 7.28 up to 9.40NVD

Classification

CWE-338

SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial.

What each source says

CVE List

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.

NVD (es)

Las versiones de Mojolicious de la 7.28 a la 9.39 para Perl pueden generar secretos de sesión HMAC débiles. Al crear una aplicación predeterminada con la herramienta "mojo generate app", se escribe un secreto débil en el archivo de configuración de la aplicación mediante la función insegura rand(), que se utiliza para autenticar y proteger la integridad de las sesiones de la aplicación. Esto podría permitir a un atacante acceder por fuerza bruta a las claves de sesión de la aplicación.

References

https://perldoc.perl.org/functions/randproduct, related
https://metacpan.org/release/SRI/Mojolicious-9.39/source/lib/Mojo/Util.pm#L181product, related
https://metacpan.org/release/SRI/Mojolicious-9.38/source/lib/Mojolicious/Command/Author/generate/app.pm#L202product, related
https://github.com/mojolicious/mojo/pull/2200exploit, issue-tracking, patch
https://metacpan.org/release/SRI/Mojolicious-7.28/source/lib/Mojolicious/Command/generate/app.pm#L220product, related
https://security.metacpan.org/docs/guides/random-data-for-security.htmltechnical-description
https://github.com/hashcat/hashcat/pull/4090exploit, issue-tracking, patch
https://lists.debian.org/debian-perl/2025/05/msg00016.htmlmailing-list
https://lists.debian.org/debian-perl/2025/05/msg00017.htmlmailing-list
https://lists.debian.org/debian-perl/2025/05/msg00018.htmlmailing-list
https://metacpan.org/release/SRI/Mojolicious-9.46/source/Changesrelease-notes
https://github.com/mojolicious/mojo/commit/fb3733f92cc8a3344e6d615b3c7dac9d538eeab0.patchpatch

Sources

SourceRecordLicence
CVE ListCVE-2024-58135 changed 2026-06-05CVE Terms of Use
NVDCVE-2024-58135 changed 2026-06-17Public domain