CVE-2026-121577

Unescaped header separators in whatstk build a regular expression that backtracks exponentially

Published Nov 3, 2026 CVSS 4.0 · 6.7 Medium EPSS < 1% KEV · Not listed
Description
Inefficient Regular Expression Complexity (CWE-1333) in generate_regex() (whatstk/whatsapp/parser.py) in whatstk from 0.2.0 before 0.9.0 allows a party that supplies a chat export to consume the CPU of the process that parses it for an unbounded time, because the function builds the header regular expression by replacing each %x code with its named capture group and leaves every other character of the header format in the pattern unescaped. A header whose date separator is a regular expression metacharacter therefore alters the pattern instead of matching itself: a separator of + quantifies the preceding capture group, giving (?P<day>\d{1,2})+(?P<month>\d{1,2})+(?P<year>\d{2,4}), and a run of digits that cannot complete the header then makes the engine try every way of partitioning that run. Header auto detection is enabled by default and derives the format from the text of the file, so the separator is taken from the export itself and no header format has to be passed by the caller. Separators of (, ) and \ instead raise re.PatternError, separators of *, | and ? raise TypeError, and separators of ^ and $ raise KeyError, none of which the library catches. This results in the parse of a file of a few hundred bytes consuming CPU without completing, or in an uncaught exception in the calling program.

Analysis

AI-generated

Technical impact

The vulnerability resides in the generate_regex() function of whatstk, where each %x code is expanded into a named capture group while other header characters remain unescaped. A header that contains regex metacharacters such as +, *, |, or ?, or even special separators like ^ and $, can inadvertently modify the regular expression’s structure. This causes the regex engine to perform an exponential backtrack or produce errors that are not caught by the library. As a result, parsing a typical chat export file can consume an unbounded amount of CPU resources or throw uncaught exceptions, leading to denial of service within the application. The weakness is classified as CWE‑1333.

Affected Systems

The issue affects the whatstk tool produced by lucasrodes, specifically versions 0.2.0 through 0.8.x. The recommended fix is to upgrade to version 0.9.0 or later, where the header regex construction has been corrected to properly escape separators.

Risk and Exploitability

The CVSS score of 6.7 indicates moderate severity. The EPSS score is not reported, and the vulnerability is not listed in the CISA KEV catalog. An attacker can trigger the exploitation by supplying a crafted chat export file that includes a header with unescaped metacharacters. The tool’s default header auto‑detection will use the separator directly from the file, meaning an attacker can repeatedly load such a file to exhaust the CPU of the component performing the parse. Because the vulnerability manifests as a resource depletion rather than privilege escalation or information disclosure, the impact is limited to availability and potential performance degradation of systems that rely on whatstk for processing WhatsApp chat exports.

Remediation

Vendor Solution

Upgrade to whatstk 0.9.0 or later.


OpenCVE Recommended Actions

  • Upgrade whatstk to version 0.9.0 or later as provided by the vendor
  • Disable header auto‑detection or supply a sanitized header format that does not use regex metacharacters
  • Apply a resource limit or timeout to the parser to prevent excessive CPU usage during parsing

Generated by OpenCVE AI on November 4, 2026 at 00:16 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
Description Inefficient Regular Expression Complexity (CWE-1333) in generate_regex() (whatstk/whatsapp/parser.py) in whatstk from 0.2.0 before 0.9.0 allows a party that supplies a chat export to consume the CPU of the process that parses it for an unbounded time, because the function builds the header regular expression by replacing each %x code with its named capture group and leaves every other character of the header format in the pattern unescaped. A header whose date separator is a regular expression metacharacter therefore alters the pattern instead of matching itself: a separator of + quantifies the preceding capture group, giving (?P<day>\d{1,2})+(?P<month>\d{1,2})+(?P<year>\d{2,4}), and a run of digits that cannot complete the header then makes the engine try every way of partitioning that run. Header auto detection is enabled by default and derives the format from the text of the file, so the separator is taken from the export itself and no header format has to be passed by the caller. Separators of (, ) and \ instead raise re.PatternError, separators of *, | and ? raise TypeError, and separators of ^ and $ raise KeyError, none of which the library catches. This results in the parse of a file of a few hundred bytes consuming CPU without completing, or in an uncaught exception in the calling program.
Title Unescaped header separators in whatstk build a regular expression that backtracks exponentially
First Time appeared Lucasrodes
Lucasrodes whatstk
Weaknesses CWE-1333
CPEs cpe:2.3:a:lucasrodes:whatstk:*:*:*:*:*:python:*:*
Vendors & Products Lucasrodes
Lucasrodes whatstk
References
Metrics cvssV4_0

{'score': 6.7, 'vector': 'CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N'}

Weaknesses
  • CWE-1333

    Inefficient Regular Expression Complexity

Sources

Status
PUBLISHED
Assigner
Secur0
Published
Updated
Nov 6, 2026, 7:49 PM
Reserved
Nov 3, 2026, 3:29 PM
Status
Deferred
Published
Nov 3, 2026, 8:18 PM
Modified
Nov 12, 2026, 10:11 PM