CVE-2025-15604
Insecure Random String Generation in Amon2 Perl Before
Publication date: 2026-03-28
Last updated on: 2026-04-01
Assigner: CPANSec
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| Vendor | Product | Version / Range |
|---|---|---|
| tokuhirom | amon2 | to 6.17 (exc) |
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-338 | The product uses a Pseudo-Random Number Generator (PRNG) in a security context, but the PRNG's algorithm is not cryptographically strong. |
| CWE-340 | The product uses a scheme that generates numbers or identifiers that are more predictable than required. |
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?
This vulnerability exists in Amon2 versions before 6.17 for Perl, where the random_string function used for security purposes relies on an insecure method of generating random values.
In versions 6.06 through 6.16, the function tries to read bytes from /dev/urandom, but if that fails, it falls back to generating bytes by concatenating a SHA-1 hash seeded with the built-in rand() function, the process ID (PID), and high resolution epoch time. The PID comes from a small set of numbers and the epoch time can be guessed or leaked, making the randomness predictable.
Before version 6.06, there was no fallback if /dev/urandom was unavailable, and before version 6.04, the function used only the built-in rand() function to generate random strings, which is unsuitable for cryptographic use.
This function is used for generating session IDs, secrets for signing or encrypting cookie session data, and tokens for Cross Site Request Forgery (CSRF) protection, meaning the weakness can compromise these security mechanisms.
How can this vulnerability impact me? :
Because the random_string function generates predictable or insufficiently random values, attackers could potentially guess or reproduce session IDs, cryptographic secrets, or CSRF tokens.
This can lead to session hijacking, unauthorized access, or bypassing CSRF protections, compromising the security of applications using affected versions of Amon2.
How can this vulnerability be detected on my network or system? Can you suggest some commands?
This vulnerability is related to the insecure implementation of the random_string function in Amon2 versions before 6.17. Detection involves identifying if your system is running a vulnerable version of Amon2 (versions before 6.17) and if the random_string function is used for security purposes such as session ID generation or CSRF tokens.
You can check the installed version of Amon2 by running commands like:
- perl -MAmon2 -e 'print $Amon2::VERSION . "\n"'
Additionally, inspecting the source code or deployed application to verify usage of the random_string function from Amon2::Util can help confirm exposure.
What immediate steps should I take to mitigate this vulnerability?
To mitigate this vulnerability, you should upgrade Amon2 to version 6.17 or later, where the random_string function has been replaced with a secure implementation using the Crypt::SysRandom module.
This update removes the insecure fallback mechanism and ensures cryptographically secure random string generation.
After upgrading, verify the installation by running the test suite with the command:
- ./Build test
This will confirm that the random_string function behaves correctly and securely.
How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:
The vulnerability in Amon2's random_string function affects the security of cryptographic operations such as generating session IDs, signing or encrypting cookie session data, and generating CSRF tokens. Because these functions rely on secure randomness, the use of an insecure random number generator can lead to predictable tokens or secrets.
This insecurity can undermine the confidentiality and integrity of user sessions and data, potentially leading to unauthorized access or data breaches.
Such security weaknesses may impact compliance with standards and regulations like GDPR and HIPAA, which require appropriate technical measures to protect personal and sensitive data, including the use of strong cryptographic methods to prevent unauthorized access.