{"id":"CVE-2026-30867","aliases":["CVE-2026-30867","GHSA-r3fr-7m74-q7g2"],"related":[],"kind":"vulnerability","state":"published","title":"CocoaMQTT: Denial of Service via Reachable Assertion in `PUBLISH` Packet Parsing","summary":"CocoaMQTT is a MQTT 5.0 client library for iOS and macOS written in Swift. Prior to version 2.2.2, 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. If an attacker publishes the 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. This issue has been patched in version 2.2.2.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"CocoaMQTT is a MQTT 5.0 client library for iOS and macOS written in Swift. Prior to version 2.2.2, 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. If an attacker publishes the 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. This issue has been patched in version 2.2.2.","source":"cvelist"},{"lang":"en","text":"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.","format":"markdown","source":"ghsa"},{"lang":"es","text":"CocoaMQTT es una biblioteca cliente MQTT 5.0 para iOS y macOS escrita en Swift. Antes de la versión 2.2.2, existe una vulnerabilidad en la lógica de análisis de paquetes de CocoaMQTT que permite a un atacante (o un bróker MQTT comprometido/malicioso) bloquear remotamente la aplicación anfitriona de iOS/macOS/tvOS. Si un atacante publica la carga útil malformada de 4 bytes en un tema compartido con la bandera RETAIN establecida en verdadero, el bróker MQTT persistirá la carga útil. Cada vez que un cliente vulnerable se conecta y se suscribe a ese tema, el bróker enviará automáticamente el paquete malformado. La aplicación se bloqueará instantáneamente en segundo plano antes de que el usuario pueda interactuar con ella. Esto efectivamente ’bloquea’ la aplicación móvil (un DoS persistente) hasta que el mensaje retenido sea borrado manualmente de la base de datos del bróker. Este problema ha sido parcheado en la versión 2.2.2.","source":"nvd"}],"published":"2026-04-02T13:57:06.394Z","modified":"2026-10-26T22:10:00.163Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:N/A:H","score":5.7,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:N/A:H","score":5.7,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:N/A:H","score":5.7,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":6.5,"rating":"MEDIUM"}],"cwes":["CWE-617"],"affected":[{"ranges":[{"version":"< 2.2.2","status":"affected"}],"vendor":"emqx","product":"CocoaMQTT","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"2.2.2"}],"ecosystem":"SwiftURL","package":"CocoaMQTT","purl":"pkg:swift/CocoaMQTT","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"2.2.2"}],"vendor":"emqx","product":"cocoamqtt","cpe":"cpe:2.3:a:emqx:cocoamqtt:*:*:*:*:*:swift:*:*","source":"nvd"}],"references":[{"url":"https://github.com/emqx/CocoaMQTT/security/advisories/GHSA-r3fr-7m74-q7g2","tags":["exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/emqx/CocoaMQTT/pull/659","tags":["issue-tracking","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/emqx/CocoaMQTT/commit/010bca6f61b97d726252f61641d331a2bf82b338","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/emqx/CocoaMQTT/releases/tag/2.2.2","tags":["release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-30867","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/emqx/CocoaMQTT","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-04-02T16:18:50.452Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-30867","url":"https://www.cve.org/CVERecord?id=CVE-2026-30867","licence":"CVE Terms of Use","modified":"2026-04-02T16:23:13.357Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-r3fr-7m74-q7g2","url":"https://github.com/advisories/GHSA-r3fr-7m74-q7g2","licence":"CC-BY-4.0","modified":"2026-04-03T21:56:24.699Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-30867","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-30867","licence":"Public domain","modified":"2026-10-26T22:10:00.163Z"}],"updatedAt":"2026-11-25T22:59:17.780Z","epss":{"score":0.00368,"percentile":0.32655,"date":"2026-12-02T12:00:21.000Z"}}