CVE-2025-40915: CWE-338 Use of Cryptographically Weak Pseudo-Random Number Generator in GRYPHON Mojolicious::Plugin::CSRF
Mojolicious::Plugin::CSRF 1.03 for Perl uses a weak random number source for generating CSRF tokens. That version of the module generates tokens as an MD5 of the process id, the current time, and a single call to the built-in rand() function.
AI Analysis
Technical Summary
CVE-2025-40915 identifies a cryptographic weakness in the GRYPHON Mojolicious::Plugin::CSRF version 1.03, a Perl module used to protect web applications from Cross-Site Request Forgery (CSRF) attacks. The vulnerability stems from the use of a cryptographically weak pseudo-random number generator (PRNG) to create CSRF tokens. Specifically, the tokens are generated by computing an MD5 hash over a combination of the process ID, the current time, and a single call to Perl's built-in rand() function. This approach is insecure because the entropy sources (process ID and current time) are predictable or guessable, and the rand() function is not designed for cryptographic purposes. MD5 itself is also considered weak for cryptographic applications. As a result, attackers can potentially predict or reproduce CSRF tokens, enabling them to bypass CSRF protections and perform unauthorized actions on behalf of legitimate users without their consent. The CVSS v3.1 base score is 7.0 (high severity), reflecting the network attack vector, no privileges required, no user interaction, high confidentiality impact, low integrity impact, and low availability impact. Although no known exploits are currently reported in the wild, the vulnerability poses a significant risk to applications relying on this module for CSRF protection.
Potential Impact
For European organizations, this vulnerability can have serious consequences, especially for those operating web applications built with Perl and utilizing the Mojolicious::Plugin::CSRF version 1.03. Successful exploitation could allow attackers to bypass CSRF protections, leading to unauthorized actions such as changing user settings, initiating transactions, or manipulating sensitive data. This undermines the confidentiality of user data and can lead to reputational damage, regulatory non-compliance (e.g., GDPR violations), and financial losses. The high confidentiality impact is critical in sectors like finance, healthcare, and government services prevalent in Europe. Moreover, the vulnerability's network accessibility and lack of required privileges make it easier for remote attackers to exploit without user interaction, increasing the risk surface. Given the widespread use of Perl in legacy and some modern web applications across Europe, organizations may face targeted attacks exploiting this weakness if patches or mitigations are not applied promptly.
Mitigation Recommendations
To mitigate this vulnerability, organizations should immediately upgrade to a patched version of Mojolicious::Plugin::CSRF once available, or apply vendor-provided patches if released. In the absence of official patches, developers should replace the token generation logic with a cryptographically secure PRNG, such as those provided by the Crypt::PRNG or Crypt::Random Perl modules, and avoid using predictable entropy sources like process IDs or timestamps. Additionally, switching from MD5 to a stronger hash function like SHA-256 or SHA-3 for token generation is recommended. Web application firewalls (WAFs) can be configured to detect and block suspicious CSRF token patterns or anomalous request behaviors as a temporary measure. Organizations should also conduct code audits to identify other instances of weak randomness and enforce secure coding standards for cryptographic operations. Finally, educating developers about secure token generation and regularly updating dependencies will reduce future risks.
Affected Countries
Germany, France, United Kingdom, Netherlands, Italy, Spain, Poland, Sweden
CVE-2025-40915: CWE-338 Use of Cryptographically Weak Pseudo-Random Number Generator in GRYPHON Mojolicious::Plugin::CSRF
Description
Mojolicious::Plugin::CSRF 1.03 for Perl uses a weak random number source for generating CSRF tokens. That version of the module generates tokens as an MD5 of the process id, the current time, and a single call to the built-in rand() function.
AI-Powered Analysis
Technical Analysis
CVE-2025-40915 identifies a cryptographic weakness in the GRYPHON Mojolicious::Plugin::CSRF version 1.03, a Perl module used to protect web applications from Cross-Site Request Forgery (CSRF) attacks. The vulnerability stems from the use of a cryptographically weak pseudo-random number generator (PRNG) to create CSRF tokens. Specifically, the tokens are generated by computing an MD5 hash over a combination of the process ID, the current time, and a single call to Perl's built-in rand() function. This approach is insecure because the entropy sources (process ID and current time) are predictable or guessable, and the rand() function is not designed for cryptographic purposes. MD5 itself is also considered weak for cryptographic applications. As a result, attackers can potentially predict or reproduce CSRF tokens, enabling them to bypass CSRF protections and perform unauthorized actions on behalf of legitimate users without their consent. The CVSS v3.1 base score is 7.0 (high severity), reflecting the network attack vector, no privileges required, no user interaction, high confidentiality impact, low integrity impact, and low availability impact. Although no known exploits are currently reported in the wild, the vulnerability poses a significant risk to applications relying on this module for CSRF protection.
Potential Impact
For European organizations, this vulnerability can have serious consequences, especially for those operating web applications built with Perl and utilizing the Mojolicious::Plugin::CSRF version 1.03. Successful exploitation could allow attackers to bypass CSRF protections, leading to unauthorized actions such as changing user settings, initiating transactions, or manipulating sensitive data. This undermines the confidentiality of user data and can lead to reputational damage, regulatory non-compliance (e.g., GDPR violations), and financial losses. The high confidentiality impact is critical in sectors like finance, healthcare, and government services prevalent in Europe. Moreover, the vulnerability's network accessibility and lack of required privileges make it easier for remote attackers to exploit without user interaction, increasing the risk surface. Given the widespread use of Perl in legacy and some modern web applications across Europe, organizations may face targeted attacks exploiting this weakness if patches or mitigations are not applied promptly.
Mitigation Recommendations
To mitigate this vulnerability, organizations should immediately upgrade to a patched version of Mojolicious::Plugin::CSRF once available, or apply vendor-provided patches if released. In the absence of official patches, developers should replace the token generation logic with a cryptographically secure PRNG, such as those provided by the Crypt::PRNG or Crypt::Random Perl modules, and avoid using predictable entropy sources like process IDs or timestamps. Additionally, switching from MD5 to a stronger hash function like SHA-256 or SHA-3 for token generation is recommended. Web application firewalls (WAFs) can be configured to detect and block suspicious CSRF token patterns or anomalous request behaviors as a temporary measure. Organizations should also conduct code audits to identify other instances of weak randomness and enforce secure coding standards for cryptographic operations. Finally, educating developers about secure token generation and regularly updating dependencies will reduce future risks.
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-16T09:05:34.361Z
- Cvss Version
- null
- State
- PUBLISHED
Threat ID: 6849bbac23110031d4105581
Added to database: 6/11/2025, 5:23:56 PM
Last enriched: 7/12/2025, 9:01:28 AM
Last updated: 11/22/2025, 12:26:35 AM
Views: 39
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
CVE-2025-65947: CWE-400: Uncontrolled Resource Consumption in jzeuzs thread-amount
HighCVE-2025-65946: CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection') in RooCodeInc Roo-Code
HighCVE-2025-12678
UnknownCVE-2025-11933: CWE-20 Improper Input Validation in wofSSL wolfSSL
LowCVE-2025-65111: CWE-277: Insecure Inherited Permissions in authzed spicedb
LowActions
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.