/

CVE-2026-95843

Severity:

HIGH RISK

(7.5)

Improper Input Validation (CWE-20) in Moquette MQTT

CVE-2026-95843

Analyzed

Vulnerability type

Category:

Improper Input Validation

CWE:

CWE-20

Impact:

Denial of Service

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

A high-severity input validation flaw in Moquette's shared-subscription handling can cause an exception when a client submits an incomplete shared-subscription filter.

A remote MQTT client may trigger denial of service for other sessions assigned to the affected event loop when the malformed input terminates command handling.

Affected context

The issue occurs in Moquette deployments that support MQTT shared subscriptions and process client-supplied subscription filters through the shared-subscription parsing path. Risk is present when an incomplete $share/{shareName}/{topicFilter} structure is processed before the complete format has been validated, allowing an unchecked string operation to raise an exception in a shared session event loop.

Exploit preconditions

  • Attack surface: Remote MQTT subscription handling
  • Required access: Ability to connect to the broker and submit a subscription request
  • Trigger point: Parsing an incomplete shared-subscription filter during subscription processing
  • Why exploitation is possible: The share name is extracted before the full filter structure and required topic-filter portion are validated, allowing malformed input to reach an unsafe string-index operation

Why this happens

The root cause is incomplete validation of a structured, attacker-controlled subscription filter. Moquette attempts to extract the shared-subscription name before confirming that all required path components are present, so malformed input can cause a StringIndexOutOfBoundsException. This behavior maps to CWE-20: Improper Input Validation, because the application does not fully validate input structure before using it.

Potential impact

  • A remote client may cause command handling on an event loop to terminate
  • Other client sessions assigned to the same event loop could experience service disruption
  • Subscription processing may become unavailable for affected connections
  • Repeated malformed requests could contribute to broader broker availability issues

General mitigation guidance

Mitigation generally focuses on validating structured subscription filters before any indexing, extraction, or normalization operation.

Common defensive patterns include:

  • Validating the complete shared-subscription grammar before extracting components
  • Rejecting missing, empty, or malformed topic-filter portions through controlled protocol errors
  • Using bounds-checked parsing routines that cannot raise runtime indexing exceptions for untrusted input
  • Isolating client-specific parsing failures so one malformed request cannot terminate shared event-loop processing
  • Applying connection, request, and subscription-rate limits to reduce repeated malformed-input pressure
  • Running broker processes with only the permissions and network access required for their role

How teams detect issues like this

Organizations can look for this class of issue through:

  • Static analysis rules identifying unchecked string indexing, substring boundaries, and parser operations on network input
  • Code review checks confirming that complete protocol structures are validated before component extraction
  • Negative testing with missing, empty, truncated, and delimiter-only subscription filters
  • Runtime monitoring for repeated subscription parsing exceptions and abnormal event-loop termination
  • Protocol policy enforcement that rejects invalid shared-subscription syntax at the broker boundary

Automated code review and fuzzing tools can help identify malformed-input paths that produce uncaught runtime exceptions.

Sources

SourceLink
github.comgithub.com/moquette-io/moquette/commit/affdc71fdba92dc020421678970ae70518fb6da2
github.comgithub.com/moquette-io/moquette/pull/962
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 remote MQTT client may be able to trigger the issue by submitting a malformed shared-subscription filter, subject to the broker's connection and authorization controls.

Not necessarily. The relevant requirement is the ability to connect and submit subscription requests that reach shared-subscription handling. Deployment-specific authentication and authorization policies may limit this access.

Validate the complete shared-subscription structure before extracting any components, and convert invalid input into a controlled protocol-level rejection rather than allowing an uncaught exception to affect event-loop processing.

Use grammar-aware validation, bounds-safe parsing, malformed-input tests, fuzzing, and isolation of per-client exceptions. Monitoring for repeated parser failures can also help identify attempted abuse.

Find out what's already
exploitable in your codebase.