CVE-2024-58135: CWE-338 Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG) in SRI Mojolicious
Mojolicious versions from 7.28 through 9.40 for Perl may generate weak HMAC session secrets. When creating a default app 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.
AI Analysis
Technical Summary
CVE-2024-58135 is a medium-severity vulnerability affecting the Mojolicious web framework for Perl, specifically versions from 7.28 through 9.40. The issue arises from the use of a cryptographically weak pseudo-random number generator (PRNG), specifically the standard rand() function, when generating HMAC session secrets during the creation of a default application via the "mojo generate app" tool. This weak secret is written directly into the application's configuration file and subsequently used to authenticate and protect the integrity of user sessions. Because rand() is not designed for cryptographic purposes, the generated secrets are predictable and susceptible to brute force attacks. An attacker with network access could exploit this vulnerability to guess or brute force session keys, potentially allowing session hijacking or impersonation without needing any prior authentication or user interaction. The vulnerability is classified under CWE-338, highlighting the use of a weak PRNG in security-critical contexts. Although no known exploits are currently reported in the wild, the vulnerability's presence in a widely used Perl web framework means that applications relying on default configurations are at risk. The CVSS v3.1 base score is 5.3 (medium), reflecting the network attack vector, low complexity, no privileges required, and no user interaction needed, but limited impact confined to confidentiality (session key exposure) without direct integrity or availability compromise. No official patches are linked yet, so mitigation requires manual intervention or updates when available.
Potential Impact
For European organizations using Mojolicious in their web applications, this vulnerability poses a tangible risk to session security. Attackers could potentially hijack user sessions by brute forcing weak HMAC secrets, leading to unauthorized access to sensitive data or user accounts. This is particularly concerning for sectors handling personal data under GDPR, such as finance, healthcare, and e-commerce, where session compromise can lead to data breaches and regulatory penalties. The impact is primarily on confidentiality, as session keys can be exposed, but the integrity and availability of the application remain unaffected. Since exploitation requires no authentication or user interaction, attackers can remotely target vulnerable applications over the network, increasing the attack surface. However, the absence of known exploits in the wild suggests that exploitation may require some effort or specific conditions. Organizations relying on default app generation without customizing or strengthening session secrets are most vulnerable. The medium severity score indicates a moderate risk that should be addressed promptly to prevent potential session hijacking incidents.
Mitigation Recommendations
European organizations should take the following specific steps to mitigate this vulnerability: 1) Immediately audit all Mojolicious applications, especially those created with the "mojo generate app" tool, to identify usage of default or weak session secrets. 2) Replace any secrets generated using the insecure rand() function with cryptographically secure random values, such as those generated by Perl's Crypt::PRNG modules or system sources like /dev/urandom. 3) Avoid relying on default configurations; explicitly set strong, high-entropy secrets in application configuration files. 4) Monitor Mojolicious project updates and apply official patches or upgrades as soon as they become available, ensuring versions beyond 9.40 are used if they address this issue. 5) Implement additional session security controls such as short session lifetimes, secure cookie flags (HttpOnly, Secure), and session invalidation on logout to reduce the window of opportunity for attackers. 6) Conduct penetration testing focused on session management to verify the effectiveness of mitigations. 7) Educate developers about the risks of using non-cryptographic PRNGs in security contexts to prevent similar issues in future development.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Italy, Spain, Poland
CVE-2024-58135: CWE-338 Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG) in SRI Mojolicious
Description
Mojolicious versions from 7.28 through 9.40 for Perl may generate weak HMAC session secrets. When creating a default app 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.
AI-Powered Analysis
Technical Analysis
CVE-2024-58135 is a medium-severity vulnerability affecting the Mojolicious web framework for Perl, specifically versions from 7.28 through 9.40. The issue arises from the use of a cryptographically weak pseudo-random number generator (PRNG), specifically the standard rand() function, when generating HMAC session secrets during the creation of a default application via the "mojo generate app" tool. This weak secret is written directly into the application's configuration file and subsequently used to authenticate and protect the integrity of user sessions. Because rand() is not designed for cryptographic purposes, the generated secrets are predictable and susceptible to brute force attacks. An attacker with network access could exploit this vulnerability to guess or brute force session keys, potentially allowing session hijacking or impersonation without needing any prior authentication or user interaction. The vulnerability is classified under CWE-338, highlighting the use of a weak PRNG in security-critical contexts. Although no known exploits are currently reported in the wild, the vulnerability's presence in a widely used Perl web framework means that applications relying on default configurations are at risk. The CVSS v3.1 base score is 5.3 (medium), reflecting the network attack vector, low complexity, no privileges required, and no user interaction needed, but limited impact confined to confidentiality (session key exposure) without direct integrity or availability compromise. No official patches are linked yet, so mitigation requires manual intervention or updates when available.
Potential Impact
For European organizations using Mojolicious in their web applications, this vulnerability poses a tangible risk to session security. Attackers could potentially hijack user sessions by brute forcing weak HMAC secrets, leading to unauthorized access to sensitive data or user accounts. This is particularly concerning for sectors handling personal data under GDPR, such as finance, healthcare, and e-commerce, where session compromise can lead to data breaches and regulatory penalties. The impact is primarily on confidentiality, as session keys can be exposed, but the integrity and availability of the application remain unaffected. Since exploitation requires no authentication or user interaction, attackers can remotely target vulnerable applications over the network, increasing the attack surface. However, the absence of known exploits in the wild suggests that exploitation may require some effort or specific conditions. Organizations relying on default app generation without customizing or strengthening session secrets are most vulnerable. The medium severity score indicates a moderate risk that should be addressed promptly to prevent potential session hijacking incidents.
Mitigation Recommendations
European organizations should take the following specific steps to mitigate this vulnerability: 1) Immediately audit all Mojolicious applications, especially those created with the "mojo generate app" tool, to identify usage of default or weak session secrets. 2) Replace any secrets generated using the insecure rand() function with cryptographically secure random values, such as those generated by Perl's Crypt::PRNG modules or system sources like /dev/urandom. 3) Avoid relying on default configurations; explicitly set strong, high-entropy secrets in application configuration files. 4) Monitor Mojolicious project updates and apply official patches or upgrades as soon as they become available, ensuring versions beyond 9.40 are used if they address this issue. 5) Implement additional session security controls such as short session lifetimes, secure cookie flags (HttpOnly, Secure), and session invalidation on logout to reduce the window of opportunity for attackers. 6) Conduct penetration testing focused on session management to verify the effectiveness of mitigations. 7) Educate developers about the risks of using non-cryptographic PRNGs in security contexts to prevent similar issues in future development.
Affected Countries
For access to advanced analysis and higher rate limits, contact root@offseq.com
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- CPANSec
- Date Reserved
- 2025-04-07T16:06:37.226Z
- Cisa Enriched
- true
- Cvss Version
- 3.1
- State
- PUBLISHED
Threat ID: 682d9816c4522896dcbd6a16
Added to database: 5/21/2025, 9:08:38 AM
Last enriched: 7/4/2025, 9:42:26 PM
Last updated: 8/12/2025, 2:18:26 PM
Views: 15
Related Threats
CVE-2025-53948: CWE-415 Double Free in Santesoft Sante PACS Server
HighCVE-2025-52584: CWE-122 Heap-based Buffer Overflow in Ashlar-Vellum Cobalt
HighCVE-2025-46269: CWE-122 Heap-based Buffer Overflow in Ashlar-Vellum Cobalt
HighCVE-2025-54862: CWE-79 Improper Neutralization of Input During Web Page Generation (XSS or 'Cross-site Scripting') in Santesoft Sante PACS Server
MediumCVE-2025-54759: CWE-79 Improper Neutralization of Input During Web Page Generation (XSS or 'Cross-site Scripting') in Santesoft Sante PACS Server
MediumActions
Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.