/

CVE-2026-95846

Severity:

HIGH RISK

(7.5)

Improper Authorization (CWE-862) in Moquette MQTT Broker

CVE-2026-95846

Analyzed

Vulnerability type

Category:

Improper Authorization

CWE:

CWE-862

Impact:

Unauthorized message injection into restricted MQTT topics

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Moquette may publish a client's Last-Will message without enforcing the authorization and reserved-topic checks applied to ordinary MQTT PUBLISH messages. If a client can configure a Will for a restricted topic, an unexpected disconnect may cause the broker to inject an unauthorized message there.

Affected context

The issue occurs in Moquette deployments that process MQTT Last-Will messages when clients disconnect unexpectedly. It becomes risky when authorization policies restrict which topics a client may publish to, but the Will-publication path does not apply the same write-permission and reserved-topic controls as normal publishes.

Exploit preconditions

  • Attack surface: MQTT client connection and Last-Will configuration
  • Required access: A client account or connection permitted to configure a Last-Will message
  • Trigger point: Unexpected client disconnection causing the broker to publish the configured Will
  • Why exploitation is possible: The Will path can bypass normal canWrite authorization and reserved-topic checks

Why this happens

The underlying defect is an authorization inconsistency between two message-publication paths. Normal PUBLISH handling applies topic-write permissions and reserved-topic restrictions, while PostOffice.publishWill can publish the Last-Will message without equivalent checks. This maps to CWE-862: Missing Authorization, because the broker performs a security-sensitive action without verifying whether the client is authorized to perform it.

Potential impact

  • An attacker may inject messages into topics outside their permitted publish scope
  • Applications consuming restricted topics could receive forged or misleading events
  • Security, monitoring, or workflow decisions could be influenced by unauthorized messages
  • Reserved-topic protections may be bypassed through the Last-Will mechanism

General mitigation guidance

Mitigation generally focuses on making Last-Will publication subject to the same authorization policy as ordinary publishing.

Common defensive patterns include:

  • Applying topic-write authorization and reserved-topic checks before publishing any Will message
  • Centralizing publication authorization so alternate message paths cannot bypass policy enforcement
  • Treating client-provided Will topics and payloads as untrusted input
  • Using deny-by-default topic permissions and least-privilege client identities
  • Testing unexpected-disconnect behavior against the same authorization matrix used for normal PUBLISH operations

How teams detect issues like this

Organizations can look for authorization inconsistencies across MQTT publication paths through:

  • Static analysis of Will-handling code for missing permission checks
  • Code review signals where internal publication functions accept client-controlled topics without an authorization decision
  • Tests that compare normal PUBLISH and Last-Will behavior for identical topic permissions
  • Broker audit policies that flag clients publishing to topics outside their assigned scope
  • Automated security review tools that identify alternate execution paths around centralized access-control checks

Sources

SourceLink
github.comgithub.com/moquette-io/moquette/commit/f5a323fe782d1505c0097498cb22eb6ec6c96973
github.comgithub.com/moquette-io/moquette/releases/tag/v0.18.1
github.comgithub.com/moquette-io/moquette/security/advisories/GHSA-5f42-97gr-vfhq

Frequently asked

questions

Yes. A connected MQTT client may be able to exploit the issue through normal protocol interactions if it can configure a Last-Will message and cause an unexpected disconnect.

No. The important prerequisite is client access that permits setting a Will, combined with a publication policy that restricts the selected topic. The attacker does not necessarily need permission to publish directly to that topic.

Ensure that Last-Will publication invokes the same centralized topic authorization and reserved-topic validation used for ordinary PUBLISH messages.

Model every message-publication path in authorization tests, use deny-by-default topic permissions, and review alternate delivery mechanisms for equivalent access-control enforcement.

Find out what's already
exploitable in your codebase.