CVE-2023-47038

7.0 HIGH

📋 TL;DR

This vulnerability in Perl allows an attacker to trigger a heap buffer overflow by providing a malicious regular expression. Systems running affected Perl versions (5.30.0 through 5.38.0) that process untrusted regular expressions are vulnerable, potentially leading to arbitrary code execution or denial of service.

💻 Affected Systems

Products:
  • perl
Versions: 5.30.0 through 5.38.0
Operating Systems: Linux, Unix-like systems, Windows if Perl is installed
Default Config Vulnerable: ⚠️ Yes
Notes: Any application or script using Perl's regular expression engine with affected versions is vulnerable when processing untrusted input.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution with the privileges of the Perl process, potentially leading to complete system compromise.

🟠

Likely Case

Denial of service through application crashes or memory corruption, disrupting services that use Perl for regular expression processing.

🟢

If Mitigated

Limited impact if regular expressions are only processed from trusted sources or if the Perl process runs with minimal privileges.

🌐 Internet-Facing: MEDIUM - Exploitation requires the ability to supply crafted regular expressions to vulnerable Perl applications, which may be exposed through web interfaces or APIs.
🏢 Internal Only: LOW - Internal systems typically process trusted data, but risk exists if they handle user-supplied regular expressions from internal sources.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ⚠️ Yes
Complexity: MEDIUM

Exploitation requires crafting a specific regular expression to trigger the buffer overflow, which may be complex but feasible for skilled attackers.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Perl 5.38.2 or later, or backported patches in distributions like Red Hat and Debian

Vendor Advisory: https://access.redhat.com/security/cve/CVE-2023-47038

Restart Required: Yes

Instructions:

1. Update Perl to version 5.38.2 or later from official sources. 2. For Linux distributions, use package manager: 'sudo yum update perl' (RHEL/CentOS) or 'sudo apt update && sudo apt upgrade perl' (Debian/Ubuntu). 3. Restart any services or applications using Perl.

🔧 Temporary Workarounds

Input Validation

all

Validate and sanitize all regular expression inputs from untrusted sources to prevent malicious patterns.

Privilege Reduction

linux

Run Perl processes with minimal privileges (e.g., non-root users) to limit impact if exploitation occurs.

sudo -u nobody perl script.pl

🧯 If You Can't Patch

  • Isolate vulnerable systems from untrusted networks and restrict access to only trusted users.
  • Monitor for unusual process crashes or memory usage in Perl applications as indicators of potential exploitation.

🔍 How to Verify

Check if Vulnerable:

Run 'perl -v' to check the version. If it's between 5.30.0 and 5.38.0 inclusive, the system is vulnerable.

Check Version:

perl -v | head -2

Verify Fix Applied:

After patching, run 'perl -v' to confirm the version is 5.38.2 or later, or check with 'rpm -q perl' (RHEL) or 'dpkg -l perl' (Debian) for updated package versions.

📡 Detection & Monitoring

Log Indicators:

  • Segmentation fault or crash logs from Perl processes
  • Unusual memory allocation errors in application logs

Network Indicators:

  • Unexpected network traffic to Perl-based services with crafted payloads

SIEM Query:

source="*perl*" AND ("segmentation fault" OR "buffer overflow" OR "memory corruption")

🔗 References

📤 Share & Export