CVE-2026-104199: aMQTT Remote Code Execution Vulnerability

HIGH
Advisory Identifier: GHSA-2hjf-7455-w946
CWE-400 CWE-1333 CWE-20
Published
Advisory Summary

CVE-2026-104199 is a HIGH remote code execution vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting aMQTT libraries in the PyPI ecosystem. The issue involves inefficient regular expression complexity and uncontrolled resource consumption and improper input validation. Remediation is available by upgrading affected packages to version 0.11.4.

CVE-2026-104199 at a Glance

CVE Identifier CVE-2026-104199
GHSA Identifier GHSA-2hjf-7455-w946
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product aMQTT
Package Ecosystem PyPI
Published Date
Last Updated

How to Fix CVE-2026-104199

To remediate this vulnerability, upgrade all affected aMQTT dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

amqtt fixed: 0.11.4
pip install amqtt>=0.11.4
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show amqtt

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-104199, inspect your installed packages using pip:

pip show amqtt

Analyze the terminal output to locate any version of aMQTT in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.11.4), your application is affected.

Note: The pip show amqtt command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In aMQTT, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact `amqtt` is vulnerable to a remote denial of service caused by improper MQTT topic-filter validation combined with catastrophic regular-expression backtracking. A single client can freeze the entire broker by sending one specially crafted `SUBSCRIBE` packet followed by one `PUBLISH` packet. The vulnerability is caused by two defects: 1. `add_subscription()` validates the placement of the single-level wildcard `+` using substring checks for `/+` and `+/`, rather than verifying that each `/`-delimited level containing `+` is exactly `+`. This allows malformed filters such as `"+/" + "+" * 60` to be accepted instead of rejected with return code `0x80`, as required by MQTT-4.7.1-3. 2. `_matches()` converts every `+` character into the greedy regular-expression fragment `[^/]*` and evaluates the resulting expression with `re.fullmatch()`. A filter containing many adjacent `+` characters can cause catastrophic backtracking when matched against a topic that partially matches but ultimately fails. Topic matching runs synchronously inside the broker’s global broadcast loop. When the malicious match is evaluated, it blocks the asyncio event loop and prevents the broker from processing any other work. The issue was reproduced using a single raw MQTT 3.1.1 TCP connection with no third-party client dependencies. Successful exploitation causes: - Existing message delivery to stop - New MQTT connections to receive no `CONNACK` - Keepalive processing to stop - Broadcast processing to stop - The broker to remain unavailable until the process is restarted Under the default configuration, anonymous clients can exploit the vulnerability without credentials. When authentication is enabled, any authenticated client permitted to create arbitrary subscriptions and publish messages may still exploit it. Authentication alone is therefore not a sufficient mitigation. - Ecosystem: `pip` - Package: `amqtt` - Affected versions: `>= 0.11.0, <= 0.11.3` The vulnerable code is present in the `v0.11.0` release commit, `352678c87e50e501a8a5bb91fab73c9400fa046c`, and remained present on the main branch as of `eeb1e254da9a1e8d9cc68ae754fcedac652e8fc0`. Versions before 0.11.0 were not evaluated. This is a denial-of-service vulnerability only. `re.escape()` prevents arbitrary regular-expression injection, and there is no known path to remote code execution. No confidentiality or integrity impact has been identified. Successful exploitation causes a complete loss of availability for the affected broker process. ### Patches The issue has been patched in the `v0.11.4` released version; all users should upgrade. The completed fix: - Validate topic filters one level at a time - Require any level containing `+` to be exactly `+` - As part of comprehensive MQTT topic-filter validation, require `#` to occupy an entire level and appear only as the final level - Replace the regular-expression matcher with deterministic, level-by-level MQTT topic matching Simply changing the validation logic is not sufficient defense in depth if malformed filters can reach the existing regular-expression matcher through another code path. ### Workarounds This is the temporary mitigation that was recommended prior to the patched release: administrators can install a topic-filtering plugin that rejects malformed wildcard subscriptions before they are added to the broker. Place the plugin in an importable Python module, enable it in the broker configuration, and restart the broker. ```python from amqtt.contexts import Action from amqtt.plugins.base import BaseTopicPlugin from amqtt.session import Session class RejectInvalidTopicFilters(BaseTopicPlugin): """A plugin to prevent invalid wildcard subscriptions.""" async def topic_filtering( self, *, session: Session | None = None, topic: str | None = None, action: Action | None = None ) -> bool | None: if topic and action == Action.SUBSCRIBE: levels = topic.split("/") return all( level in {"+", "#"} or ("+" not in level and "#" not in level) for level in levels ) and "#" not in levels[:-1] return True config = { ... 'plugins':{ ... 'myplugins.RejectInvalidTopicFilters': {} } } ``` This workaround applies when subscription requests pass through the plugin. If the broker is configured to use a persistent session plugin, restarting the broker alone is not sufficient; any persisted sessions containing malformed topic filters need to be removed. Restarting the broker restores availability after exploitation, but the broker remains vulnerable until the patch or workaround is installed. ### Acknowledgments aMQTT thanks the following security researchers for their professional, coordinated private disclosure: * **Yongkang Xiao** (Wuhan University) * **Min Shi** (Wuhan University) * **Qiyi Deng** (Wuhan University) * **Jing Chen** (Wuhan University)

