Aug 26, 2026·6 min read·34 visits
A quadratic-time regex loop in the comment-stripping parser of eml_parser (< 3.0.2) allows unauthenticated remote attackers to cause complete CPU exhaustion and Denial of Service by sending an EML file with deeply nested parentheses.
Prior to version 3.0.2, GOVCERT-LU's eml_parser library is vulnerable to an algorithmic complexity Denial of Service (DoS) vulnerability via the comment-stripping routine noparenthesis() in routing.py. An unauthenticated attacker can submit a crafted EML file containing nested parenthesized comments to cause complete CPU saturation. This happens due to a quadratic time complexity bottleneck in regex replacement of nested structures.
The Python library eml_parser, developed by GOVCERT-LU, parses EML structures to extract elements like headers, attachments, and routing metadata. Downstream components like secure email gateways and malware sandboxes rely heavily on this package to inspect untrusted traffic. Because parsing takes place on incoming message flows, any latency in processing directly impacts the performance of SMTP pipelines.
Prior to version 3.0.2, the library's comment-stripping parser in eml_parser/routing.py is vulnerable to algorithmic complexity exploitation. The noparenthesis() routine removes parenthesized Comment Folding White Space (CFWS) from mail headers. An attacker can weaponize this function by transmitting a relatively small email payload containing pathological nesting depths of parentheses.
This behavior triggers complete CPU core saturation, resulting in a denial of service (DoS) for the processing system. The vulnerability is classified under CWE-770 (Allocation of Resources Without Limits or Throttling) and CWE-1124 (Excessively Deep Nesting). It can be executed remotely and without authentication, making it a high priority for organizations managing automated mail verification frameworks.
RFC 5322 specifications allow the incorporation of Comment Folding White Space (CFWS) inside standard email headers. These comments are bounded within parentheses and can be nested recursively. To ensure accurate downstream validation, processing components must strip out these comments before attempting to parse hostnames or IP addresses from the headers.
In vulnerable versions of eml_parser, the routine attempts to perform this extraction using an iterative regular expression loop. The configuration utilizes the regular expression pattern \([^()]*\) to identify parenthesized groups. This pattern matches only the innermost parenthesized block that contains no internal parentheses, then substitutes it with an empty string.
The algorithm executes inside a while True loop that runs until the processed string matches the prior state. When evaluating an input containing N nested layers of parentheses, the engine must perform N iterations to strip the entire block. Because each iteration must scan and allocate a modified string of size O(N), the overall complexity scales quadratically as O(N^2) relative to the nesting depth. Processing an input with 5,000 parentheses blocks the execution context for approximately 1.3 seconds, and doubling that depth quadruples the required execution duration.
The vulnerability resides inside the noparenthesis function within the eml_parser/routing.py module. Below is the vulnerable version of the parsing function which implements the iterative regular expression replacement loop:
# Vulnerable implementation in eml_parser/routing.py (< v3.0.2)
def noparenthesis(line: str) -> str:
if not line:
return line
line_ = line
while True:
lline = line_
# Iteratively matches and replaces the innermost nested parenthesis
line_ = eml_parser.regexes.noparenthesis_regex.sub('', line_)
if lline == line_:
break
return line_To resolve the quadratic execution scaling, the developers removed the iterative regular expression evaluation. They replaced it with a linear-time, stack-based tracking algorithm that reads characters sequentially inside a single loop:
# Patched implementation in eml_parser/routing.py (v3.0.2)
def noparenthesis(line: str) -> str:
# Initialize stack elements
fragments: list[list[str]] = [[]]
for ch in line:
if ch == '(':
# Start a new parenthesized block tracking scope
fragments.append([ch])
else:
# Append characters to the active innermost scope
fragments[-1].append(ch)
if ch == ')' and len(fragments) > 1:
# Discard matching parenthesis group scope
fragments.pop()
return ''.join(ch for w in fragments for ch in w)The upgraded stack-based parser resolves the algorithmic vulnerability by ensuring that each character is inspected exactly once. This shifts the runtime performance metrics from quadratic time O(N^2) to strict linear time O(N), preventing malicious payloads from locking worker processes.
An attack requires no special credentials or active session management. The vector relies entirely on submitting a crafted email payload to an address parsed by the vulnerable target application. The payload is delivered via standard SMTP channels or loaded directly from local directories depending on the target implementation.
The attacker crafts a custom EML file with an affected header, such as Received:, populated with thousands of open parentheses followed by an equivalent count of matching close parentheses. When the vulnerable library attempts to analyze the file structure, the thread running the parser becomes locked inside the re.sub convergence loop, driving CPU usage to maximum limits.
This behavior blocks the executing worker, preventing it from addressing other queued messages. If the host platform runs a synchronous queue or a pool with limited parallel processors, a continuous flow of such payloads can exhaust all available processing power, creating a complete application block.
Beyond the algorithmic correction in the comment-stripping routine, the release of version 3.0.2 incorporated additional security and robustness improvements. One such mechanism addresses recursive stack exhaustion. When parsing specific mail list properties like Cc or To fields, the standard email module can trigger a RecursionError if it processes highly deep or malformed nested lists.
To prevent worker crashes from this error class, the maintainers modified eml_parser/parser.py to capture RecursionError and implement a flat regex extraction fallback. This change ensures that the parsing pipeline continues functioning even when handling pathological input variations that would otherwise terminate the application runtime.
Furthermore, the patch resolves security validation bypasses related to obfuscated links. The parser now applies HTML entity unescaping to URLs to uncover masked targets. This adjustment prevents attackers from dodging blacklist detection filters by hiding malicious domains behind encoded syntax.
The primary remedy for this vulnerability is upgrading the eml_parser dependency to version 3.0.2 or higher. This update replaces the quadratic regular expression parser and adds the exception handling fallback components.
For systems where immediate patching is not possible, operators should configure strict line limits on their Mail Transfer Agents (MTAs). Limiting lines to the standard RFC 5322 limit of 998 characters restricts the maximum nesting potential, neutralizing the threat. Additionally, application wrappers should deploy strict timeouts on parser processes to terminate tasks exceeding acceptable limits.
Security teams can deploy signature-based detection rules on incoming mail flows to monitor for exploitation attempts. Monitoring tools can look for consecutive open parentheses inside header strings. Identifying these patterns allows organizations to drop malicious payloads before they are delivered to the parsing engines.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H| Product | Affected Versions | Fixed Version |
|---|---|---|
eml_parser GOVCERT-LU | < 3.0.2 | 3.0.2 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-770 |
| Attack Vector | Network |
| CVSS | 7.5 (High) |
| EPSS | N/A |
| Impact | Denial of Service (CPU Exhaustion) |
| Exploit Status | PoC Available |
| KEV Status | Not Listed |
The software allocates memory, CPU, or other resources without limiting the maximum size or quantity, leading to potential exhaustion.
CVE-2026-55622 (GHSA-qx75-2p3r-pwm5) is an improper access control vulnerability (CWE-284) in Canonical LXD and LXC Incus (tracked as GHSA-c9f5-j9c3-mhrg). In multi-tenant deployments utilizing project-based isolation, the REST API handler for instance creation via POST /1.0/instances verifies that the authenticated user has authorization in the destination project specified by the query parameter, but fails to verify whether the user holds read or view permissions for the source instance when executing a copy operation across projects. Consequently, an authenticated client restricted to a single project can clone instances or snapshots from unauthorized projects into their own project, resulting in complete disclosure of the target instance filesystem and embedded credentials.
An authorization bypass vulnerability in Canonical LXD (tracked as GHSA-7mr3-28h5-m5vx and CVE-2026-55621, and as GHSA-64f3-v33m-w89f in Linux Containers Incus) allows an authenticated user with restricted project access to copy custom storage volumes and volume snapshots from unauthorized projects. The flaw resides in the storagePoolVolumesPost REST API handler, which verifies permissions on the destination project but fails to check whether the caller holds view entitlements on the source project or volume specified in the request body.
A missing authorization and configuration validation vulnerability in Canonical LXD and LXC Incus allows authenticated users within restricted projects to bypass project security boundaries. By smuggling prohibited low-level configuration directives (such as raw.lxc or raw.qemu) inside instance snapshots or backup archives, an attacker can restore these configurations within a restricted project and execute arbitrary commands with root privileges on the underlying host operating system.
A symbolic link traversal vulnerability (CWE-59) in Canonical LXD and Linux Containers Incus allows an authenticated user with image import permissions to read and write arbitrary files on the host filesystem. During image archive unpacking, the daemon fails to reject top-level symbolic links for the instance `templates` directory. Subsequent requests to the instance template API endpoints follow this symbolic link outside the instance storage directory with root privileges, enabling complete host compromise.
CVE-2026-12411 is a broken access control vulnerability in the DevLXD interface of Canonical LXD versions 6.6 through 6.8. The flaw resides in the devLXDInstancePatchHandler component, which fails to verify storage volume ownership when an instance attaches a new disk device via the /dev/lxd guest socket. When the security.devlxd.management.volumes configuration option is enabled, an untrusted guest or DevLXD identity can issue a crafted HTTP PATCH request referencing another tenant's custom storage volume. The LXD host daemon subsequently mounts the target volume into the requesting guest, permitting unauthorized cross-tenant read and write operations.
CVE-2026-105769 (GHSA-5q7h-w9jf-cx97, GO-2026-6225) is an origin validation error and credential exfiltration vulnerability affecting Kaniko prior to version 1.25.20. The flaw stems from an unanchored regular expression in the integrated Azure Container Registry (ACR) credential helper (github.com/chrismellard/docker-credential-acr-env). When Kaniko processes a Dockerfile containing an image reference hosted on a lookalike domain containing an ACR suffix as a substring (e.g., x.azurecr.io.attacker.com), the credential helper acquires a Microsoft Entra ID access token for Azure Resource Manager and transmits it via HTTP POST to the attacker-controlled host.