Crypt::URandom versions from 0.41 before 0.55 for Perl is vulnerable to a heap buffer overflow in the XS function crypt_urandom_getrandom().
The function does not validate that the length parameter is non-negative. If a negative value (e.g. -1) is supplied, the expression length + 1u causes an integer wraparound, resulting in a zero-byte allocation. The subsequent call to getrandom(data, length, GRND_NONBLOCK) passes the original negative value, which is implicitly converted to a large unsigned value (typically SIZE_MAX). This can result in writes beyond the allocated buffer, leading to heap memory corruption and application crash (denial of service).
In common usage, the length argument is typically hardcoded by the caller, which reduces the likelihood of attacker-controlled exploitation. Applications that pass untrusted input to this parameter may be affected.
GHSA-mwq4-j679-7frp
Crypt::URandom versions from 0.41 before 0.55 for Perl is vulnerable to a heap buffer overflow in...
https://github.com/advisories/GHSA-mwq4-j679-7frpCrypt::URandom versions from 0.41 before 0.55 for Perl is vulnerable to a heap buffer overflow in the XS function crypt_urandom_getrandom().
The function does not validate that the length parameter is non-negative. If a negative value (e.g. -1) is supplied, the expression length + 1u causes an integer wraparound, resulting in a zero-byte allocation. The subsequent call to getrandom(data, length, GRND_NONBLOCK) passes the original negative value, which is implicitly converted to a large unsigned value (typically SIZE_MAX). This can result in writes beyond the allocated buffer, leading to heap memory corruption and application crash (denial of service).
In common usage, the length argument is typically hardcoded by the caller, which reduces the likelihood of attacker-controlled exploitation. Applications that pass untrusted input to this parameter may be affected.
Click to expand
{
"dataType": "CVE_RECORD",
"dataVersion": "5.2",
"cveMetadata": {
"cveId": "CVE-2026-2474",
"assignerOrgId": "9b29abf9-4ab0-4765-b253-1875cd9b441e",
"assignerShortName": "CPANSec",
"dateUpdated": "2026-02-16T20:54:51.357Z",
"dateReserved": "2026-02-13T15:45:19.206Z",
"datePublished": "2026-02-16T20:54:51.357Z",
"state": "PUBLISHED"
},
"containers": {
"cna": {
"providerMetadata": {
"orgId": "9b29abf9-4ab0-4765-b253-1875cd9b441e",
"shortName": "CPANSec",
"dateUpdated": "2026-02-16T20:54:51.357Z"
},
"title": "Crypt::URandom versions from 0.41 before 0.55 for Perl is vulnerable to a heap buffer overflow in the XS function crypt_urandom_getrandom()",
"descriptions": [
{
"lang": "en",
"value": "Crypt::URandom versions from 0.41 before 0.55 for Perl is vulnerable to a heap buffer overflow in the XS function crypt_urandom_getrandom().\n\nThe function does not validate that the length parameter is non-negative. If a negative value (e.g. -1) is supplied, the expression length + 1u causes an integer wraparound, resulting in a zero-byte allocation. The subsequent call to getrandom(data, length, GRND_NONBLOCK) passes the original negative value, which is implicitly converted to a large unsigned value (typically SIZE_MAX). This can result in writes beyond the allocated buffer, leading to heap memory corruption and application crash (denial of service).\n\nIn common usage, the length argument is typically hardcoded by the caller, which reduces the likelihood of attacker-controlled exploitation. Applications that pass untrusted input to this parameter may be affected."
}
],
"affected": [
{
"vendor": "DDICK",
"product": "Crypt::URandom",
"collectionURL": "https://cpan.org/modules",
"packageName": "Crypt-URandom",
"programFiles": [
"URandom.xs"
],
"programRoutines": [
{
"name": "crypt_urandom_getrandom()"
}
],
"repo": "https://github.com/david-dick/crypt-urandom",
"defaultStatus": "unaffected",
"versions": [
{
"version": "0.41",
"status": "affected",
"versionType": "custom",
"lessThan": "0.55"
}
]
}
],
"problemTypes": [
{
"descriptions": [
{
"lang": "en",
"description": "CWE-122 Heap-based Buffer Overflow",
"cweId": "CWE-122",
"type": "CWE"
}
]
},
{
"descriptions": [
{
"lang": "en",
"description": "CWE-1284 Improper Validation of Specified Quantity in Input",
"cweId": "CWE-1284",
"type": "CWE"
}
]
}
],
"references": [
{
"url": "https://metacpan.org/release/DDICK/Crypt-URandom-0.55/source/Changes",
"tags": [
"release-notes"
]
},
{
"url": "https://metacpan.org/release/DDICK/Crypt-URandom-0.54/source/URandom.xs#L35-79",
"tags": [
"related"
]
}
],
"solutions": [
{
"lang": "en",
"value": "Update to version 0.55 or later"
}
]
}
}
}