CVE-2026-18503
Python Interpreter vulnerability analysis and mitigation

Overview

CVE-2026-18503 is a denial-of-service vulnerability in CPython's csv.Sniffer.sniff() function caused by super-linear (quadratic) regular expression backtracking during CSV dialect detection. When applications pass unbounded, attacker-controlled CSV input to csv.Sniffer.sniff(), the internal _guess_quote_and_delimiter() method's lazy regex matching can consume significant CPU — benchmarks showed processing times exceeding 20 seconds on ~1 MB samples and minutes on single-column quoted data. It affects CPython versions prior to 3.10.21, 3.11.16, 3.12.14, 3.13.15, 3.14.7, and 3.15.0rc1, and was published on August 10, 2026. The CVSS v4.0 base score is 2.4 (Low), assigned by the Python Software Foundation (GitHub Advisory, CPython Issue).

Technical details

The root cause is classified as CWE-1176 (Inefficient CPU Computation). The _guess_quote_and_delimiter() method in Lib/csv.py used lazy quantifiers (.*?) in regular expressions to match the body of quoted CSV fields. Because a lazy match scans to the end of the sample and retries from every position when a closing quote is not followed by a delimiter, the regex engine exhibits quadratic time complexity relative to input size. The fix replaces the lazy quantifier with a possessive match ((?:(?P=quote){2}|(?!(?P=quote)).)*+) so the body ends at the first non-doubled quote, matching the actual CSV reader's behavior and reducing complexity to linear. Exploitation requires an attacker to supply a crafted CSV sample — such as a large single-column file of quoted fields — to an application that passes unbounded input to csv.Sniffer.sniff() (CPython PR #153694, CPython Commit 476fb09).

Impact

Successful exploitation causes excessive CPU consumption on the affected Python process, leading to service degradation or effective denial of service for applications that process user-supplied CSV data via csv.Sniffer.sniff(). There is no confidentiality or integrity impact — only availability is affected, and only at the vulnerable component level. The impact is limited to the specific process handling the malicious input; lateral movement or data exfiltration are not applicable to this vulnerability (GitHub Advisory).

Exploitability

There is no public proof-of-concept exploit and no evidence of in-the-wild exploitation as of the disclosure date (GitHub Advisory). The vulnerability is not listed in the CISA Known Exploited Vulnerabilities catalog, and the NVD SSVC assessment rates exploitation as "none." The EPSS score is approximately 0.00114, indicating a very low probability of exploitation in the near term. Exploitation is not automatable per the CVSS v4.0 assessment, as it requires user interaction (passive) and local access or the ability to supply input to an application that calls csv.Sniffer.sniff() without input size limits.

Exploitation steps

  1. Identify a target application: Find a Python application (running a vulnerable CPython version < 3.10.21, 3.11.16, 3.12.14, 3.13.15, 3.14.7, or 3.15.0rc1) that accepts user-supplied CSV data and passes it without size restrictions to csv.Sniffer.sniff().
  2. Craft a malicious CSV payload: Construct a large CSV sample consisting of a single column of quoted fields, e.g., a file with tens of thousands of lines in the format "abcdefghijklmnopqrstuvwxyz"\n repeated. A ~1 MB sample is sufficient to cause >20 seconds of CPU consumption.
  3. Submit the payload: Deliver the crafted CSV to the target application via any available input channel (file upload, API endpoint, form submission, etc.).
  4. Trigger quadratic regex backtracking: The application calls csv.Sniffer.sniff(data) on the unbounded input; the lazy regex in _guess_quote_and_delimiter() backtracks quadratically, consuming CPU for an extended period.
  5. Achieve denial of service: The Python process becomes CPU-bound, degrading or blocking service for other users until the operation times out or the process is killed (CPython Issue, CPython PR #153694).

Indicators of compromise

  • Process: Python process with sustained near-100% CPU utilization for an extended period (tens of seconds to minutes) without completing a response.
  • Logs: Application logs showing unusually long processing times or timeouts for CSV-related operations; errors such as _csv.Error: Could not determine delimiter after extended delays.
  • Network: Repeated large CSV file uploads or API requests containing single-column quoted CSV data, particularly from the same source IP.
  • File System: Presence of large CSV files (>100 KB) consisting entirely of quoted single-column rows in application upload or temp directories.

Mitigation and workarounds

Upgrade CPython to one of the patched versions: 3.10.21, 3.11.16, 3.12.14, 3.13.15, 3.14.7, or 3.15.0rc1. Backport commits are available for each maintenance branch (e.g., commit 063d455 for 3.12, 476fb09 for 3.15, 89f29c7 for 3.14) (CPython Commit 063d455). As a workaround prior to patching, enforce strict input size limits on CSV data before passing it to csv.Sniffer.sniff() (e.g., limit samples to a few kilobytes), implement request timeouts, and monitor CPU usage to detect and throttle abusive requests (GitHub Advisory).

Community reactions

The Python Software Foundation (PSF) disclosed the vulnerability via the security-announce@python.org mailing list and published a GitHub Security Advisory. The fix was developed by CPython core developer Serhiy Storchaka, who noted the underlying issue had been tracked since at least October 2022 (issue #98820) and that the old regex was quadratic on quoted data. The broader community response has been low-key given the low CVSS score and limited exploitability, with no notable threat actor activity or significant media coverage observed (Python Security Announce, CPython PR #153694).

Additional resources


SourceThis report was generated using AI

Related Python Interpreter vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-67422HIGH7.5
  • Python logoPython
  • python3.6
NoYesAug 06, 2026
CVE-2026-19672MEDIUM6.3
  • Python Interpreter logoPython Interpreter
  • python2.7
NoYesAug 19, 2026
CVE-2026-15806MEDIUM6
  • Python Interpreter logoPython Interpreter
  • python3.13
NoYesAug 18, 2026
CVE-2026-17084MEDIUM6
  • Python Interpreter logoPython Interpreter
  • pypy3
NoYesAug 18, 2026
CVE-2026-18503LOW2.4
  • Python Interpreter logoPython Interpreter
  • python3-pygments
NoYesAug 10, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management