---
id: "CVE-2026-129297"
page: "https://infrastack.ai/live/CVE-2026-129297"
kind: "vulnerability"
aliases: ["CVE-2026-129297", "GHSA-72px-j8gh-p79x"]
title: "mail-parser: Sender IP address spoofing in get_server_ipaddress()"
severity: "high"
cvss: 7.5
epss: null
exploited: false
status: "open"
category: "package"
products: [{"name": "mail-parser", "fixed": ["4.6.2"], "affected": "<= 4.6.1", "ecosystem": "pypi"}]
ecosystems: ["pypi"]
tags: ["cwe-20", "cwe-345", "email-processing", "mail-parser", "package", "python"]
not_affected_if: ["no-ip-based-decisions", "uses-only-headers-or-body", "version-4.6.2-or-later"]
published_at: "2026-11-16T18:17:30+00:00"
first_seen_at: "2026-11-16T18:38:03+00:00"
updated_at: "2026-11-16T22:13:27+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-129297", "first_seen_at": "2026-11-16T18:38:03+00:00"}, {"source": "ghsa", "url": "https://github.com/advisories/GHSA-72px-j8gh-p79x", "first_seen_at": "2026-11-16T22:12:15+00:00"}]
exploit_sources: []
---

# mail-parser: Sender IP address spoofing in get_server_ipaddress()

Link for people: https://infrastack.ai/live/CVE-2026-129297 (this .md is for agents)

mail-parser's get_server_ipaddress() could return an IP address written by the email sender instead of the mail server that actually received the message. An attacker can therefore make a message appear to come from an address of their choosing.

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

## Affected

- pypi:mail-parser affected <= 4.6.1 fixed 4.6.2

## How to check

- Run `pip show mail-parser` and check whether the version is `4.6.1` or lower.
- Search your code for calls to `get_server_ipaddress()` that use its return value for allow lists, rate limits, spam scoring or audit logs.

## Fix

- `mail-parser` upgrade to `4.6.2` (fixed version per the product data).
- Note: after upgrading, `get_server_ipaddress()` can return `None`; callers must handle `None`.

## Timeline

- 2026-11-16T18:38:03+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-129297
- 2026-11-16T22:12:15+00:00 ghsa https://github.com/advisories/GHSA-72px-j8gh-p79x

## Documents

- [advisory] Vendor advisory: github.com https://github.com/SpamScope/mail-parser/security/advisories/GHSA-72px-j8gh-p79x
- [advisory] Maintainer's advisory: api.github.com https://api.github.com/repos/SpamScope/mail-parser/security-advisories/GHSA-72px-j8gh-p79x
- [fix] Patch: github.com https://github.com/SpamScope/mail-parser/commit/ce3cf3559db1ff806bda598b378de9f8c2a5be96
- [fix] Release notes: github.com https://github.com/SpamScope/mail-parser/releases/tag/4.6.2
- [fix] Patch: github.com https://github.com/SpamScope/mail-parser/pull/167

## From the sources

### 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.

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
