☠️
EXFILTRATING
DATA...
01010111 10110010 00101001 11000110 01101100 10011011 00010001 11100101 01000010 10101111
[ <-- BACK_TO_SEARCH ]
Perl logo [ WEBSITE ] [ VENDOR STATS ]
CVSS: 9.8 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H 🐛 CWE-680
👁️
Common Weakness Enumeration - Identifies the specific category of software weakness or flaw.

CVE-2026-8376

CVE-2026-8376 Buffer Overflow in Perl
📅 PUBLISHED: 2026-05-25 23:53 UTC 🔄 UPDATED: 2026-10-17 01:08 UTC
[ OFFICIAL PATCH DEPLOYED ↓ ] FIX: LIKELY — 2 distinct-origin sources confirm fix
[ DEFENSE PATCH ↓ ]
💣 PoC: None
👁️
Proof of Concept - Indicates if functional exploit code is publicly available, drastically increasing the risk of immediate attacks.
🎯 EPSS: 0.48%
👁️
0.48% probability
12.0× above the median CVE
Tier: ELEVATED
30-day exploitation window · FIRST.org · updated daily
Affected: Perl — upgrade to patched release
CVSS VECTOR BREAKDOWN 9.8
AV: N Attack Vector Network
AC: L Attack Complexity Low
PR: N Privileges Required None
UI: N User Interaction None
S: U Scope Unchanged
C: H Confidentiality High
I: H Integrity High
A: H Availability High
9.8
THREAT LEVEL
■ tracking this CVE ✓ independent patch confirmation ⧗ same-origin mirror (GHSA) ⚠ active exploitation verification policy →

Executive Summary

CVE-2026-8376 is a heap buffer overflow vulnerability in Perl's regular expression compiler, specifically in the Perl_study_chunk function within regcomp_study.c. The flaw occurs when compiling a regular expression containing a repeated fixed string on 32-bit builds. The root cause is a size calculation error: the code checks the size of the joined substring buffer in characters rather than bytes. For a quantified fixed substring with a large minimum count, the byte length mincount * l can overflow SSize_t, leading to an undersized SvGROW allocation. The subsequent copy operation writes past the end of the buffer, causing a heap buffer overflow at compile time.

An attacker who can supply a crafted regular expression to a 32-bit Perl build can trigger this vulnerability, potentially leading to arbitrary code execution or denial of service. The vulnerability is present in all Perl versions through 5.43.10 on 32-bit architectures.

⚡ AUTOMATE YOUR CVE INTELLIGENCE

This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.

›Patch confidence — UNVERIFIED to CONFIRMED, cross-referenced NVD + RHSA + Debian
›Exploit & PoC — poc_status, poc_url, has_exploit. Not in NVD.
›Shodan dorks — ready-made queries to find exposed vulnerable systems
›Detection rules — YARA · Wazuh · Elastic (all plans) · Sigma (Pro)
›pending_fields — know exactly which of 7 fields NVD hasn't processed yet
›Free backfill — data incomplete when you paid? Re-check within 30 days = 0 credits
PAYG €0.08/lookup Standard €19/mo (was €29) · 5k credits Pro €65/mo (was €99) · 20k credits FOUNDING PRICE · LOCKED FOR LIFE · ENDS 31 DEC 2026
[ FROM €19/MO ]
Free sandbox key available
No signup required

Supply Chain & Package Security

Perl is a widely used scripting language, and this vulnerability affects the core interpreter. Any application or system that compiles attacker-controlled regular expressions on a 32-bit Perl build is at risk. This includes web applications, automation scripts, and security tools that use Perl's regex engine. The vulnerability is particularly dangerous in shared hosting environments or CI/CD pipelines where untrusted users can supply regex patterns.

CVSS Breakdown & Threat Level

CVSS Score: 7.8 (High) Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

  • Attack Vector (AV): Local (L) - The attacker must have local access to the system or be able to supply a regex to a local Perl process.
  • Attack Complexity (AC): Low (L) - No special conditions are required; the vulnerability is triggered by compiling a crafted regex.
  • Privileges Required (PR): Low (L) - The attacker needs low privileges to run Perl or supply a regex.
  • User Interaction (UI): None (N) - No user interaction is required beyond the attacker's action.
  • Scope (S): Unchanged (U) - The vulnerability does not affect other components.
  • Confidentiality (C): High (H) - Potential for memory disclosure.
  • Integrity (I): High (H) - Potential for memory corruption leading to code execution.
  • Availability (A): High (H) - Potential for crash or denial of service.

