Skip to main content
Vulnerability Database/CVE-2025-54364

CVE-2025-54364: Microsoft Knack ReDoS Vulnerability

CVE-2025-54364 is a Regular expression Denial of Service flaw in Microsoft Knack 0.12.0 that enables attackers to cause excessive CPU consumption through crafted docstrings. This article covers technical details, affected versions, impact analysis, and mitigation strategies.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2025-54364 Overview

CVE-2025-54364 is a Regular Expression Denial of Service (ReDoS) vulnerability in Microsoft Knack 0.12.0, a Python command-line interface framework used by Azure CLI. The flaw resides in the knack.introspection module, where the option_descriptions function employs an inefficient regular expression pattern susceptible to catastrophic backtracking. An attacker who can control or inject docstring content into affected applications can trigger excessive CPU consumption. The vulnerability is tracked under CWE-1333: Inefficient Regular Expression Complexity.

Critical Impact

Attackers with control over docstring content can trigger sustained CPU exhaustion in applications built on Knack, including tooling that leverages Azure CLI components.

Affected Products

  • Microsoft Knack version 0.12.0
  • Azure CLI (uses the Knack framework)
  • Python applications depending on knack.introspection.option_descriptions

Discovery Timeline

  • 2025-08-20 - CVE-2025-54364 published to the National Vulnerability Database
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2025-54364

Vulnerability Analysis

The vulnerability is a Regular Expression Denial of Service (ReDoS) flaw rooted in catastrophic backtracking. The affected regex "\s(:param)\s+(.+?)\s:(.*)" is used by Knack to parse :param directives from Python docstrings when generating CLI option descriptions.

When the regex engine processes a crafted docstring that contains large volumes of whitespace without a terminating colon, the backtracking cost grows non-linearly with input length. The engine repeatedly tries alternative match positions for the greedy and lazy quantifiers before failing, consuming CPU in the process. Because Knack is embedded in Azure CLI and other Python tooling, any workflow that renders help output or introspects commands using attacker-controlled docstrings can be forced into prolonged CPU-bound operations.

Root Cause

The root cause is an inefficient regular expression that permits multiple overlapping quantifier matches on whitespace sequences. The combination of \s+ and (.+?)\s: allows the engine to split whitespace runs in many ways while searching for the required : terminator. When the terminator never appears, the engine exhausts all permutations before returning a non-match.

Attack Vector

Exploitation requires an attacker to supply or influence a docstring that is subsequently parsed by option_descriptions. In practical deployments, this can occur when a developer loads untrusted Python modules, plugins, or extensions whose command classes contain hostile docstrings. Successful triggering produces a local denial-of-service condition on the host running the CLI or framework consumer. The attack vector is local and does not require authentication or user interaction beyond invoking the affected code path.

No public proof-of-concept exploit code is listed in the enriched data. See the VulnCheck Advisory on Knack for additional technical context.

Detection Methods for CVE-2025-54364

Indicators of Compromise

  • Sustained single-core CPU saturation by a Python process running Azure CLI or Knack-based tooling
  • Hung or unresponsive CLI commands when parsing help output for modules containing untrusted docstrings
  • Presence of Knack version 0.12.0 in Python environment manifests (pip freeze, requirements.txt, Pipfile.lock)

Detection Strategies

  • Inventory Python environments and container images for knack==0.12.0 using software composition analysis tooling
  • Audit third-party Python packages and Azure CLI extensions for docstrings containing :param directives followed by long whitespace runs without a terminating colon
  • Correlate process telemetry showing Python interpreters consuming high CPU for extended periods against CLI invocation logs

Monitoring Recommendations

  • Alert on Python processes exceeding CPU thresholds for abnormal durations on developer workstations, CI runners, and build agents
  • Monitor installation and update events for Azure CLI extensions and Knack-based tooling in regulated environments
  • Track outbound package installations from untrusted indexes that could introduce malicious docstring content

How to Mitigate CVE-2025-54364

Immediate Actions Required

  • Upgrade Microsoft Knack to a version later than 0.12.0 once a fixed release is published by the maintainers
  • Avoid loading untrusted Python modules, plugins, or Azure CLI extensions into environments running vulnerable Knack versions
  • Apply CPU and runtime limits to CLI invocations in CI/CD pipelines and shared build systems to contain impact

Patch Information

Monitor the Microsoft Knack GitHub repository for a release that replaces the vulnerable regular expression in knack.introspection.option_descriptions. Review the VulnCheck Advisory on Knack for the current fix status and vendor guidance. Azure CLI consumers should track Azure CLI release notes for a bundled dependency update.

Workarounds

  • Pin environments to a non-vulnerable Knack version once available, and block 0.12.0 in internal package mirrors
  • Review and sanitize docstrings in locally developed command modules to ensure :param directives include a terminating colon
  • Run Knack-based tooling under process timeouts (for example, timeout on Linux) to bound ReDoS impact
  • Restrict execution of untrusted Azure CLI extensions using organizational allow-lists
bash
# Configuration example: enforce a runtime bound on Azure CLI invocations
timeout 30s az <command> <args>

# Identify vulnerable Knack installations across Python environments
pip show knack | grep -i version
pip install 'knack!=0.12.0'

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.