CVE-2024-58135: CWE-338 Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG) in SRI Mojolicious
Mojolicious versions from 7.28 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.
AI Analysis
Technical Summary
CVE-2024-58135 identifies a cryptographic weakness in the Mojolicious Perl web framework version 7.28, specifically in the default application skeleton generated by the "mojo generate app" command. The vulnerability arises because the session cookie secrets used for HMAC authentication and integrity protection are generated using the standard rand() function, which is not cryptographically secure. This weak PRNG (Pseudo-Random Number Generator) can produce predictable session keys, enabling attackers to perform brute force attacks to guess or derive valid session secrets. Since these secrets protect session cookies, compromising them can lead to session hijacking or impersonation attacks. The vulnerability does not require user interaction or prior authentication and can be exploited remotely over the network. The CVSS 3.1 base score is 5.3 (medium), reflecting the ease of network exploitation but limited impact to confidentiality only, with no direct impact on integrity or availability. No patches or fixes are currently linked, so mitigation requires manual intervention to replace weak secrets with cryptographically secure random values. The vulnerability is cataloged under CWE-338, indicating the use of a weak PRNG. Although no known exploits are reported in the wild, the risk is significant for applications relying on default configurations without additional secret management. Organizations using Mojolicious 7.28 should audit their session secret generation and update to secure methods to prevent potential session compromise.
Potential Impact
The primary impact of CVE-2024-58135 is the potential compromise of session confidentiality in web applications built with Mojolicious 7.28 using default configurations. Attackers can brute force weak HMAC session secrets generated by the insecure rand() function, allowing them to forge or hijack user sessions. This can lead to unauthorized access to user accounts and sensitive data, undermining trust and potentially violating data protection regulations such as GDPR. For European organizations, especially those in sectors like finance, healthcare, and government that rely on secure web sessions, this vulnerability could expose critical user information and services to attackers. While the vulnerability does not affect data integrity or availability directly, session compromise can facilitate further attacks or data exfiltration. The ease of exploitation over the network without authentication increases risk, particularly for publicly accessible web applications. The absence of known exploits in the wild reduces immediate urgency but does not eliminate the threat, as attackers may develop exploits. Organizations failing to address this may face reputational damage, regulatory penalties, and operational disruptions if session hijacking occurs.
Mitigation Recommendations
To mitigate CVE-2024-58135, organizations should immediately audit all Mojolicious 7.28 applications created with the "mojo generate app" tool to identify usage of default session secrets. Replace any secrets generated with the insecure rand() function with cryptographically secure random values, such as those produced by Perl modules like Crypt::PRNG or using system-level secure random sources (e.g., /dev/urandom). Avoid relying on default generated secrets in production environments; instead, explicitly configure strong, unique session keys. Developers should update application skeletons or scripts to use secure random generation methods for session secrets. Additionally, monitor application logs for suspicious session activity that could indicate brute force attempts. Where feasible, upgrade to newer Mojolicious versions if patches addressing this issue become available. Implement multi-factor authentication and session timeout policies to reduce the impact of potential session hijacking. Finally, conduct security awareness training for developers on the importance of cryptographically secure random number generation in session management.
Affected Countries
Germany, United Kingdom, France, Netherlands, Sweden
CVE-2024-58135: CWE-338 Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG) in SRI Mojolicious
Description
Mojolicious versions from 7.28 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.
AI-Powered Analysis
Technical Analysis
CVE-2024-58135 identifies a cryptographic weakness in the Mojolicious Perl web framework version 7.28, specifically in the default application skeleton generated by the "mojo generate app" command. The vulnerability arises because the session cookie secrets used for HMAC authentication and integrity protection are generated using the standard rand() function, which is not cryptographically secure. This weak PRNG (Pseudo-Random Number Generator) can produce predictable session keys, enabling attackers to perform brute force attacks to guess or derive valid session secrets. Since these secrets protect session cookies, compromising them can lead to session hijacking or impersonation attacks. The vulnerability does not require user interaction or prior authentication and can be exploited remotely over the network. The CVSS 3.1 base score is 5.3 (medium), reflecting the ease of network exploitation but limited impact to confidentiality only, with no direct impact on integrity or availability. No patches or fixes are currently linked, so mitigation requires manual intervention to replace weak secrets with cryptographically secure random values. The vulnerability is cataloged under CWE-338, indicating the use of a weak PRNG. Although no known exploits are reported in the wild, the risk is significant for applications relying on default configurations without additional secret management. Organizations using Mojolicious 7.28 should audit their session secret generation and update to secure methods to prevent potential session compromise.
Potential Impact
The primary impact of CVE-2024-58135 is the potential compromise of session confidentiality in web applications built with Mojolicious 7.28 using default configurations. Attackers can brute force weak HMAC session secrets generated by the insecure rand() function, allowing them to forge or hijack user sessions. This can lead to unauthorized access to user accounts and sensitive data, undermining trust and potentially violating data protection regulations such as GDPR. For European organizations, especially those in sectors like finance, healthcare, and government that rely on secure web sessions, this vulnerability could expose critical user information and services to attackers. While the vulnerability does not affect data integrity or availability directly, session compromise can facilitate further attacks or data exfiltration. The ease of exploitation over the network without authentication increases risk, particularly for publicly accessible web applications. The absence of known exploits in the wild reduces immediate urgency but does not eliminate the threat, as attackers may develop exploits. Organizations failing to address this may face reputational damage, regulatory penalties, and operational disruptions if session hijacking occurs.
Mitigation Recommendations
To mitigate CVE-2024-58135, organizations should immediately audit all Mojolicious 7.28 applications created with the "mojo generate app" tool to identify usage of default session secrets. Replace any secrets generated with the insecure rand() function with cryptographically secure random values, such as those produced by Perl modules like Crypt::PRNG or using system-level secure random sources (e.g., /dev/urandom). Avoid relying on default generated secrets in production environments; instead, explicitly configure strong, unique session keys. Developers should update application skeletons or scripts to use secure random generation methods for session secrets. Additionally, monitor application logs for suspicious session activity that could indicate brute force attempts. Where feasible, upgrade to newer Mojolicious versions if patches addressing this issue become available. Implement multi-factor authentication and session timeout policies to reduce the impact of potential session hijacking. Finally, conduct security awareness training for developers on the importance of cryptographically secure random number generation in session management.
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: 10/20/2025, 8:46:33 PM
Last updated: 11/22/2025, 5:59:50 PM
Views: 34
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Related Threats
China-Linked APT31 Launches Stealthy Cyberattacks on Russian IT Using Cloud Services
MediumCVE-2025-2655: SQL Injection in SourceCodester AC Repair and Services System
MediumCVE-2023-30806: CWE-78 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') in Sangfor Net-Gen Application Firewall
CriticalCVE-2024-0401: CWE-78 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') in ASUS ExpertWiFi
HighCVE-2024-23690: CWE-78 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') in Netgear FVS336Gv3
HighActions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.