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-110758 Overview
CVE-2026-110758 affects Text::CSV_XS versions before 1.65 for Perl. The vulnerability resides in the strip_trail_whitespace routine when allow_whitespace is enabled. The function removes trailing spaces and tabs from each unquoted field without checking whether it has reached the start of the field buffer. For an all-blank field, the walk reads the byte immediately before the field's heap buffer and may zero it, continuing backward depending on allocator state. The flaw is classified as [CWE-127] Buffer Under-read.
Critical Impact
Network-reachable CSV parsing with allow_whitespace enabled can trigger out-of-bounds reads and writes before the heap buffer, leading to information disclosure or process disruption.
Affected Products
- Text::CSV_XS for Perl, all versions prior to 1.65
- Perl applications parsing untrusted CSV input with allow_whitespace enabled
- Downstream distributions bundling vulnerable Text::CSV_XS from CPAN
Discovery Timeline
- 2026-10-14 - Fix published in Text::CSV_XS1.65 by H.Merijn Brand
- 2026-10-16 - CVE-2026-110758 published to NVD
- 2026-10-20 - Last updated in NVD database
Technical Details for CVE-2026-110758
Vulnerability Analysis
The defect sits in the XS routine strip_trail_whitespace inside CSV_XS.xs. When allow_whitespace is set, the parser calls this routine on every unquoted field to trim trailing CH_SPACE and CH_TAB bytes. The loop decrements len and overwrites the byte at s[len] with a null terminator. The pre-patch loop does not guard against len reaching zero. For a field containing only whitespace, every byte is consumed, and the loop reads s[-1]. If that byte is also a space or tab, the loop zeroes it and continues further back into adjacent heap memory.
Leading whitespace is normally skipped before storage, so all-blank fields should not reach this code path. However, two conditions still deliver an all-blank field to strip_trail_whitespace: a leading escape_char that differs from quote_char, and a quoted field in getline whose line terminates in two carriage returns. Both are reachable with crafted input.
Root Cause
The loop condition tested only the trailing byte value and omitted a bounds check on len. The patched version adds len && as the first clause, ensuring the loop stops when it reaches the start of the field.
Attack Vector
An attacker supplies CSV input to any Perl service that parses with Text::CSV_XS and enables allow_whitespace. The payload must deliver an all-blank field either preceded by a distinct escape_char or as a quoted field ending in \r\r. The resulting out-of-bounds read can leak heap metadata, corrupt adjacent allocations, or crash the parsing process.
STRLEN len;
char *s = SvPV (sv, len);
unless (s && len) return;
- while (s[len - 1] == CH_SPACE || s[len - 1] == CH_TAB)
+ while (len && (s[len - 1] == CH_SPACE || s[len - 1] == CH_TAB))
s[--len] = (char)0;
SvCUR_set (sv, len);
} /* strip_trail_whitespace */
Source: GitHub Patch Commit
Detection Methods for CVE-2026-110758
Indicators of Compromise
- Perl processes crashing with SIGSEGV or glibc heap corruption messages while parsing CSV input
- CSV records containing all-whitespace fields preceded by an escape_char distinct from quote_char
- Quoted CSV fields whose lines terminate in two consecutive \r bytes reaching getline
- Inventory records showing Text::CSV_XS versions below 1.65 on production systems
Detection Strategies
- Inventory installed CPAN modules and flag Text::CSV_XS releases prior to 1.65 with cpan -l or perl -MText::CSV_XS -e 'print $Text::CSV_XS::VERSION'
- Review application code for calls that set allow_whitespace => 1 combined with user-controlled input
- Enable AddressSanitizer or Valgrind in staging to surface the under-read against representative payloads
Monitoring Recommendations
- Alert on repeated abnormal termination of Perl workers that process CSV uploads or feeds
- Capture process telemetry on CSV-handling services to correlate crashes with inbound payload characteristics
- Track CPAN module updates through configuration management to confirm patched versions reach every host
How to Mitigate CVE-2026-110758
Immediate Actions Required
- Upgrade Text::CSV_XS to version 1.65 or later from CPAN on all hosts running Perl CSV parsers
- Audit application configurations and disable allow_whitespace where it is not required
- Validate and reject CSV input containing isolated escape_char sequences or trailing \r\r terminators until patched
Patch Information
The fix is included in Text::CSV_XS1.65, released 2026-10-14. The commit adds a len bounds check to the strip_trail_whitespace loop. See the GitHub Patch Commit and the MetaCPAN Release Changes for release notes.
Workarounds
- Set allow_whitespace => 0 on Text::CSV_XS parser instances until the upgrade is deployed
- Pre-sanitize incoming CSV data to strip leading and trailing whitespace before handing it to the parser
- Isolate CSV ingestion workers in sandboxed processes with restart-on-crash supervisors to limit blast radius
# Upgrade Text::CSV_XS to the patched release
cpanm Text::CSV_XS@1.65
# Verify the installed version
perl -MText::CSV_XS -e 'print $Text::CSV_XS::VERSION, "\n"'
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

