Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-108518 Overview
CVE-2026-108518 is a type confusion vulnerability [CWE-843] in the Perl Database Interface (DBI) module versions before 1.656. The flaw occurs in dbi_profile when a database handle is destroyed while a Profile Path contains an {attr} element. The function expects an inner handle reference but receives the raw inner hash, causing a dereference of the hash's bucket array. When the resulting pointer passes an internal type check, the process terminates with SIGSEGV.
Critical Impact
An attacker who controls the DBI_PROFILE environment variable can crash any unmodified Perl program using DBI by setting DBI_PROFILE={ImplementorClass}, resulting in denial of service.
Affected Products
- Perl DBI module versions prior to 1.656
- Applications setting the Profile Path via the Profile handle attribute
- Perl programs that honor the DBI_PROFILE environment variable
Discovery Timeline
- 2026-10-09 - Fix released in DBI 1.656 by H.Merijn Brand and Robert Rothenberg, crediting Henrik Teichmann for the dbi_profile crash prevention
- 2026-10-20 - CVE-2026-108518 published to NVD and disclosed on the Openwall oss-security mailing list
- 2026-10-22 - Last updated in NVD database
Technical Details for CVE-2026-108518
Vulnerability Analysis
The DBI Profile mechanism records timing and call statistics for database operations. The Profile Path controls how samples are keyed, and an {attr} element in the path instructs dbi_profile to look up a named attribute on the database handle's inner hash. The lookup logic retrieves the inner handle via dbih_inner() and dereferences it as a reference to a hash (HV).
During handle destruction, DBIc_MY_H() returns the inner hash directly rather than a blessed reference to it. Calling SvRV() on that value yields the hash's bucket array (HvARRAY) instead of a valid hash pointer. A subsequent SvTYPE() check usually rejects the result, but when the memory at that address happens to pass validation, the attribute lookup proceeds and dereferences an invalid or NULL pointer, crashing the process.
Root Cause
The root cause is unsafe handling of the dual return behavior of dbih_inner(). The function returns either an RV wrapping the inner handle or the raw inner HV depending on destruction state. The pre-patch code assumed the former and unconditionally applied SvRV(), producing a type-confused pointer.
Attack Vector
The Profile Path can be set by the application, by the Profile handle attribute, or by the DBI_PROFILE environment variable. The environment variable path makes this exploitable against unmodified programs. Any local actor able to set environment variables for a target Perl process can trigger the crash by exporting DBI_PROFILE={ImplementorClass} or any other {attr} path element.
dbh_outer_hv = DBIc_MY_H(imp_dbh);
if (SvTYPE(dbh_outer_hv) != SVt_PVHV)
return &PL_sv_undef; /* presumably global destruction - bail */
- dbh_inner_hv = (HV*)SvRV(dbih_inner(aTHX_ (SV*)dbh_outer_hv, "profile"));
+ { /* dbih_inner() returns the inner handle as an RV, except when it was
+ * given a raw inner HV (DBIc_MY_H() is set to the inner HV while the
+ * outer handle is being destroyed): then it returns that HV itself,
+ * and SvRV() on it would return its bucket array (HvARRAY). */
+ SV *irv = dbih_inner(aTHX_ (SV*)dbh_outer_hv, "profile");
+ dbh_inner_hv = (HV*)(SvROK (irv) ? SvRV (irv) : irv);
+ }
if (SvTYPE(dbh_inner_hv) != SVt_PVHV)
return &PL_sv_undef; /* presumably global destruction - bail */
Source: GitHub Commit Patch c2ff4df. The patch adds an SvROK() check before dereferencing, falling back to the raw SV when dbih_inner() returned the inner HV directly.
Detection Methods for CVE-2026-108518
Indicators of Compromise
- Perl process termination with SIGSEGV immediately after a database handle goes out of scope or during interpreter shutdown
- Presence of the DBI_PROFILE environment variable containing an {attr} element such as {ImplementorClass} on hosts running DBI versions below 1.656
- Core dumps whose stack trace includes dbi_profile and dbih_inner frames
Detection Strategies
- Inventory installed Perl DBI versions across build servers, CGI hosts, and batch processing systems and flag any instance below 1.656
- Audit systemd units, cron jobs, and web application configurations for DBI_PROFILE definitions that include {attr} path elements
- Review application source for calls that assign a Profile Path containing {attr} to the Profile handle attribute
Monitoring Recommendations
- Monitor process exit codes and segfault logs (dmesg, journalctl) for repeated crashes in Perl workloads using DBI
- Alert on new or modified environment variable definitions for DBI_PROFILE in container images and shell profiles
- Collect and centralize core dump metadata to correlate crash signatures across hosts
How to Mitigate CVE-2026-108518
Immediate Actions Required
- Upgrade the Perl DBI module to version 1.656 or later on all affected systems
- Unset or sanitize the DBI_PROFILE environment variable in service wrappers, container entrypoints, and user shells until the patch is deployed
- Review application code for Profile Path strings containing {attr} elements and validate they are not derived from untrusted input
Patch Information
The fix is included in DBI 1.656, released 2026-10-09. See the MetaCPAN Release Changes, the upstream GitHub Security Advisory GHSA-7393-6f8r-fhh3, and the Openwall OSS-Security Post for additional details.
Workarounds
- Remove any {attr} element from the Profile Path when running affected DBI versions
- Prevent the DBI_PROFILE environment variable from being inherited by Perl processes handling untrusted input
- Disable DBI profiling entirely in production environments where it is not actively used
# Upgrade DBI from CPAN
cpan install DBI@1.656
# Verify installed version
perl -MDBI -e 'print "$DBI::VERSION\n"'
# Strip DBI_PROFILE from service environments as a temporary workaround
unset DBI_PROFILE
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

