CVE-2026-95846
JSON

8.7high

Moquette publishes Last-Will messages without enforcing write authorization

Severity
8.7high CVSS:4.0 by GitHub_M
Exploit likelihood
0.32% (higher than 26% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-5f42-97gr-vfhq

Description

Moquette is a lightweight Java MQTT broker. Prior to 0.18.1, PostOffice.publishWill publishes a client's Last-Will message without applying the canWrite authorization and reserved-topic checks used for a normal PUBLISH. A client can configure a Will for a topic that the client is not permitted to write and cause the broker to publish the unauthorized message when the client disconnects unexpectedly. This issue allows unauthorized message injection into restricted topics. This issue is fixed in version 0.18.1.

Affected

Product or packageVersionsReported by
moquette-io moquette< 0.18.1CVE List
io.moquette:moquette-broker (Maven)before 0.18.1GitHub Advisory Database
moquette moquettebefore 0.18.1NVD

All scores

GitHub_M8.7high CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N
GitHub9.6critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:N
NVD7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N

Classification

CWE-155CWE-862CWE-863

SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact partial.

What each source says

CVE List

Moquette is a lightweight Java MQTT broker. Prior to 0.18.1, PostOffice.publishWill publishes a client's Last-Will message without applying the canWrite authorization and reserved-topic checks used for a normal PUBLISH. A client can configure a Will for a topic that the client is not permitted to write and cause the broker to publish the unauthorized message when the client disconnects unexpectedly. This issue allows unauthorized message injection into restricted topics. This issue is fixed in version 0.18.1.

GitHub Advisory Database

moquette is reachable by untrusted MQTT clients (anonymous by default), so every byte from any client, including pre-authentication, is untrusted. This is a memory-safe JVM: the ceiling is authorization/ACL bypass + denial of service + cross-session integrity, not RCE (I did not find one and do not claim one). Audited at commit da7f719a6bab9829d520b5838e13ea7b1f9be3ef, module broker/.

What a connecting client can do

  1. (Critical) Bypass pattern-based ACLs across tenants. In AuthorizationsCollector.canDoOperation (AuthorizationsCollector.java:116-131, esp. line 123) the clientId/username is substituted raw into a pattern ACL rule and then wildcard-matched, and the clientId is never validated for MQTT wildcard characters +/# at CONNECT (MQTTConnection.processConnect):

Topic substitutedTopic = new Topic(auth.topic.toString().replace("%c", client).replace("%u", username)); if (topic.match(substitutedTopic)) return true;

A client that connects with clientId + turns sensor/%c/# into the filter sensor/+/#, gaining cross-tenant read AND write. (Precondition: pattern ACL rules configured — a common multi-tenant setup.)

  1. (High) Crash the whole broker. SessionEventLoop (SessionEventLoop.java:40-54) catches only InterruptedException and is never restarted (SessionEventLoopGroup), so any uncaught exception on it wedges every co-located client. Trivially reachable inputs: malformed $share/grp SUBSCRIBE (SharedSubscriptionUtils.extractShareName -> StringIndexOutOfBoundsException), deeply nested topic (CTrie recursion -> StackOverflowError), and ACL NPE below. Unbounded subscriptions / retained / in-flight / topic-alias / interceptor state (BrokerInterceptor uses an unbounded queue) also allow OOM; durable stores allow disk exhaustion.

  2. (High) NPE in ACL sink on clientId # (invalid filter sensor/#/# -> null tokens -> Topic.match NPE at Topic.java:173).

  3. (High) Will-message authorization bypass. Last-Will topic is published (PostOffice.publishWill) without canWrite/reserved-topic checks used for normal PUBLISH.

  4. (Medium) Cross-session durable corruption. H2PersistentQueue opens queue_"+clientId and queue_"+clientId+"_meta; client id sensor_meta collides with victim sensor metadata map -> corrupts head/tail.

  5. (Medium) Fail-open if authenticator/authorizator class fails to load -> PermitAll/AcceptAll (Server.java:483-531).

Proof of concept

Source-only, no network; PoCs run on JDK 17:

  • PoCPatternAcl — clientId + gains cross-tenant read/write; clientId # triggers NPE
  • PoCSharedSubCrash — extractShareName("$share/grp") throws StringIndexOutOfBoundsException
  • PoCMapCollision — H2 MVStore collision overwrites victim metadata pointer

Impact

Cross-tenant eavesdropping and injection, whole-broker DoS, unauthorized Will publishes, and cross-session durable corruption.

Remediation

  1. Reject clientId/username containing +/# (and / if structural) at CONNECT; expand %c/%u as literal tokens.
  2. Harden SessionEventLoop (catch Throwable + restart supervision) and validate $share filters.
  3. Apply authorization to Will publishes like normal PUBLISH.
  4. Add resource caps (connections, queues, retained, aliases, interceptor queue) + bounded session expiry.
  5. Separate H2 namespaces and fail closed on auth-class load failure.

References

https://github.com/moquette-io/moquette/security/advisories/GHSA-5f42-97gr-vfhqexploit, mitigation, vendor-advisory, web
https://github.com/moquette-io/moquette/commit/f5a323fe782d1505c0097498cb22eb6ec6c96973patch, web
https://github.com/moquette-io/moquette/releases/tag/v0.18.1release-notes, web
https://nvd.nist.gov/vuln/detail/CVE-2026-85724advisory
https://github.com/moquette-io/moquette/pull/959web
https://github.com/moquette-io/moquette/pull/958web
https://github.com/moquette-io/moquette/pull/957web
https://github.com/moquette-io/moquette/commit/d77753542e262b7aa573dee3c2b05e44439bbd96web
https://github.com/moquette-io/moquette/commit/ca17e0be19e86d5e291f4532dfdc94616c8e0049web
https://github.com/moquette-io/moquette/commit/c65b3e90fa03e562e2c2fa69c3ee916c2cbfbd2bweb
https://github.com/moquette-io/moquette/commit/b4a98bb3f3425ece476ed073aa080c627c1239afweb
https://github.com/moquette-io/moquette/commit/affdc71fdba92dc020421678970ae70518fb6da2web

Related

Sources

SourceRecordLicence
CVE ListCVE-2026-95846 changed 2026-09-24CVE Terms of Use
GitHub Advisory DatabaseGHSA-5f42-97gr-vfhq changed 2026-10-19CC-BY-4.0
NVDCVE-2026-95846 changed 2026-09-25Public domain