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-61816

CVE-2026-61816: Uncontrolled Resource Consumption and Algorithmic Complexity in zbateson/mail-mime-parser

Alon Barad
Alon Barad
Software Engineer

Sep 25, 2026·6 min read·6 visits

Executive Summary (TL;DR)

A denial of service vulnerability in zbateson/mail-mime-parser allows unauthenticated remote attackers to trigger severe CPU exhaustion or out-of-memory crashes by submitting malformed emails under 2 MB containing deeply nested boundaries, large header lists, or dense sibling attachments.

The PHP email processing library zbateson/mail-mime-parser is vulnerable to multiple algorithmic complexity exploits. By submitting small, highly structured email payloads, remote, unauthenticated attackers can trigger high CPU utilization or out-of-memory states, causing an application-wide denial of service.

Vulnerability Overview

The library zbateson/mail-mime-parser serves as a PHP-based alternative to native IMAP functions and Pear libraries for decoding RFC 822 and MIME compliant email structures. It is commonly implemented in webmail applications, customer support ticketing desks, and mail gateway APIs to process inbound email traffic. Because these systems ingest untrusted payloads directly from the public internet, any processing inefficiencies in the parser represent a significant remote attack vector.

Three independent execution pathways within the parser exhibit super-linear time complexity or unbound memory usage patterns. This vulnerability class, categorized under CWE-400 (Uncontrolled Resource Consumption), allows attackers to systematically bypass physical size constraints (such as a 2 MB or 10 MB maximum request limit) by optimizing payload complexity rather than file volume. An input document of negligible physical size can force host systems to stall processing threads indefinitely or exhaust the available RAM allocation.

The parsing operations in mail-mime-parser are designed to execute lazily. However, the costly super-linear evaluation is forced on the target host as soon as the calling application performs its first full-text read or executes the getAllParts() API. Consequently, passive application-level checks are incapable of stopping the exhaustion cycle once a message is loaded into memory.

Root Cause Analysis

The underlying vulnerability stems from three distinct structural mechanics within the parser's logic. These mechanics fail to constrain execution iteration or structure allocation limits, enabling predictable and repeatable algorithmic failure states.

Vector 1: Quadratic Multipart Nesting Depth

During multipart boundary discovery, the parser evaluates each read line against the boundary of the active part and its parent structures. When processing a MIME document with nesting depth $D$, the parser traverses up the proxy hierarchy to verify if a line signifies the end of a parent structure. Under deep recursion, this parent traversal executes dynamically via helper functions. If the message contains $D$ nested multipart objects, evaluating the boundary termination for each line triggers $O(D^2)$ boundary comparisons, translating directly to excessive CPU cycles for relatively low-byte inputs.

Vector 2: Quadratic Sibling MIME Part Appending

When a multipart MIME container processes a sequence of sibling attachments, each node is sequentially registered into the internal tree configuration using PartChildrenContainer::add. The unpatched method used PHP's native \array_splice function to insert elements into the container structure. Because \array_splice causes PHP to rebuild and re-index the internal array from scratch, inserting $N$ sibling parts sequentially results in $O(N^2)$ memory and processor operations. This forces high-frequency array shift operations that lock up the execution thread.

Vector 3: Unbounded Header Buffering

The class HeaderParserService::parse() reads RFC 822 header groups using an unconstrained loop that terminates only when encountering an empty line. Each header line is decoded and mapped to individual PHP objects. Because the parser does not limit either the total count of headers or the aggregate size of the header block, a payload containing tens of thousands of mock headers can easily overwhelm memory boundaries. Due to internal object management structures in PHP, a small array of thousands of small headers can expand exponentially in RAM usage, leading to a kernel Out-Of-Memory (OOM) termination of the parent PHP-FPM pool or worker process.

Code Analysis and Comparison

The mitigation and patch history illustrates how minor architectural details in PHP array and loop implementations can trigger catastrophic resource exhaustion.

Sibling Insertion Refactoring

In the vulnerable version of PartChildrenContainer.php, elements were appended by passing a computed default index directly into \array_splice:

// Vulnerable Implementation
public function add(IMessagePart $part, ?int $position = null) : static
{
    $index = $position ?? \count($this->children);
    \array_splice(
        $this->children,
        $index,
        0,
        [$part]
    );
    return $this;
}

The patch addresses this structural vulnerability by introducing a fast-path bypass. When the position is unspecified or evaluates to the end of the array, the element is appended directly using PHP's native bracket syntax, which executes in $O(1)$ amortized complexity instead of rebuilding the array via \array_splice:

// Patched Implementation in v3.0.6 & v4.0.2
public function add(IMessagePart $part, ?int $position = null) : static
{
    if ($position === null || $position >= \count($this->children)) {
        $this->children[] = $part;
    } else {
        \array_splice(
            $this->children,
            $position,
            0,
            [$part]
        );
    }
    return $this;
}

Header Limitation Mechanisms

The class HeaderParserService.php was altered to enforce maximum thresholds, preventing unbounded memory growth. The patched parser tracks both the total processed headers and the size offset dynamically via \ftell:

// Patched Header Parsing Loop with Limits
if ($count >= $this->maxHeaderCount || \ftell($handle) - $start >= $this->maxHeaderSizeBytes) {
    $container->addError(
        'Header count or total size limit reached while parsing headers',
        LogLevel::ERROR
    );
    break;
}

Exploitation Methodology

Exploiting this vulnerability does not require complex memory corruption techniques or bypasses of standard exploit mitigations (such as ASLR or DEP). Instead, the attacker sends a syntactically valid email structured to maximize the algorithmic load on the backend server.

