CVE-2026-30867: CocoaMQTT Denial of Service Vulnerability

MODERATE
Advisory Identifier: GHSA-r3fr-7m74-q7g2
CVSS 5.7
CWE-617
Published
Advisory Summary

CVE-2026-30867 is a MODERATE (CVSS 5.7) denial of service vulnerability (CWE-617: Reachable Assertion) affecting CocoaMQTT libraries in the SwiftURL ecosystem. The issue involves denial of service via reachable assertion in `publish` packet parsing. Remediation is available by upgrading affected packages to version 2.2.2.

CVE-2026-30867 at a Glance

CVE Identifier CVE-2026-30867
GHSA Identifier GHSA-r3fr-7m74-q7g2
Severity MODERATE
CVSS v3.1 Base Score 5.7
CWE Classification CWE-617: Reachable Assertion
Affected Product CocoaMQTT
Package Ecosystem SwiftURL
Published Date
Last Updated

Security Impact

CVSS: 5.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2026-30867

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

CocoaMQTT fixed: 2.2.2
Upgrade CocoaMQTT to 2.2.2
Verify Direct and Transitive Dependencies

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

inspect dependencies for CocoaMQTT

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-30867, inspect your project dependencies for CocoaMQTT:

inspect dependencies for CocoaMQTT

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

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-617: Reachable Assertion, where the product contains an assert() or similar statement that can be triggered by an attacker, which leads to an application exit or other behavior that is more severe than necessary. In CocoaMQTT, 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

A vulnerability exists in the packet parsing logic of CocoaMQTT that allows an attacker (or a compromised/malicious MQTT broker) to remotely crash the host iOS/macOS/tvOS application. The vulnerability is located in `Source/FramePublish.swift` during the extraction of the Topic string from the incoming byte array. When parsing the Variable Header of a `PUBLISH` frame, the library reads the first two bytes to determine the `topicLength`. It then adds this length to the current position (`pos`) and attempts to slice the byte array to extract the string: ```swift if let data = NSString(bytes: [UInt8](bytes[2...(pos-1)]), length: Int(len), encoding: String.Encoding.utf8.rawValue) { topic = data as String } ``` If a packet is received where the Topic Length evaluates to `0` (e.g., `0x00 0x00`), the `len` variable becomes `0`, and `pos` evaluates to `2`. The slicing logic dynamically calculates `bytes[2...(2-1)]`, which becomes **`bytes[2...1]`**. Swift's `ClosedRange` operator (`...`) requires the lower bound to be less than or equal to the upper bound. Because 2 is not less than 1, Swift detects an out-of-bounds access attempt and immediately triggers a runtime trap (`Fatal error: Range requires lowerBound <= upperBound`), crashing the host application. If an attacker publishes this 4-byte malformed payload to a shared topic with the `RETAIN` flag set to true, the MQTT broker will persist the payload. Any time a vulnerable client connects and subscribes to that topic, the broker will automatically push the malformed packet. The app will instantly crash in the background before the user can even interact with it. This effectively "bricks" the mobile application (a persistent DoS) until the retained message is manually wiped from the broker database.

CVE-2026-30867 Affected CocoaMQTT Versions

1 component(s)
Fixed Versions:
2.2.2
Product / Package Ecosystem Affected Versions Fixed Version
CocoaMQTT
SwiftURL
< 2.2.2
2.2.2

References

Frequently Asked Questions

What is CVE-2026-30867?
CVE-2026-30867 is a security vulnerability in CocoaMQTT involving Denial of Service via Reachable Assertion in `PUBLISH` Packet Parsing under CWE-617: Reachable Assertion.
Which CocoaMQTT versions are affected?
Affected versions include releases prior to 2.2.2 across affected packages: CocoaMQTT.
What version fixes CVE-2026-30867?
Upgrading to 2.2.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is CocoaMQTT affected?
Yes, CocoaMQTT is affected in releases prior to 2.2.2. Upgrade your dependency to 2.2.2 or later.
What is the CVSS score of CVE-2026-30867?
CVE-2026-30867 has a CVSS v3.1 base score of 5.7 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2026-30867?
CVE-2026-30867 is classified under CWE-617: Reachable Assertion (The product contains an assert() or similar statement that can be triggered by an attacker, which leads to an application exit or other behavior that is more severe than necessary.).
How can I check SwiftURL dependencies for CVE-2026-30867?
Run the dependency tree command: 'inspect dependencies for CocoaMQTT'. 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-r3fr-7m74-q7g2",
  "modified" : "2026-04-03T21:33:58Z",
  "published" : "2026-04-03T21:33:58Z",
  "aliases" : [ "CVE-2026-30867" ],
  "summary" : "CocoaMQTT: Denial of Service via Reachable Assertion in `PUBLISH` Packet Parsing ",
  "details" : "A vulnerability exists in the packet parsing logic of CocoaMQTT that allows an attacker (or a compromised/malicious MQTT broker) to remotely crash the host iOS/macOS/tvOS application.\n\nThe vulnerability is located in `Source/FramePublish.swift` during the extraction of the Topic string from the incoming byte array.\n\nWhen parsing the Variable Header of a `PUBLISH` frame, the library reads the first two bytes to determine the `topicLength`. It then adds this length to the current position (`pos`) and attempts to slice the byte array to extract the string:\n\n```swift\nif let data = NSString(bytes: [UInt8](bytes[2...(pos-1)]), length: Int(len), encoding: String.Encoding.utf8.rawValue) {\n    topic = data as String\n}\n```\n\nIf a packet is received where the Topic Length evaluates to `0` (e.g., `0x00 0x00`), the `len` variable becomes `0`, and `pos` evaluates to `2`.\n\nThe slicing logic dynamically calculates `bytes[2...(2-1)]`, which becomes **`bytes[2...1]`**. Swift's `ClosedRange` operator (`...`) requires the lower bound to be less than or equal to the upper bound. Because 2 is not less than 1, Swift detects an out-of-bounds access attempt and immediately triggers a runtime trap (`Fatal error: Range requires lowerBound <= upperBound`), crashing the host application.\n\nIf an attacker publishes this 4-byte malformed payload to a shared topic with the `RETAIN` flag set to true, the MQTT broker will persist the payload. Any time a vulnerable client connects and subscribes to that topic, the broker will automatically push the malformed packet. The app will instantly crash in the background before the user can even interact with it. This effectively \"bricks\" the mobile application (a persistent DoS) until the retained message is manually wiped from the broker database.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "SwiftURL",
      "name" : "CocoaMQTT"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.2.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/emqx/CocoaMQTT/security/advisories/GHSA-r3fr-7m74-q7g2"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-30867"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/emqx/CocoaMQTT/pull/659"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/emqx/CocoaMQTT/commit/010bca6f61b97d726252f61641d331a2bf82b338"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/emqx/CocoaMQTT"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/emqx/CocoaMQTT/releases/tag/2.2.2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-617" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-03T21:33:58Z",
    "nvd_published_at" : "2026-04-02T14:16:28Z"
  }
}