llamaCVEVulnerability Intelligence
/
Advisory · GitHub · npm · aedes

GHSA-52QW-WHMV-87C5

Remote unauthenticated denial of service: a single SUBSCRIBE, UNSUBSCRIBE or CONNECT using an Object.prototype property name (e.g. "constructor", "__proto__") crashes the aedes broker process

Sin parche publicado
Descargar PNG JSON
CVSS 3.1
7.5
Alta
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
ParcheSin parcheEl fabricante no ha publicado corrección
Exposición65 dDesde la divulgación, 15 sept 2026, 7:42 a. m.
Detección64 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Monitoreo
Detectada +1
15 sept 26
19 nov 26
20 nov 26
15 sept 26
1 oct 26
18 oct 26
3 nov 26
20 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-52QW-WHMV-87C5 divulgada · CVSS 7.5 (GitHub)
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés
Summary

`aedes` keys two internal stores by attacker-controlled strings, using plain object literals:

  • `client.subscriptions = {}` (`lib/client.js:29`) — keyed by the raw SUBSCRIBE/UNSUBSCRIBE topic filter.
  • `Aedes.clients = {}` (`aedes.js:77`) — keyed by the raw CONNECT Client ID.

Because plain objects inherit from `Object.prototype`, a lookup for a name that exists on the prototype —
`constructor`, `__proto__`, `toString`, `valueOf`, `hasOwnProperty`, `isPrototypeOf`, `toLocaleString`,
`propertyIsEnumerable`, `__defineGetter__`, `__defineSetter__`, `__lookupGetter__`, `__lookupSetter__` —
returns a truthy inherited value instead of `undefined`. Every call site here uses a bare truthiness check as
its "is it already present?" test, so it takes the "already present" branch on the very first packet and then
calls a method on the inherited value that either does not exist or has the wrong shape.

`validateTopic()` (`lib/utils.js`) only checks for empty topics, wildcard placement and topic depth; it imposes
no charset restriction. `mqtt-packet` imposes none on the Client ID. So these names are all syntactically legal.

Nothing on any of these paths catches the resulting exception, so it escapes the `'packet'` handler and
terminates the Node process. One packet takes the broker down for every connected client. Under the
library's default `authenticate` / `authorizeSubscribe` hooks no credentials are required at all; under a
custom hook, any client that hook admits can do it.

This is the same *class* as GHSA-xxqp-5qx8-gj5q (uncaught exception crashing the broker via a topic), but the
`topicLevelCount` guard added there does not cover these paths — the throws here come from `removeListener`
and from a plain property access, not from qlobber's word limit.

Details

Four confirmed crash variants, all reproduced against `main` @ `4da0dc9` (v1.1.2).

Variant 1 — SUBSCRIBE to a prototype-named topic

`lib/handlers/subscribe.js`, `addSubs()` (~lines 176-184):

if (!client.subscriptions[topic]) {
  client.subscriptions[topic] = new Subscription(qos, func, rh, rap, nl)
  broker.subscribe(topic, func, done)
} else if (client.subscriptions[topic].qos !== qos || ...) {
  broker.unsubscribe(topic, client.subscriptions[topic].func)   // <-- .func is undefined
  ...
}

For `topic === 'constructor'`, `client.subscriptions['constructor']` is `Object.prototype.constructor` —
truthy — on the client's very first subscription. The `if` is skipped; the `else if` is trivially true (the
inherited value has no `.qos`); `broker.unsubscribe(topic, undefined)` reaches
`Aedes.prototype.unsubscribe` (`aedes.js:229-234`) → `mq.removeListener(topic, undefined, done)` → mqemitter's
`assert(notify)` throws synchronously and uncaught.

AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value: assert(notify)
    at MQEmitter.removeListener (node_modules/mqemitter/mqemitter.js:76:3)
    at Aedes.unsubscribe (aedes.js:233:13)
    at SubState.addSubs (lib/handlers/subscribe.js:180:12)
Variant 2 — UNSUBSCRIBE a prototype-named topic (no prior subscription needed)

`lib/handlers/unsubscribe.js`, `doUnsubscribe()` (lines 53-73):

const s = client.subscriptions[sub]
if (s) {
  const func = s.func              // <-- undefined
  broker.unsubscribe(sub, func, ...)
}

`client.subscriptions['constructor']` is truthy even for a client that has never subscribed to anything,
so `func` is `undefined` and the same mqemitter assertion fires. This variant is cheaper than Variant 1 — it
needs only CONNECT + UNSUBSCRIBE, and no subscription state at all.

Variant 3 — CONNECT with a prototype-named Client ID

`Aedes.prototype.registerClient` (`aedes.js:236-246`):

if (this.clients[client.id]) {
  this.clients[client.id].close(function closeClient () { ... })   // <-- .close is undefined
}

For `client.id === '__proto__'` (or `constructor`, `toString`, …) this is truthy on the first such connection
and throws `TypeError: this.clients[client.id].close is not a function`, before the connection is even fully
registered. Reachable via CONNECT alone, earliest in the lifecycle of the three.

Variant 4 — `$SYS/<peer>/new/clients` with a prototype-named payload

`aedes.js:176-188` handles a peer broker announcing a new client:

if (that.clients[clientId] && serverId !== that.id) {
  ...
  that.clients[clientId].close(done)
}

Same `Aedes.clients` lookup as Variant 3, but reached over the shared mqemitter rather than from a local
socket. In a clustered deployment, a single client connecting to broker A with clientId `constructor`
therefore kills every peer broker, not just the one it connected to. Remote amplification.

