Crypt::SysRandom::XS Heap Buffer Overflow Vulnerability in Perl

Vulnerability

A heap buffer overflow vulnerability has been identified in Crypt::SysRandom::XS versions prior to 0.010 for Perl. The issue arises in the XS function random_bytes(), which fails to validate that the length parameter is non-negative. When a negative value is supplied, it causes an integer wraparound, leading to a zero-byte allocation. This allows for a subsequent call to the chosen random function to pass the original negative value, converted to a large unsigned value, resulting in writes beyond the allocated buffer. Such memory corruption can cause the application to crash, creating a denial-of-service condition. While the length argument is usually hardcoded, applications that accept untrusted input may be vulnerable.

Impact

Exploitation of this vulnerability leads to heap memory corruption, causing the application to crash and creating a denial-of-service condition.

Reproduction

To reproduce this vulnerability, call the random_bytes() function with a negative length parameter. The function will allocate a buffer of zero bytes and then attempt to write random data using the negative value, which is converted to a large unsigned integer. This results in a buffer overflow, corrupting heap memory.

Remediation

Users are advised to update to Crypt::SysRandom::XS version 0.010 or later, where this vulnerability has been addressed.

Added: Feb 27, 2026, 12:21 AM
Updated: Feb 27, 2026, 12:21 AM

Vulnerability Rating

Custom Algorithm
spread
0.0
impact
2.5
exploitability
6.3
remediation
0.0
relevance
3.3
threat
4.8
urgency
2.9
incentive
0.0

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.