CVE-2026-104199 Affected aMQTT Versions

1 component(s)
Fixed Versions:
0.11.4
Product / Package Ecosystem Affected Versions Fixed Version
amqtt
PyPI
≥ 0.11.0
< 0.11.4
0.11.4

References

Frequently Asked Questions

What is CVE-2026-104199?
CVE-2026-104199 is a security vulnerability in aMQTT involving Inefficient Regular Expression Complexity and Uncontrolled Resource Consumption and Improper Input Validation under CWE-400: Uncontrolled Resource Consumption.
Which aMQTT versions are affected?
Affected versions include releases prior to 0.11.4 across affected packages: amqtt.
What version fixes CVE-2026-104199?
Upgrading to 0.11.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is amqtt affected?
Yes, amqtt is affected in releases prior to 0.11.4. Upgrade your dependency to 0.11.4 or later.
What CWE is associated with CVE-2026-104199?
CVE-2026-104199 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check PyPI dependencies for CVE-2026-104199?
Run the dependency tree command: 'pip show amqtt'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-2hjf-7455-w946",
  "modified" : "2026-11-20T14:43:41Z",
  "published" : "2026-11-20T14:43:41Z",
  "aliases" : [ "CVE-2026-104199" ],
  "summary" : "aMQTT: Inefficient Regular Expression Complexity and Uncontrolled Resource Consumption and Improper Input Validation",
  "details" : "### Impact\n\n`amqtt` is vulnerable to a remote denial of service caused by improper MQTT topic-filter validation combined with catastrophic regular-expression backtracking.\n\nA single client can freeze the entire broker by sending one specially crafted `SUBSCRIBE` packet followed by one `PUBLISH` packet.\n\nThe vulnerability is caused by two defects:\n\n1. `add_subscription()` validates the placement of the single-level wildcard `+` using substring checks for `/+` and `+/`, rather than verifying that each `/`-delimited level containing `+` is exactly `+`. This allows malformed filters such as `\"+/\" + \"+\" * 60` to be accepted instead of rejected with return code `0x80`, as required by MQTT-4.7.1-3.\n2. `_matches()` converts every `+` character into the greedy regular-expression fragment `[^/]*` and evaluates the resulting expression with `re.fullmatch()`. A filter containing many adjacent `+` characters can cause catastrophic backtracking when matched against a topic that partially matches but ultimately fails.\n\nTopic matching runs synchronously inside the broker’s global broadcast loop. When the malicious match is evaluated, it blocks the asyncio event loop and prevents the broker from processing any other work.\n\nThe issue was reproduced using a single raw MQTT 3.1.1 TCP connection with no third-party client dependencies.\n\nSuccessful exploitation causes:\n\n- Existing message delivery to stop\n- New MQTT connections to receive no `CONNACK`\n- Keepalive processing to stop\n- Broadcast processing to stop\n- The broker to remain unavailable until the process is restarted\n\nUnder the default configuration, anonymous clients can exploit the vulnerability without credentials. When authentication is enabled, any authenticated client permitted to create arbitrary subscriptions and publish messages may still exploit it. Authentication alone is therefore not a sufficient mitigation.\n\n- Ecosystem: `pip`\n- Package: `amqtt`\n- Affected versions: `>= 0.11.0, <= 0.11.3`\n\nThe vulnerable code is present in the `v0.11.0` release commit, `352678c87e50e501a8a5bb91fab73c9400fa046c`, and remained present on the main branch as of `eeb1e254da9a1e8d9cc68ae754fcedac652e8fc0`. Versions before 0.11.0 were not evaluated.\n\nThis is a denial-of-service vulnerability only. `re.escape()` prevents arbitrary regular-expression injection, and there is no known path to remote code execution.\n\nNo confidentiality or integrity impact has been identified. Successful exploitation causes a complete loss of availability for the affected broker process.\n\n### Patches\n\nThe issue has been patched in the `v0.11.4` released version; all users should upgrade.\n\nThe completed fix:\n\n- Validate topic filters one level at a time\n- Require any level containing `+` to be exactly `+`\n- As part of comprehensive MQTT topic-filter validation, require `#` to occupy an entire level and appear only as the final level\n- Replace the regular-expression matcher with deterministic, level-by-level MQTT topic matching\n\nSimply changing the validation logic is not sufficient defense in depth if malformed filters can reach the existing regular-expression matcher through another code path.\n\n### Workarounds\n\nThis is the temporary mitigation that was recommended prior to the patched release: administrators can install a topic-filtering plugin that rejects malformed wildcard subscriptions before they are added to the broker. Place the plugin in an importable Python module, enable it in the broker configuration, and restart the broker.\n\n```python\nfrom amqtt.contexts import Action\nfrom amqtt.plugins.base import BaseTopicPlugin\nfrom amqtt.session import Session\n\nclass RejectInvalidTopicFilters(BaseTopicPlugin):\n    \"\"\"A plugin to prevent invalid wildcard subscriptions.\"\"\"\n    async def topic_filtering(\n        self, *, session: Session | None = None,\n        topic: str | None = None,\n        action: Action | None = None\n    ) -> bool | None:\n\n        if topic and action == Action.SUBSCRIBE:\n            levels = topic.split(\"/\")\n            return all(\n                level in {\"+\", \"#\"} or (\"+\" not in level and \"#\" not in level)\n                for level in levels\n            ) and \"#\" not in levels[:-1]\n        return True\n        \nconfig = {\n    ...\n    'plugins':{\n        ...\n        'myplugins.RejectInvalidTopicFilters': {}\n    }\n}\n``` \n\nThis workaround applies when subscription requests pass through the plugin. If the broker is configured to use a persistent session plugin, restarting the broker alone is not sufficient; any persisted sessions containing malformed topic filters need to be removed.\n\nRestarting the broker restores availability after exploitation, but the broker remains vulnerable until the patch or workaround is installed.\n\n### Acknowledgments\n\naMQTT thanks the following security researchers for their professional, coordinated private disclosure:\n\n* **Yongkang Xiao** (Wuhan University)\n* **Min Shi** (Wuhan University)\n* **Qiyi Deng** (Wuhan University)\n* **Jing Chen** (Wuhan University)",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "amqtt"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.11.0"
      }, {
        "fixed" : "0.11.4"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.11.3"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/Yakifo/amqtt/security/advisories/GHSA-2hjf-7455-w946"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-104199"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Yakifo/amqtt/pull/361"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Yakifo/amqtt/commit/e48a8a65027667f936d415db7f01d3ac350104e0"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Yakifo/amqtt"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Yakifo/amqtt/releases/tag/v0.11.4"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1333", "CWE-20", "CWE-400" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-11-20T14:43:41Z",
    "nvd_published_at" : "2026-11-19T20:17:14Z"
  }
}