Threat Level: High. The vulnerability is exploitable at compile time, and the overflow can lead to arbitrary code execution. However, it is limited to 32-bit builds, which reduces the attack surface.

Deep Dive & Mechanics

The vulnerability resides in the Perl_study_chunk function in regcomp_study.c. This function is part of Perl's regular expression compiler and is responsible for analyzing and optimizing regex patterns. Specifically, it handles the "study" phase, where the compiler examines the pattern to determine if it can be optimized.

The bug occurs when processing a quantified fixed substring (e.g., (?:abc){N} where N is large). The code calculates the size of the buffer needed to hold the joined substring. The calculation is:

SSize_t mincount = ...; // minimum count of the quantifier
SSize_t l = ...; // length of the fixed substring in characters
SSize_t byte_len = mincount * l; // This is the bug: l is in characters, not bytes

On 32-bit builds, SSize_t is a signed 32-bit integer. If mincount * l exceeds SSIZE_MAX (2^31 - 1), the multiplication overflows, producing a small or negative value. This value is then used in SvGROW to allocate memory:

SvGROW(sv, byte_len + 1); // byte_len may be small due to overflow

The subsequent copy operation writes the actual data (which is much larger) past the end of the allocated buffer, causing a heap buffer overflow.

The fix would involve using a proper size calculation that accounts for bytes and checks for overflow before allocation. For example:

Size_t byte_len = (Size_t)mincount * (Size_t)l * sizeof(char); // but char is 1 byte, so this is still wrong
// Correct: use Perl's safe multiplication macros or check for overflow

Vulnerable vs. Patched Code

Vulnerable Code (Perl 5.43.10, regcomp_study.c):

// In Perl_study_chunk
SSize_t mincount = ...;
SSize_t l = ...;
SSize_t byte_len = mincount * l; // Overflow on 32-bit
SvGROW(sv, byte_len + 1); // Undersized allocation
Copy(data, SvPVX(sv), mincount * l, char); // Buffer overflow

Patched Code (Hypothetical fix):

// In Perl_study_chunk
SSize_t mincount = ...;
SSize_t l = ...;
// Use a safe multiplication that checks for overflow
Size_t byte_len;
if (ckd_mul(&byte_len, (Size_t)mincount, (Size_t)l)) {
    // Overflow detected, handle error
    Perl_croak(aTHX_ "Quantifier too large");
}
SvGROW(sv, byte_len + 1);
Copy(data, SvPVX(sv), byte_len, char);

The key difference is the use of a checked multiplication (e.g., ckd_mul from C23 or a custom macro) to detect overflow before allocation.

Exploitation & Lab Setup

Red Team

Prerequisites:

  • A 32-bit Perl build (version 5.43.10 or earlier)
  • Ability to supply a crafted regular expression to a Perl script

Exploitation Steps:

  1. Craft the malicious regex: Create a regex with a quantified fixed substring where the minimum count is large enough to cause overflow. For example:

    my $regex = '(?:a){' . (2**30) . '}'; # mincount = 2^30, l = 1
    

    This will cause mincount * l = 2^30, which overflows on 32-bit.

  2. Trigger compilation: Pass the regex to Perl's regex compiler:

    my $compiled = qr/$regex/;
    
  3. Observe the crash or exploit: The overflow will cause a heap buffer overflow. With careful heap grooming, an attacker may achieve arbitrary code execution.

Example exploit script (conceptual):

#!/usr/bin/perl
use strict;
use warnings;

# Craft a regex that triggers the overflow
my $mincount = 2**30; # 1073741824
my $regex = '(?:a){' . $mincount . '}';

# Compile the regex (triggers the vulnerability)
my $compiled = qr/$regex/;

print "Regex compiled successfully (unexpected)\n";

Note: No public exploit code is available. This is a proof-of-concept.

Blue Team

