---
id: "CVE-2026-121577"
kind: "vulnerability"
aliases: ["CVE-2026-121577"]
title: "whatstk: crafted WhatsApp chat export can hang the parser"
severity: "medium"
cvss: 6.7
epss: null
exploited: false
status: "open"
category: "package"
products: []
ecosystems: []
tags: ["package", "python", "whatsapp-parsing", "whatstk"]
not_affected_if: ["explicit-header-format", "no-untrusted-exports", "version-0.9.0-or-later"]
published_at: "2026-11-03T20:18:13+00:00"
first_seen_at: "2026-11-03T20:49:22+00:00"
updated_at: "2026-11-03T20:50:25+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-121577", "first_seen_at": "2026-11-03T20:49:22+00:00"}]
---

# whatstk: crafted WhatsApp chat export can hang the parser

whatstk is a Python library that parses WhatsApp chat exports. A crafted export with a regex metacharacter in its date separator makes the header regular expression catastrophically backtrack, so parsing consumes CPU without finishing, and some separators raise uncaught exceptions that can crash the calling program.

_Summary, check and fix written by a model from the sources; labelled as such._

## How to check

- Check the installed version with `pip show whatstk` or the `version` in your `pyproject.toml`/`requirements.txt`; affected range is `0.2.0` up to but not including `0.9.0`.
- Search your code for calls to whatstk's parser on user-supplied chat exports (for example `whatstk.whatsapp.parser`).

## Fix

- whatstk: `0.9.0`

## Timeline

- 2026-11-03T20:49:22+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-121577

## Documents

- [fix] Patch: github.com https://github.com/lucasrodes/whatstk/commit/01d66d8
- [fix] Release notes: github.com https://github.com/lucasrodes/whatstk/releases/tag/v0.9.0

## From the sources

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.

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
