Intel

AIKIDO-2026-527160

mail-parser is vulnerable to Regular Expression Denial of Service (ReDoS)

Regular Expression Denial of Service (ReDoS)GHSA-r7w7-vpq8-c5vv Published 3 days ago

75

High Risk

This Affects:

PYTHONmail-parser
4.2.0 - 4.6.0
Fixed in 4.6.1
Are you affected? Scan for Free

TL;DR

The library relies on two regular expressions in its email header parsing that exhibit polynomial backtracking on externally supplied input. An address-header fallback pattern degrades to quadratic or cubic time on padded display names or repeated angle brackets, and the Received header clause splitter backtracks quadratically over long whitespace runs. Because both patterns run through the standard parsing entry points, a single small but crafted email can consume large amounts of CPU and stall a mail-processing worker. The fix replaces the patterns with linear-time scanning and collapses whitespace runs before splitting.

Who does this affect?

You are affected if you run an affected version and parse untrusted or externally supplied email through the standard entry points (parse_from_string, parse_from_bytes, parse_from_file).

Background info

mail-parser is vulnerable to Regular Expression Denial of Service (ReDoS) in versions 4.2.0 - 4.6.0.

How to fix this

Upgrade the mail-parser library to the patch version.