HIGH · CVSS 3.1 7.5 EPSS 0.2% · 10th percentile CWE-20CWE-345

CVE-2026-129297: mail-parser: Sender IP address spoofing in get_server_ipaddress()

Published 2026-11-16 · Updated 2026-11-16 · Also known as GHSA-72px-j8gh-p79x

Summary

The mail-parser library contains a vulnerability in get_server_ipaddress() that allows attackers to spoof sender IP addresses by crafting malicious email headers. Developers relying on this function for security-critical decisions must upgrade to version 4.6.2 or implement alternative authentication mechanisms.

Who is affected

Affected deployments are those using mail-parser to extract and rely on sender IP information from email headers. The vulnerability allows an attacker to inject misleading IP data, potentially bypassing security filters or audit logs that trust the output of get_server_ipaddress(). Because the library previously accepted ambiguous header tokens, it could be tricked into returning attacker-controlled addresses instead of legitimate MTA-reported ones.

Exploitability

The vulnerability is rated as High severity with a base score of 7.5, reflecting that it can be exploited remotely over the network with low complexity and no user interaction. While the current EPSS score is low at 0.002, the flaw poses a significant risk for systems that treat the returned IP address as an authenticated signal. There is currently no record of active exploitation in CISA's Known Exploited Vulnerabilities catalog.

Remediation

How to check your project

Automated analysis of the published advisory data, generated 2026-11-18. Not human-reviewed; verify against the official advisory. How this works.

Affected packages

EcosystemPackageAffected versionsFixed inUpgrade
PyPI mail-parser >= 0, < 4.6.2 4.6.2 python -m pip install 'mail-parser>=4.6.2'

CVSS 3.1 vector

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N

Attack vectorNetwork
Attack complexityLow
Privileges requiredNone
User interactionNone
ScopeUnchanged
ConfidentialityNone
IntegrityHigh
AvailabilityNone

FAQ

Does this update introduce breaking changes?

Yes, get_server_ipaddress() will now return 'None' in scenarios where it previously returned unreliable data. Callers must update their logic to handle this return value correctly.

Is there a workaround if I cannot upgrade immediately?

No internal workaround exists. Callers should stop treating the return value of get_server_ipaddress() as trustworthy and instead derive sender attribution from authenticated signals like SPF, DKIM, or DMARC results obtained from the MTA.

What specifically causes the spoofing vulnerability?

The library failed to properly distinguish between sender-written addresses in headers and genuine MTA-supplied IP addresses, allowing an attacker to inject text that the library interpreted as a valid server IP.

Original advisory description
### Patches Fixed in **4.6.2**. Upgrade with `pip install --upgrade mail-parser`. Candidate addresses are now selected by position, not by appearance - a bracketed address the sender wrote is byte-identical to one the MTA wrote, so no amount of pattern matching can tell them apart: - the first token of the `from` clause is the HELO name, whatever its shape, and is never a candidate; - an explicit HELO marker inside a comment group is sender text and is excluded; - a candidate must sit inside a `(` / `[` group; - IPv4 and IPv6 matches are merged positionally, never family-first; - the walk stops at the first trusted hop naming no address, rather than continuing into sender-written headers. The IPv6 pattern was corrected to skip the `IPv6:` tag and to prefer the longest valid form. **Behaviour change.** `get_server_ipaddress()` now returns `None` rather than an unreliable value in two cases that previously returned an address: a `from` clause consisting of a bare address with no HELO marker (indistinguishable from `EHLO <that address>`), and a trusted hop naming no address at all. Callers must handle `None`. ### Workarounds None within mail-parser. Callers who cannot upgrade should not treat the return value of `get_server_ipaddress()` as trustworthy, and should derive sender attribution from an authenticated signal instead - the MTA's own logs, or SPF/DKIM/DMARC results computed outside this library.

References

Source records: GHSA-72px-j8gh-p79x (OSV.dev) · EPSS by FIRST, 2026-11-21.