CVE-2025-15604 is a critical flaw (CVSS 9.8) in the Perl web framework Amon2 before version 6.17. Its random_string function can fall back to predictable values, which affects session IDs, cookie signing secrets and CSRF tokens. Upgrade to Amon2 6.17 or later, then rotate secrets and invalidate sessions.
What's affected
Per the CVE record, Amon2 versions before 6.17 are affected. The fix is Amon2 6.17, released on 27 February 2026. Its changelog says the random_string implementation was replaced with one based on Crypt::SysRandom.
The record describes three stages of the problem:
- Before 6.04,
random_stringused Perl's built-inrand()to build a mixed-case alphanumeric string. - Before 6.06, there was no fallback when
/dev/urandomwas unavailable. - In 6.06 through 6.16, it reads from
/dev/urandom, but if that is unavailable it builds bytes from a SHA-1 hash seeded withrand(), the process ID and the high resolution time.
The process ID comes from a small set of numbers, and the time can be guessed, especially if it is leaked through the HTTP Date header. Perl's rand() is not suitable for cryptographic use.
How to check if you're exposed
Find the installed version of Amon2 on each host:
perl -MAmon2 -e 'print $Amon2::VERSION, "\n"'
cpanm --info Amon2
Check your application's dependency file too, such as cpanfile or cpanfile.snapshot:
grep -n "Amon2" cpanfile cpanfile.snapshot
Anything before 6.17 is affected. Then work out which features use the function. The record names session ID generation, secrets for signing or encrypting cookie sessions and CSRF tokens. Look in your app for session and CSRF plugin configuration, and for any call to random_string in your own code.
What to do now
- Upgrade Amon2 to 6.17 or later and redeploy every service that uses it.
- Generate new secrets for cookie signing and encryption. Anything created before the fix may be predictable, so do not keep the old values.
- Invalidate existing sessions so users sign in again with newly generated IDs.
- Search your own code for calls to
random_stringthat produce tokens, reset links or API keys, and regenerate those too. - Pin the dependency version in your lockfile so older copies do not return.
Why it matters
The record lists CWE-338, Use of Cryptographically Weak Pseudo-Random Number Generator, and CWE-340, Generation of Predictable Numbers or Identifiers. Security tokens only work if guessing them is not feasible. If an attacker can narrow the space to a small number of candidates, the token protects nothing. A session ID that can be guessed is a login handed to whoever guesses it.
The CVSS vector is network based with no privileges or interaction (9.8). The record does not list the CVE in CISA's Known Exploited Vulnerabilities catalog, so I claim no attacks in the wild. The lasting lesson is that upgrading is not enough: secrets that were generated with the weak function stay weak until you replace them.
Keeping old versions from coming back
A fixed dependency can reappear through a stale lockfile or an old container image. Monitoring that re-checks your inventory on a schedule catches that. The free in-browser dependency scan at https://gold.safeguard.sh/scan checks a manifest against known vulnerabilities without installing anything. The Gold directory pages for each CVE and CWE collect the same facts in one place.
Try it yourself
Click through it at your own pace, or open it full screen.
Quick check
Is it enough to upgrade to 6.17?
Upgrade first, then rotate secrets and invalidate sessions. Values created by the old function can stay predictable.
Which Amon2 versions are fine?
The record says versions before 6.17 are affected. Amon2 6.17 and later replace the generator.
Sources
Last reviewed: 19 October 2026.