CVE-2020-10878 Overview
CVE-2020-10878 is an integer overflow vulnerability in Perl versions before 5.30.3 that occurs during the handling of regular expression compilation. Specifically, the vulnerability is related to mishandling of a PL_regkind[OP(n)] == NOTHING situation in the regex compiler. A crafted regular expression can trigger integer overflow conditions that lead to malformed bytecode generation, potentially allowing instruction injection attacks.
Critical Impact
Attackers exploiting this vulnerability can inject malicious instructions through crafted regular expressions, potentially leading to arbitrary code execution, information disclosure, or denial of service on affected systems.
Affected Products
- Perl versions before 5.30.3
- Fedora 31
- openSUSE Leap 15.1
- NetApp OnCommand Workflow Automation
- NetApp Snap Creator Framework
- Oracle Communications Billing and Revenue Management (versions 12.0.0.2.0, 12.0.0.3.0)
- Oracle Communications Diameter Signaling Router
- Oracle Communications Eagle Application Processor
- Oracle Communications Eagle LNP Application Processor (versions 10.1, 10.2, 46.7, 46.8, 46.9)
- Oracle Communications LSMS
- Oracle Communications Offline Mediation Controller (version 12.0.0.3.0)
- Oracle Communications Performance Intelligence Center
- Oracle Communications Pricing Design Center (version 12.0.0.3.0)
- Oracle Configuration Manager (version 12.1.2.0.8)
- Oracle Enterprise Manager Base Platform (version 13.4.0.0)
- Oracle SD-WAN Aware (versions 8.2, 9.0, 9.1)
- Oracle Tekelec Platform Distribution
Discovery Timeline
- June 5, 2020 - CVE-2020-10878 published to NVD
- November 21, 2024 - Last updated in NVD database
Technical Details for CVE-2020-10878
Vulnerability Analysis
This vulnerability is classified as CWE-190 (Integer Overflow or Wraparound). The flaw exists in Perl's regular expression compiler (regcomp.c) where large regex patterns can cause integer overflow conditions. When the compiled regex size exceeds U16_MAX, the system fails to properly handle branch jump calculations, leading to malformed bytecode generation.
The vulnerability is network-exploitable because Perl scripts are commonly used for web applications, CGI processing, and network service parsing where untrusted regex patterns may be processed. An attacker can craft a malicious regular expression that, when compiled, triggers the integer overflow and produces corrupted bytecode with injected instructions.
Root Cause
The root cause is the failure to use long jumps (BRANCHJ) when the compiled regular expression size has any possibility of exceeding U16_MAX. Without this safeguard, the regex compiler generates incorrect branch offsets when dealing with large patterns, specifically when PL_regkind[OP(n)] == NOTHING situations arise. This leads to integer overflow during offset calculations, corrupting the generated bytecode.
Attack Vector
This vulnerability can be exploited remotely over the network when Perl processes untrusted regular expression input. Attack scenarios include:
- Web applications accepting user-supplied regex patterns for search or validation
- CGI scripts processing regex from HTTP requests
- Email servers using Perl-based spam filters with regex matching
- Log analysis tools parsing untrusted data with regex patterns
The attacker constructs a specially crafted regular expression designed to trigger the integer overflow condition during compilation, causing instruction injection in the resulting bytecode.
// Security patch in regcomp.c - regcomp: use long jumps if there is any possibility of overflow
/* We have that number in RExC_npar */
RExC_total_parens = RExC_npar;
+
+ /* XXX For backporting, use long jumps if there is any possibility of
+ * overflow */
+ if (RExC_size > U16_MAX && ! RExC_use_BRANCHJ) {
+ RExC_use_BRANCHJ = TRUE;
+ flags |= RESTART_PARSE;
+ }
}
else if (! MUST_RESTART(flags)) {
ReREFCNT_dec(Rx);
Source: Perl Commit Log Entry 3295b48
// Security patch in embed.h - study_chunk: extract rck_elide_nothing
#define parse_lparen_question_flags(a) S_parse_lparen_question_flags(aTHX_ a)
#define parse_uniprop_string(a,b,c,d,e,f,g,h,i) Perl_parse_uniprop_string(aTHX_ a,b,c,d,e,f,g,h,i)
#define populate_ANYOF_from_invlist(a,b) S_populate_ANYOF_from_invlist(aTHX_ a,b)
+#define rck_elide_nothing(a) S_rck_elide_nothing(aTHX_ a)
#define reg(a,b,c,d) S_reg(aTHX_ a,b,c,d)
#define reg2Lanode(a,b,c,d) S_reg2Lanode(aTHX_ a,b,c,d)
#define reg_node(a,b) S_reg_node(aTHX_ a,b)
Source: Perl Commit Log Entry 0a320d7
Detection Methods for CVE-2020-10878
Indicators of Compromise
- Unusually large or complex regular expression patterns in application logs
- Perl process crashes or unexpected termination during regex compilation
- Memory corruption indicators in Perl application error logs
- Anomalous bytecode execution patterns in Perl debugging output
Detection Strategies
- Monitor for exceptionally long regex pattern inputs exceeding normal application boundaries
- Implement application-level logging for regex compilation operations
- Deploy runtime application self-protection (RASP) to detect integer overflow attempts
- Use SentinelOne Singularity platform to monitor for suspicious Perl process behavior and memory anomalies
Monitoring Recommendations
- Enable verbose logging in Perl applications processing user-supplied regex patterns
- Configure alerting for Perl process crashes or segmentation faults
- Monitor system calls from Perl interpreters for anomalous patterns
- Track resource consumption metrics for Perl processes handling regex operations
How to Mitigate CVE-2020-10878
Immediate Actions Required
- Upgrade Perl to version 5.30.3 or later immediately
- Audit applications for user-supplied regex input processing
- Implement input validation to restrict regex pattern size and complexity
- Consider sandboxing Perl applications that process untrusted input
Patch Information
The vulnerability has been addressed in Perl version 5.30.3 and later. The fix introduces the rck_elide_nothing function and enforces the use of long jumps (BRANCHJ) when regex size has any possibility of overflowing U16_MAX. Security patches are available through official Perl repositories and distribution package managers.
Key patch commits:
- Perl Commit 0a320d7 - Extract rck_elide_nothing function
- Perl Commit 3295b48 - Use long jumps if there is any possibility of overflow
For additional vendor-specific patches, consult:
Workarounds
- Implement strict input validation to limit regex pattern length and complexity before processing
- Use application-level allowlists for acceptable regex patterns where possible
- Deploy Web Application Firewalls (WAF) with rules to filter suspicious regex inputs
- Consider using alternative regex libraries with better overflow protections for untrusted input
# Configuration example - Check and upgrade Perl version
perl -v | grep version
# Upgrade to patched version via package manager
# Debian/Ubuntu:
sudo apt-get update && sudo apt-get install perl
# RHEL/CentOS:
sudo yum update perl
# Fedora:
sudo dnf update perl
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


