Description
PAGI::Middleware::Session::Store::Cookie versions through 0.001003 for Perl generates random bytes insecurely.

PAGI::Middleware::Session::Store::Cookie attempts to read bytes from the /dev/urandom device directly. If that fails (for example, on systems without the device, such as Windows), then it will emit a warning that recommends the user install Crypt::URandom, and then return a string of random bytes generated by the built-in rand function, which is unsuitable for cryptographic applications.

This modules does not use the Crypt::URandom module, and installing it will not fix the problem.

The random bytes are used for generating an initialisation vector (IV) to encrypt the cookie.

A predictable IV may make it easier for malicious users to decrypt and tamper with the session data that is stored in the cookie.
Published: 2026-03-31
Score: n/a
EPSS: n/a
KEV: No
Impact: Potential for session data tampering due to predictable initialization vector.
Action: Patch
AI Analysis

Impact

The vulnerability arises from the module's use of an insecure source of randomness when generating the initialization vector for encrypting session cookies. The module reads directly from /dev/urandom and falls back to the built‑in rand function when that read fails. Because the built‑in rand provides weak, deterministic output, an attacker can predict the IV. Predictable IVs reduce the strength of the encryption and allow the attacker to decrypt the encrypted data or inject crafted content. Consequently, session data could be read or modified, leading to credential theft or privilege escalation. This weakness is a classic example of CWE‑338 (Cryptographic Failure) and CWE‑1204 (Insecure Randomness).

Affected Systems

The affected product is JJNAPIORK's PAGI::Middleware::Session::Store::Cookie for Perl, versions up to and including 0.001003. Programs that import this module, such as web applications written in Perl that rely on cookie‑based session storage, are vulnerable unless they upgrade. The vulnerability is relevant on operating systems lacking /dev/urandom, for example Windows, where the fallback mechanism is triggered. Systems that run earlier Perl distributions on any OS are also impacted when the module is loaded.

Risk and Exploitability

Although there is no CVSS, EPSS, or KEV entry, the impact is significant for any application that depends on cookie encryption for session integrity. The attack vector requires the attacker to construct a malicious cookie; this is feasible via a typical web request. Once the IV is predictable, the attacker can decrypt the cookie or forge a valid session. Because the weakness is in the cryptographic routine, an exploitation effort is moderate; knowledge of the module’s behavior is sufficient. Upgrading to 0.001004 disables the insecure random source and restores proper IV generation, eliminating the risk.

Generated by OpenCVE AI on March 31, 2026 at 17:22 UTC.

Remediation

Vendor Solution

Upgrade to version 0.001004 or newer.


OpenCVE Recommended Actions

  • Upgrade to version 0.001004 or newer.

Generated by OpenCVE AI on March 31, 2026 at 17:22 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Wed, 01 Apr 2026 02:15:00 +0000

Type Values Removed Values Added
First Time appeared Jjnapiork
Jjnapiork pagi::middleware::session::store::cookie
Vendors & Products Jjnapiork
Jjnapiork pagi::middleware::session::store::cookie
References

Tue, 31 Mar 2026 16:15:00 +0000

Type Values Removed Values Added
Description PAGI::Middleware::Session::Store::Cookie versions through 0.001003 for Perl generates random bytes insecurely. PAGI::Middleware::Session::Store::Cookie attempts to read bytes from the /dev/urandom device directly. If that fails (for example, on systems without the device, such as Windows), then it will emit a warning that recommends the user install Crypt::URandom, and then return a string of random bytes generated by the built-in rand function, which is unsuitable for cryptographic applications. This modules does not use the Crypt::URandom module, and installing it will not fix the problem. The random bytes are used for generating an initialisation vector (IV) to encrypt the cookie. A predictable IV may make it easier for malicious users to decrypt and tamper with the session data that is stored in the cookie.
Title PAGI::Middleware::Session::Store::Cookie versions through 0.001003 for Perl generates random bytes insecurely
Weaknesses CWE-1204
CWE-338
References

Subscriptions

Jjnapiork Pagi::middleware::session::store::cookie
cve-icon MITRE

Status: PUBLISHED

Assigner: CPANSec

Published:

Updated: 2026-03-31T18:18:48.427Z

Reserved: 2026-03-28T19:29:58.433Z

Link: CVE-2026-5087

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Received

Published: 2026-03-31T16:16:35.080

Modified: 2026-03-31T19:16:29.270

Link: CVE-2026-5087

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-03-31T20:37:58Z

Weaknesses