Detection:

  • Monitor for Perl processes that crash with heap corruption errors (e.g., SIGSEGV, SIGABRT).
  • Look for Perl scripts that compile regexes with extremely large quantifiers.
  • Use memory analysis tools (e.g., Valgrind, AddressSanitizer) to detect heap overflows.

Mitigation:

  • Upgrade to a patched version of Perl (once available).
  • If patching is not possible, avoid compiling untrusted regexes on 32-bit Perl builds.
  • Use a 64-bit Perl build where the overflow is less likely (though still possible with larger values).
  • Implement input validation to reject regexes with excessive quantifiers.

Indicators of Compromise (IOCs)

  • Process crash: Perl process terminates with SIGSEGV or SIGABRT.
  • Memory corruption: Heap buffer overflow detected by memory analysis tools.
  • Log entries: Perl error messages like "panic: sv_grow" or "Out of memory!" during regex compilation.
  • File artifacts: Core dumps from Perl processes.
  • Network indicators: None (local vulnerability).

Detection Engineering

YARA Rule

rule CVE_2026_8376_Perl_HeapOverflow {
    meta:
        description = "Detects Perl binaries vulnerable to CVE-2026-8376 heap buffer overflow"
        author = "Valters IT"
        date = "2026-01-01"
        reference = "https://nvd.nist.gov/vuln/detail/CVE-2026-8376"
        hash = "unknown"
    strings:
        $vuln_func = "Perl_study_chunk" ascii wide nocase
        $vuln_file = "regcomp_study.c" ascii wide nocase
        $overflow_calc = { 8B 45 ?? 0F AF 45 ?? 89 45 ?? } // mov eax, [mincount]; imul eax, [l]; mov [byte_len], eax
    condition:
        $vuln_func and $vuln_file and $overflow_calc
}

Sigma Rule

title: CVE-2026-8376 Perl Heap Buffer Overflow Detection
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects potential exploitation of CVE-2026-8376 via Perl regex compilation with large quantifiers
author: Valters IT
date: 2026-01-01
logsource:
    category: process_creation
    product: linux
detection:
    selection:
        Image|endswith: '/perl'
        CommandLine|contains: 'qr/'
        CommandLine|re: '\\{[0-9]{7,}\\}' # Quantifier with 7+ digits
    condition: selection
falsepositives:
    - Legitimate use of large quantifiers in regex (rare)
level: high

Suricata Rule

alert tcp any any -> any any (msg:"CVE-2026-8376 Perl Heap Overflow Attempt"; flow:to_server; content:"qr/"; within:100; pcre:"/\\{[0-9]{7,}\\}/"; classtype:attempted-admin; sid:1000001; rev:1;)

Remediation & Mitigation

Immediate Actions:

  1. Upgrade Perl: Apply the official patch once released by the Perl project. Monitor the Perl security mailing list for updates.
  2. Use 64-bit builds: If possible, migrate to 64-bit Perl builds where the overflow threshold is much higher (though still theoretically possible).
  3. Input validation: Reject regex patterns with quantifiers that exceed a safe limit (e.g., mincount * l > 10^6).

Long-term Mitigations:

  • Code review: Audit all uses of Perl_study_chunk and similar functions for integer overflow issues.
  • Compiler flags: Use compiler flags like -ftrapv to catch signed integer overflows at runtime.
  • Memory safety: Use AddressSanitizer (ASan) during development to detect heap overflows.

Workarounds:

  • If patching is not possible, disable regex compilation for untrusted input by using use re 'eval' with caution or by sanitizing input.
  • Run Perl in a sandboxed environment (e.g., Docker, seccomp) to limit the impact of exploitation.

Valters IT
DevSecOps & Cyber Threat Intelligence

◈ SOURCE Analysis & enrichment: valtersit.com/cve/CVE-2026-8376/ · CVE data: NVD/MITRE (public domain) · © 2026 ValtersIT Hub
>_ SYSTEM_CORE: INTEL_ACTIVE
90% TEAM-CURATED // 10% AUTOMATED INGESTION.
ALL PATCH REFERENCES AND VERSION DATA SOURCED FROM NVD + OSV OFFICIAL REGISTRIES.