An attacker can craft a payload leveraging Vector A, which nests 300+ multipart groups inside one another. The outer structures are progressively left open, requiring the parser to traverse the entire parent chain recursively for every single character read. A proof-of-concept file payload demonstrating this behavior can be smaller than 200 KB yet require up to 30 seconds of high-priority CPU time on modern infrastructure.

Alternatively, an attacker can target Vector C by supplying thousands of mock headers (e.g., X-Header-1: A\r\n, X-Header-2: B\r\n, etc.). Because PHP applications generally share worker pools (like PHP-FPM or Apache mod_php), exhausting all available processes or triggering OOM failures on the pool quickly leads to an application-wide HTTP 502/504 Bad Gateway or Service Unavailable state.

Mitigation and Fix Completeness Review

To remediate these issues, the vendor introduced configuration properties in di_config.php to define and enforce threshold caps. By default, the parser now restricts the maximum MIME part nesting depth to 256, the maximum header count to 1000, and the maximum cumulative header size to 1,048,576 bytes.

While these limits successfully disrupt the exploit vectors, a minor residual risk remains. If an attacker passes a single, continuous header line of several megabytes, the loop validation in HeaderParserService::parse is not triggered until after the entire line has been read and loaded into a single string buffer. If the system memory configuration is low, a single massive string operation could still trigger an unexpected OOM crash before the boundary verification is reached.

Fix Analysis (2)

Technical Appendix

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

Affected Systems

zbateson/mail-mime-parser (PHP Package)

Affected Versions Detail

Product
Affected Versions
Fixed Version
mail-mime-parser
zbateson
>= 2.0.0, < 3.0.63.0.6
mail-mime-parser
zbateson
>= 4.0.0, < 4.0.24.0.2
AttributeDetail
CWE IDCWE-400
Attack VectorNetwork (AV:N)
CVSS Score7.5 (High)
ImpactDenial of Service (DoS)
Exploit StatusProof of Concept (PoC)
KEV StatusNot Listed

MITRE ATT&CK Mapping

T1499Endpoint Denial of Service
Impact
CWE-400
Uncontrolled Resource Consumption

The software does not properly control the allocation and maintenance of a limited resource, enabling an actor to influence the amount of resources consumed and trigger a Denial of Service.

References & Sources

  • [1]GHSA-f6v3-2qmr-vfjx: Uncontrolled resource consumption / algorithmic complexity DoS
  • [2]CVE.org CVE-2026-61816 Vulnerability Record
  • [3]NVD - CVE-2026-61816 Analysis Dashboard
  • [4]Primary Configuration Limits and Depth Check Commit
  • [5]Sibling Append Splice Optimization Commit
  • [6]Release 3.0.7 GitHub Tag
  • [7]Release 4.0.2 GitHub Tag

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 1 hour ago•CVE-2026-57231
7.5

CVE-2026-57231: Podman Malformed Image Host Environment Variable Leak

CVE-2026-57231 is a high-severity vulnerability in the Podman container engine. When executing a container from a crafted OCI or Docker image, malformed environment variable entries lacking an equals separator can trigger an unexpected behavior in the spec generation parser. This vulnerability enables a container image to silently exfiltrate host environment variables into the running container workspace, exposing high-privilege credentials and sensitive runtime secrets.

Amit Schendel
Amit Schendel
4 views•8 min read
•about 1 hour ago•CVE-2026-74480
9.8

CVE-2026-74480: Use-After-Free in Linux Kernel Network Bridge Multicast Routing

CVE-2026-74480 is a critical memory safety vulnerability in the Linux kernel's network bridge multicast routing subsystem (net: bridge) resulting from a Use-After-Free (UAF) condition during fast-leave processing of IGMP/MLD multicast groups.

Amit Schendel
Amit Schendel
3 views•6 min read
•about 1 hour ago•CVE-2026-21992
9.8

Oracle Fusion Middleware Security Alert Advisory - CVE-2026-21992

CVE-2026-21992 is a critical, unauthenticated remote code execution (RCE) vulnerability affecting the REST WebServices component of Oracle Identity Manager (OIM) and the Web Services Security component of Oracle Web Services Manager (OWSM). Exploitation occurs over standard network protocols without user interaction, enabling a complete compromise of target system infrastructure.

Alon Barad
Alon Barad
2 views•6 min read
•about 2 hours ago•CVE-2026-61782
7.5

CVE-2026-61782: Sensitive Information Disclosure and Source Code Exfiltration via Insecure HTTP Server Defaults in @rsdoctor/rspack-plugin

An insecure configuration in the diagnostic HTTP server of @rsdoctor/rspack-plugin allowed unauthenticated remote attackers or malicious local websites to retrieve serialized build metadata and full source code modules.

Alon Barad
Alon Barad
4 views•7 min read
•about 3 hours ago•CVE-2026-59980
6.3

CVE-2026-59980: Uncontrolled Resource Consumption in python-hyper/hpack

CVE-2026-59980 is a CPU exhaustion vulnerability in python-hyper/hpack, where an unauthenticated remote attacker can trigger an infinite loop or high computational complexity overhead by sending a crafted HTTP/2 stream containing excessive variable-length integer continuation octets.

Amit Schendel
Amit Schendel
6 views•8 min read
•about 5 hours ago•CVE-2026-61815
7.2

CVE-2026-61815: Remote SMTP Header Injection via Unsanitized MIME Decoded Filenames in zbateson/mail-mime-parser

CVE-2026-61815 is a high-severity Carriage Return / Line Feed (CRLF) header injection vulnerability in the zbateson/mail-mime-parser library. Due to incomplete sanitization logic, encoded newline sequences within filenames and headers survive parsing and translate into literal CRLF control bytes. When applications process or forward these payloads, the library writes the unescaped control bytes directly into outbound SMTP metadata, allowing remote attackers to inject rogue headers or compromise message integrity.

Alon Barad
Alon Barad
5 views•6 min read