GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — MqttDecoder accepts malformed PINGREQ with non-zero Remaining Length · Issue #16851 · netty/netty

MqttDecoder accepts malformed PINGREQ with non-zero Remaining Length #16851

New issue
Copy link
New issue
Copy link
Closed
#16890
Closed
MqttDecoder accepts malformed PINGREQ with non-zero Remaining Length#16851
#16890
Copy link

Description

@shblue21
shblue21
opened on May 26, 2026
Issue body actions

Expected behavior

This input appears to be a malformed PINGREQ, not a valid PINGREQ followed
by a PINGRESP:

C0 02 D0 00

C0 02 is PINGREQ with Remaining Length 2. PINGREQ has no variable
header or payload, so its Remaining Length must be 0 in both MQTT 3.1.1 and
MQTT 5.0:

  • https://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html
  • https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html

The trailing D0 00 bytes are still inside the malformed PINGREQ frame.
Remaining Length defines the boundary of the current MQTT packet, so those bytes
should not start another packet.

Expected result: one failed MqttMessage for the malformed PINGREQ.

Actual behavior

MqttDecoder can decode the same input as a valid PINGREQ, then a valid
PINGRESP.

The decoder reaches the default branch in decodePayload for messages with no
payload, and returns null without checking that bytesRemainingInVariablePart
is zero. The same path is used by other MQTT message types with no payload, so
this is not specific to PINGREQ.

Netty version

4.1.x, 4.2.x, and 5.0.x.

Activity

  1. daguimu commented on May 27, 2026

    @daguimu
    daguimu
    on May 27, 2026
    Contributor
    More actions

    I'd like to take this. Plan: add a bytesRemainingInVariablePart != 0 check in the no-payload default branch of decodePayload so PINGREQ/PINGRESP/etc. with a non-zero Remaining Length surface a DecoderException instead of silently consuming only the fixed header. Regression test will use your C0 02 D0 00 repro. PR will target 4.1 so auto-port carries it to 4.2/5.0.

  2. chrisvest
    added a commit that references this issue on Jun 1, 2026

    MQTT: Reject malformed no-payload packets with non-zero Remaining Len…

    d89cf88
  3. chrisvest
    closed this as completedin #16890on Jun 2, 2026
  4. violetagg
    added a commit that references this issue on Jun 2, 2026

    Auto-port 4.2: MQTT: Reject malformed no-payload packets with non-zer…

    2394530
  5. chrisvest
    added a commit that references this issue on Jun 4, 2026

    Auto-port 5.0: MQTT: Reject malformed no-payload packets with non-zer…

    e44bb27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.