Skip to main content

CVE-2025-40915: CWE-338 Use of Cryptographically Weak Pseudo-Random Number Generator in GRYPHON Mojolicious::Plugin::CSRF

High
VulnerabilityCVE-2025-40915cvecve-2025-40915cwe-338
Published: Wed Jun 11 2025 (06/11/2025, 17:09:50 UTC)
Source: CVE Database V5
Vendor/Project: GRYPHON
Product: 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

AILast updated: 07/12/2025, 09:01:28 UTC

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.

Need more detailed analysis?Get Pro

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: 7/30/2025, 4:17:09 PM

Views: 19

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats