Aug 25, 2026·8 min read·76 visits
An exponential time complexity issue in icalendar's comparison logic allows unauthenticated remote attackers to cause Denial of Service by submitting deeply nested, lightweight calendar payloads.
An algorithmic complexity denial of service vulnerability exists in the Python icalendar library's component equality evaluation. Due to recursive nested comparisons inside list membership operations, parsing and validating calendar components with deep nesting triggers exponential execution time, blocking application threads and consuming 100% of the available CPU core.
The Python icalendar library is an RFC 5545 compatible parsing engine widely utilized in calendar servers, email clients, scheduling interfaces, and enterprise CRM solutions. It handles the parsing, generation, and synchronization of data, meaning its endpoints are frequently exposed to untrusted external calendar feeds. The primary attack surface resides in endpoints that parse, sync, or normalize these user-provided calendar records.
When a service processes calendar records, it often performs comparisons to execute deduplication, updating, or data reconciliation. In Python, these comparison operations trigger the Component.__eq__ magic method behind the scenes to verify if the parsed calendar items match. Prior to version 7.1.3, this equality comparison method contained a serious structural vulnerability when processing nested components.
The vulnerability is classified as an Algorithmic Complexity Denial of Service, mapped to CWE-407 and CWE-400. Because the library allowed arbitrarily nested calendar subcomponents without verifying or enforcing depth restrictions, verifying equality between deeply nested data structures causes computation time to grow exponentially. This enables a remote, unauthenticated attacker to exhaust server CPU cycles using highly optimized, lightweight payloads.
The vulnerability is rooted in the way the Component.__eq__ method evaluated multiset equivalence among subcomponents. Calendar elements are inherently unordered, unhashable, and cannot be sorted via standard keys. To determine whether two subcomponent arrays are equivalent, the implementation evaluated element presence by executing sequential membership tests using the Python in and not in operators.
Under standard Python semantics, evaluating list containment via not in requires iterating through the target list and checking equality on each item. Because child elements within the calendar may contain their own nested subcomponents, checking membership invokes the __eq__ method recursively down the subcomponent hierarchy. This design introduces nested loops where verifying a parent node triggers a branching cascade of recursive child comparisons.
For a calendar structure with nesting depth $d$ containing equal subcomponents, the execution pattern follows an exponential recurrence relation. The mathematical complexity is modeled as $T(d) = 2 \cdot T(d - 1)$, resulting in an overall time complexity of $O(2^d)$. While polynomial comparison costs are expected when handling massive lists, exponential scaling makes the runtime extremely fragile to structural depth changes.
Since the parser Component.from_ical does not enforce a maximum nesting depth limit, there is no system boundary controlling the size of this call tree. An ASCII payload of less than one kilobyte can contain a nesting structure 30 layers deep. Triggering a comparison on this small input requires over one billion mathematical steps, locking the execution thread and freezing the application process indefinitely.
The vulnerable implementation in src/icalendar/cal/component.py highlights how recursive evaluation pathing created the bottleneck. The comparison relied on dual nested loops to verify membership between both lists of subcomponents:
# Vulnerable code block in icalendar version 7.1.0 to 7.1.2
for subcomponent in self.subcomponents:
if subcomponent not in other.subcomponents: # Initiates recursive __eq__
return False
for subcomponent in other.subcomponents:
if subcomponent not in self.subcomponents: # Initiates redundant recursive __eq__
return FalseThis implementation did not track which child components had already been successfully matched, leading to redundant verification traversals down equal sibling paths.
To remediate this issue, the patch introduced in version 7.1.3 removes the recursive comparison structure entirely. It replaces the call stack with an iterative state machine utilizing an explicit heap-allocated list. The fix introduces a helper dataclass, _ComponentEqFrame, to record comparison state, tracking index positions and unmatched child lists for each level of the tree:
@dataclass
class _ComponentEqFrame:
"""A pending component-equality comparison on the iterative stack."""
a: Component
b: Component
unmatched: list | None = None
a_index: int = 0
candidate_index: int = 0The updated __eq__ method operates using a manual stack structure inside a while loop. Instead of relying on Python's interpreter call stack to process child components, the loop dynamically pushes and pops _ComponentEqFrame contexts. This transition protects the system from stack overflows and removes the exponential $O(2^d)$ branching factor:
# Patched stack-based equality logic in version 7.1.3
stack = [_ComponentEqFrame(self, other)]
child_result = None
while stack:
frame = stack[-1]
# Evaluates properties and processes subcomponents iteratively
# Full implementation prevents call-stack exhaustionWhile the stack-based architecture successfully neutralizes the exponential growth curve, security engineers should monitor residual scaling patterns. For components containing flat, extremely wide sibling arrays, the algorithm still executes pairwise matching checks. This results in quadratic $O(W^2)$ polynomial complexity for sibling groups of width $W$, which can lead to notable CPU consumption if exceptionally large flat feeds are processed.
An attack leveraging CVE-2026-55099 requires no authentication credentials or complex target interaction. The attack surface is active wherever an application parses and compares external .ics calendar objects. This frequently includes calendar import features, synchronization workers reading from remote feeds, and automated processes tracking email invitation responses.
The exploit payload is highly compact and easily evades standard file size and network validation checks. An attacker creates a highly nested structure using repeated BEGIN:VEVENT tags, where each block is wrapped within another. Since each level represents a valid calendar component, the parsing engine process constructs the nested tree correctly without raising formatting errors.
BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
UID:1
BEGIN:VEVENT
UID:2
BEGIN:VEVENT
UID:3
... (repeated nesting up to 35 levels) ...
END:VEVENT
END:VEVENT
END:VEVENT
END:VCALENDAROnce parsed, the denial of service occurs when the application runs any comparison step. This typically happens when validating uniqueness or matching the payload against an existing record database. The thread immediately enters a prolonged calculation phase, running at 100% CPU capacity and locking out worker execution.
import time
from icalendar.cal.component import Event
def build_nested_event(depth: int) -> Event:
root = node = Event()
for _ in range(depth):
child = Event()
node.add_component(child)
node = child
return root
# Demonstrates the CPU freeze condition on vulnerable versions
left = build_nested_event(30)
right = build_nested_event(30)
start_time = time.time()
is_equal = (left == right) # Locks coreThe primary impact of this vulnerability is a complete Denial of Service on application nodes handling calendar data. Because Python implementations typically run on a single CPU core per process, a single thread entering the exponential comparison loop locks that entire core. In standard single-process worker architectures, this blocks all incoming traffic and halts the service.
In multi-threaded or multi-process web server configurations, the threat profile remains significant. A remote attacker can issue multiple parallel requests containing the malicious payload. By matching the number of requests to the available server threads, the attacker can systematically lock every worker process, forcing the target server to stop responding to legitimate users.
The Common Vulnerability Scoring System assigned CVE-2026-55099 a base score of 7.5, classifying it as high severity. No specialized execution conditions, specific configurations, or user interaction are required to exploit the flaw. While no active exploitation campaigns are recorded in public KEV repositories, the existence of functional proof-of-concept tests makes immediate defense critical.
The definitive remediation for CVE-2026-55099 is upgrading the icalendar Python library to version 7.1.3 or higher. This update replaces the vulnerable recursive comparison framework with a safe, iterative stack-based algorithm. System administrators should update their pip packaging files immediately and re-deploy active application nodes.
If immediate library upgrades are not possible, administrators should deploy pre-parsing input validation rules. This workaround involves scanning incoming raw iCalendar files to verify that the nesting depth of blocks does not exceed a reasonable limit, such as five levels. Payloads that exceed the depth ceiling should be rejected immediately before reaching the parser.
def check_ics_nesting(ics_content: str, max_depth: int = 5) -> bool:
current_depth = 0
for line in ics_content.splitlines():
cleaned = line.strip().upper()
if cleaned.startswith("BEGIN:"):
current_depth += 1
if current_depth > max_depth:
return False
elif cleaned.startswith("END:"):
current_depth = max(0, current_depth - 1)
return TrueAdditionally, developers should avoid running direct equality checks on raw, unvalidated calendar structures. Restricting matching operations to specific parsed fields, such as matching only unique identifier strings (UID), eliminates the need to execute general tree-equality checks and bypasses the vulnerable code path completely.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H| Product | Affected Versions | Fixed Version |
|---|---|---|
icalendar Collective | >= 7.1.0, < 7.1.3 | 7.1.3 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-407 |
| Attack Vector | Network |
| Complexity | Low |
| CVSS v3.1 Score | 7.5 (High) |
| Impact | Denial of Service (Thread Exhaustion) |
| Exploit Status | PoC Available |
The product of an algorithm has an inefficient complexity (such as O(n^2) or O(2^n)) that can be abused to cause a denial of service.
An uncontrolled memory allocation vulnerability exists in ag-psd versions prior to 31.0.0. When parsing Adobe Photoshop Document (PSD) files, the readPsd() function reads image dimensions and color depth directly from the file header and allocates off-heap typed arrays without validating whether the requested memory size is proportional to the input stream or bounded by operational thresholds. An unauthenticated attacker can supply a crafted 52-byte PSD payload that triggers an immediate 3.35 GB memory allocation, resulting in process termination via the operating system Out-Of-Memory (OOM) killer.
CVE-2026-126297 (GHSA-v8f3-6phw-6mh9) is an uncontrolled resource consumption and algorithmic complexity vulnerability in the Natural Language Toolkit (NLTK) prior to version 3.10.4. Located in the Semantic Role Labeling (SRL) parser within `nltk/corpus/reader/conll.py`, the flaw allows an attacker to trigger quadratic O(N^2) CPU processing overhead by providing crafted CoNLL-formatted corpus inputs containing decoy span columns or nested full-width verb spans. Applications parsing untrusted linguistic corpora can experience prolonged CPU exhaustion and application-level Denial of Service (DoS).
CVE-2026-126298 (also tracked as GHSA-r53h-rw34-8h97) is an algorithmic complexity Denial of Service (DoS) vulnerability in the Natural Language Toolkit (NLTK) Python library affecting all versions prior to 3.10.4. The vulnerability resides in the nltk.tree.transforms.chomsky_normal_form function and its corresponding public method Tree.chomsky_normal_form(). When transforming a parse tree into Chomsky Normal Form using the default right-factoring strategy, the function repeatedly invokes list.pop(0) inside a loop iterating over all children of a node. In CPython, removing the initial element of a standard list requires an O(N) memory shift operation, causing the overall binarization algorithm to degrade to O(N^2) quadratic time complexity relative to the width of a node. Furthermore, converting horizontal node width into vertical tree depth bypasses initial parsing depth bounds, triggering subsequent stack exhaustion (RecursionError) when recursive methods traverse the mutated structure. Unauthenticated remote attackers who can submit bracketed tree strings to applications invoking this transformation can exhaust single-threaded CPU resources or induce unhandled application exceptions.
An algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) before version 3.10.4 allows remote unauthenticated attackers to cause a denial of service via crafted Combinatory Categorial Grammar (CCG) lexicon strings. The parser in nltk.ccg.lexicon.fromstring performs repeated immutable string slicing, concatenation, and regex tail capturing, resulting in O(n^2) CPU consumption when processing wide, flat category definitions.
CVE-2026-126295 (also tracked as GHSA-fg9w-wfp5-j933) is a path confinement bypass vulnerability in the Natural Language Toolkit (NLTK) affecting versions 3.10.0 prior to 3.10.4. The flaw resides in nltk/parse/bllip.py within the BllipParser class and its factory method BllipParser.from_unified_model_dir(). Unlike sibling tool wrappers in NLTK that enforce data-root confinement via the nltk.pathsec module, BllipParser passes caller-supplied filesystem paths directly into the third-party bllipparser native C extension without validation. When an application passes untrusted input as model paths or directories to BllipParser, an attacker can force the native extension to open arbitrary files on the local filesystem. This leads to information disclosure through parser diagnostic oracles, local model tampering via shared directories, and denial of service by hanging worker threads on blocking special files (such as FIFOs or device nodes) or exhausting memory via oversized files.
CVE-2026-126300 (GHSA-ffr9-mgrr-wcvr) is an inefficient algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) Python library affecting versions 3.2.5 prior to 3.10.4. The flaw resides in the quote-restoration routine of TreebankWordTokenizer.span_tokenize and NLTKWordTokenizer.span_tokenize, where repeated calls to list.pop(0) over matched quote tokens introduce quadratic O(n^2) time complexity. An unauthenticated remote attacker who supplies input containing long sequences of double-quote characters can exhaust CPU resources and degrade service availability.