The vulnerability (CVE-2026-76098) in Mistune versions 3.3.0 through 3.3.2 is a Denial of Service (DoS) caused by uncontrolled recursion. The root cause lies in the _process_emphasis_delimiters function within src/mistune/inline_parser.py. This function, responsible for parsing Markdown emphasis markers (like * and **), would create deeply nested emphasis or strong tokens without any depth limitation when processing specially crafted input (e.g., many consecutive asterisks). This unbounded nesting of tokens is the fundamental flaw.
When these deeply nested tokens are subsequently rendered, the HTMLRenderer.render_token method in src/mistune/renderers/html.py is invoked. This method is inherently recursive, as it calls self.render_tokens to process child tokens, which in turn calls self.render_token for each child. With an excessively deep token tree generated by the vulnerable parser, the recursive calls to HTMLRenderer.render_token quickly exceed Python's default recursion limit, resulting in a RecursionError and crashing the parsing process.
The patch addresses this by introducing a max_emphasis_depth limit during the parsing phase. Specifically, the _process_emphasis_delimiters function is modified to check the current emphasis depth using a new _emphasis_depth helper function. If the depth exceeds the configured maximum, further nesting is prevented, thus mitigating the creation of overly deep token structures. Therefore, _process_emphasis_delimiters is the function that allowed the vulnerable state (deeply nested tokens) to be created, and HTMLRenderer.render_token is the function that directly triggers the DoS due to its recursive nature when processing the malformed input.