Crypt::SysRandom::XS versions before 0.010 for Perl is vulnerable to a heap buffer overflow in the XS function random_bytes()
Crypt::SysRandom::XS versions before 0.010 for Perl is vulnerable to a heap buffer overflow in the XS function random_bytes(). 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 chosen random function (e.g. getrandom) 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.
- Products
- Not specified
- Affected versions
- Not specified
- Fixed versions
- Not specified
- CVEs
- CVE-2026-2597
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 2 Nov 2026, 17:18 UTC · Revision 1
Source evidence
Crypt::SysRandom::XS versions before 0.010 for Perl is vulnerable to a heap buffer overflow in the XS function random_bytes()
core-osv · Original sourcePublished 26 Feb 2026, 23:29 UTC
Crypt::SysRandom::XS versions before 0.010 for Perl is vulnerable to a heap buffer overflow in the XS function random_bytes(). 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 chosen random function (e.g. getrandom) 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.
osv:CVE-2026-2597
Complete source record
{
"id": "fb78aa6f8f261379539633ec11c68ec31b4c69d05fcf0128d9914e9f3f12fc63",
"url": "https://osv.dev/vulnerability/CVE-2026-2597",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "Crypt::SysRandom::XS versions before 0.010 for Perl is vulnerable to a heap buffer overflow in the XS function random_bytes()",
"summary": "Crypt::SysRandom::XS versions before 0.010 for Perl is vulnerable to a heap buffer overflow in the XS function random_bytes(). 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 chosen random function (e.g. getrandom) 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.",
"evidence": "osv:CVE-2026-2597",
"products": [],
"severity": "high",
"structured": {
"id": "CVE-2026-2597",
"aliases": [
"CVE-2026-2597"
],
"metrics": [
{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
}
],
"affected": [
{
"ranges": [
{
"repo": "https://github.com/leont/crypt-sysrandom-xs",
"type": "GIT",
"events": [
{
"introduced": "0"
},
{
"fixed": "4ad72a2488e29ba6ca984f73f322fa4081fa5769"
}
],
"database_specific": {
"extracted_events": [
{
"range": [
{
"introduced": "0"
},
{
"fixed": "0.010"
}
],
"source": "AFFECTED_FIELD",
"strategy": "StandardRange"
}
]
}
}
],
"versions": [
"v0.009",
"v0.008",
"v0.007",
"v0.006",
"v0.005",
"v0.004",
"v0.003",
"v0.002",
"v0.001"
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-2597.json"
}
}
],
"modified": "2026-10-28T02:30:21.392329712Z",
"provider": "osv",
"references": [
"https://cpan.org/modules",
"https://metacpan.org/release/LEONT/Crypt-SysRandom-XS-0.011/source/lib/Crypt/SysRandom/XS.xs#L51-52",
"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/2xxx/CVE-2026-2597.json",
"https://metacpan.org/dist/Crypt-SysRandom-XS/changes",
"https://nvd.nist.gov/vuln/detail/CVE-2026-2597",
"https://github.com/Leont/crypt-sysrandom-xs"
],
"provider_metadata": {
"cwe_ids": [
"CWE-122",
"CWE-1284"
],
"cna_assigner": "CPANSec",
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/2xxx/CVE-2026-2597.json"
}
},
"related_cves": [
{
"value": "CVE-2026-2597",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 487670,
"published_at": "2026-02-26T23:29:16.488+00:00"
}