Related non-crashing corruption — `_dedupe` and `Aedes.brokers`

`lib/handlers/subscribe.js:67-78` builds `const dedupeSubs = {}` then does `dedupeSubs[sub.topic] = sub` and
iterates with `for...in`. For `sub.topic === '__proto__'` the assignment silently reassigns the object's
prototype instead of adding a key, and the `for...in` then walks the *subscription's* own enumerable
properties, so `ret` ends up holding raw strings/numbers in place of `Subscription` objects. No crash
observed, but it is the same root cause and belongs in the same fix.

`Aedes.brokers` (`aedes.js:78`) is keyed by the `$SYS/+/heartbeat` payload. A peer broker id like `toString`
read back truthy at `aedes.js:123`, so aedes treated that broker as alive and `aedes-persistence`'s
`willsByBrokers` (`if (!brokers[will.brokerId])`) suppressed its will messages indefinitely. Likewise
`client.duplicates` (`lib/client.js:30`) is keyed by `packet.brokerId`, and `dedupe()` does
`(duplicates[id] || 0) < counter` — against an inherited function that is `NaN < n`, i.e. false, silently
dropping every packet from that peer.

PoC

Default broker, no `uncaughtException` handler, on a clean `npm i aedes@1.1.2`:

import { Aedes } from 'aedes'
import net from 'node:net'
const broker = await Aedes.createBroker()
net.createServer(broker.handle).listen(1883)

Then, from any MQTT client, any one of:

SUBSCRIBE   "constructor"                 (QoS 0 is enough)
UNSUBSCRIBE "constructor"                 (no prior SUBSCRIBE needed)
CONNECT     with clientId "__proto__"

In a cluster, the CONNECT variant additionally propagates over `$SYS/<peer>/new/clients` and kills every peer
broker.

The broker process exits. No authentication bypass is required beyond whatever the deployment's `authenticate`
hook already permits — and the library default permits everyone.

Impact

Remote denial of service, unauthenticated under the default configuration. A single MQTT packet terminates the
broker process: every connected client/device/service is dropped, and no new connections are accepted until a
supervisor or operator restarts it. Trivially automatable into a crash-loop against any auto-restarting
deployment (e.g. a container orchestrator restarting the pod), turning a one-shot crash into a sustained
outage.

Remediation

Stop using prototype-inheriting objects for attacker-keyed stores:

  • `client.subscriptions` (`lib/client.js:29`), `client.duplicates` (`lib/client.js:30`), `Aedes.clients`
  • `_dedupe`'s map (`lib/handlers/subscribe.js:68`) is purely local with no API constraint, so it becomes a

Rejecting these names at validation time is not the right fix: `constructor` and `__proto__` are legal
topic filters and Client IDs per [MQTT-3.1.3-4] and [MQTT-4.7], so a blocklist would be a spec violation, and
it cannot cover `Aedes.brokers`, which is keyed off a peer's heartbeat payload rather than client input.

Consumers reading these fields should note the shape change: `broker.clients.hasOwnProperty(id)` now throws
and must become `Object.hasOwn(clients, id)` or `id in clients`. `Object.keys`, `for...in`, `delete`,
`JSON.stringify` and spread are unaffected.

Fix

Fixed in aedes 1.1.3 (commit `9a1686b`). Upgrade with `npm i aedes@^1.1.3`.

The `2.0.0-beta` line is still affected — `2.0.0-beta.0` and `2.0.0-beta.1` are published on npm under the
`beta` dist-tag and carry the unfixed code. There is no patched 2.x release yet. Anyone on the beta should pin
to `1.1.3` until a `2.0.0-beta.2` ships.

Workaround

If you cannot upgrade, reject prototype-inherited names in your `authenticate` and `authorizeSubscribe` hooks.
This is a spec violation (`constructor` and `__proto__` are legal topic filters and Client IDs per [MQTT-3.1.3-4]
and [MQTT-4.7]) and it does not cover Variant 4, which is keyed off a peer broker's `$SYS` payload rather than
client input. Upgrading is the real fix.

Credits

Reported independently by @NotAFlightRisk (SUBSCRIBE variant, 2026-08-22) and @Un-Locksmith
(SUBSCRIBE + CONNECT Client-ID variants, 2026-09-15, originally filed as GHSA-rg6q-h5v9-rjh2 and merged into
this advisory as a duplicate). The UNSUBSCRIBE variant, the `$SYS` cluster-propagation variant and the
`Aedes.brokers` / `client.duplicates` corruption were found by the maintainers during triage.

Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.

Vector CVSS 3.1

Desglose de métricas

Opción resaltada = valor del vector · izquierda = peor caso · GitHub
Vector de ataqueAV:N
RedAdyacenteLocalFísica
ComplejidadAC:L
BajaAlta
PrivilegiosPR:N
NingunoBajosAltos
InteracciónUI:N
NingunaRequerida
AlcanceS:U
CambiadoSin cambio
ConfidencialidadC:N
AltoBajoNinguno
IntegridadI:N
AltoBajoNinguno
DisponibilidadA:H
AltoBajoNinguno
Versiones

Rangos afectados

Afectada Corregida Última
aedes≤ 1.1.2
aedes≥ 2.0.0-beta.0 ≤ 2.0.0-beta.1
1.1.2
1.2.0
2.0.0-beta.0
2.0.0-beta.1
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
npmaedes
Sin parche — — 1.2.0 no afectada
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://github.com/moscajs/aedes/security/advisories/GHSA-52qw-whmv-87c5

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.