CVE-2026-30867: CocoaMQTT Denial of Service Vulnerability
MODERATECVE-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
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).
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.
Upgrade CocoaMQTT to 2.2.2
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
CVE-2026-30867 Affected CocoaMQTT Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
CocoaMQTT
|
SwiftURL |
< 2.2.2
|
2.2.2
|
References
Frequently Asked Questions
What is CVE-2026-30867?
Which CocoaMQTT versions are affected?
What version fixes CVE-2026-30867?
Is CocoaMQTT affected?
What is the CVSS score of CVE-2026-30867?
What CWE is associated with CVE-2026-30867?
How can I check SwiftURL dependencies for CVE-2026-30867?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}