mail-parser: Sender IP address spoofing in get_server_ipaddress()
Vulnerability Details
Candidate addresses are now selected by position, not by appearance. A bracketed address written by the sender is byte-identical to one written by the MTA, meaning pattern matching alone cannot distinguish between them:
- The first token of the
fromclause is the HELO name, regardless of its shape, and is never treated as a candidate. - An explicit HELO marker inside a comment group is considered sender text and is excluded.
- A candidate must sit inside a
(/[group. - IPv4 and IPv6 matches are merged positionally, never family-first.
- The traversal 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 Changes
get_server_ipaddress() now returns None rather than an unreliable value in two cases that previously returned an address:
- A
fromclause consisting of a bare address with no HELO marker (indistinguishable fromEHLO <that address>). - A trusted hop naming no address at all.
Callers must handle None.
Workarounds
There are no workarounds available within mail-parser. Callers who cannot upgrade should not treat the return value of get_server_ipaddress() as trustworthy, and should instead derive sender attribution from an authenticated signal, such as the MTA's own logs or SPF/DKIM/DMARC results evaluated outside of this library.
What to do
Fixed in 4.6.2. Upgrade with pip install --upgrade mail-parser. If unable to upgrade, avoid relying on get_server_ipaddress() and obtain sender attribution from external authenticated sources.
Affected software
Click a technology to see all vulnerabilities affecting it.
| Platform | Package | Vulnerable versions | Fixed in |
|---|---|---|---|
| Python (PyPI) | mail-parser | < 4.6.2 | 4.6.2 |
References
- https://github.com/SpamScope/mail-parser/security/advisories/GHSA-72px-j8gh-p79x
- https://nvd.nist.gov/vuln/detail/CVE-2026-129297
- https://github.com/SpamScope/mail-parser/pull/167
- https://github.com/SpamScope/mail-parser/commit/ce3cf3559db1ff806bda598b378de9f8c2a5be96
- https://github.com/SpamScope/mail-parser
- https://github.com/SpamScope/mail-parser/releases/tag/4.6.2
- CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N- Weakness (CWE)
CWE-20, CWE-345- Platform
- Python (PyPI)
- Package
mail-parser- Disclosed
- 16.11.2026
- Updated
- 17.11.2026 10:00
Sources and licenses · Edited or translated by DockRay; source rights and applicable licenses are retained.
OSV / GitHub Advisory Database - GHSA-72px-j8gh-p79x - CC BY 4.0
Vulnerability history: mail-parser
All published vulnerabilities of this package (Python (PyPI)), newest first. Shows whether this is a one-off slip or a package that needs watching.
- Total entries
- 6
- First → latest
- 11.2026 11.2026
- Without a fix
- 0
- Exploited in attacks
- 0
Severity breakdown
- High 2
- Medium 4
Disclosures per year
- 2026: 6
-
mail-parser: Sender IP address spoofing in get_server_ipaddress() this entry
Know which vulnerabilities affect your application
With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.