Skip to content

EDPStatic: out-of-range entity ID octets are silently truncated instead of rejected #6595

Open

Description

@lkloliver

Is there an already existing issue for this?

  • I have searched the existing issues

Expected behavior

Commit 65010b2 ("Improve validation of EDP static properties") states in its code
comment that after the change "any other malformed input (consecutive dots,
leading/trailing dots, non-numeric characters...) is rejected instead of being silently
accepted".

Expected: an entity ID string containing an octet outside the 0-255 range, such as
300.0.0.4, 256.0.0.4, or -1.0.0.4, is rejected the same way consecutive dots or
non-numeric characters are, since it cannot represent a valid EntityId_t.

Current behavior

The four octets are parsed into int and then cast to octet with no range check, in
both property formats (legacy eProsimaEDPStatic_* and the EDS_* format added by
65010b2):

src/cpp/rtps/builtin/discovery/endpoint/EDPStatic.cpp, EDPStaticProperty::fromProperty
(~line 483 legacy branch, ~line 549 EDS_ branch):

ss >> a >> ch >> b >> ch >> c >> ch >> d;
bool success = !ss.fail() && ss.eof();
if (success) { m_entityId.value[0] = (octet)a; ... }

Out-of-range values are silently truncated (mod 256) into a different, valid entity ID:

"0.0.1.300"   -> accepted, becomes 0.0.1.44
"0.0.1.-1"    -> accepted, becomes 0.0.1.255
"0.0.1.256"   -> accepted, becomes 0.0.1.0
"0.0.1.999999"-> accepted, becomes 0.0.1.63

No warning or log is emitted. The truncated ID is then used as-is by
EDPStatic::assignRemoteEndpoints / newRemoteReader to synthesize the remote endpoint, so
a peer announcing such a value gets paired under a different entity ID than the string
says — for a configuration typo this can silently pair the wrong endpoint or silently
fail to pair, with nothing to diagnose.

Steps to reproduce

  1. Parser level (same statement as fromProperty, deterministic):

    std::stringstream ss; ss << "300.0.0.4";
    int a, b, c, d; char ch;
    ss >> a >> ch >> b >> ch >> c >> ch >> d;
    bool success = !ss.fail() && ss.eof();   // true
    // (octet)a == 44
    
  2. End-to-end (master, static EDP):

    • Participant created with use_SIMPLE_EndpointDiscoveryProtocol = false,
      use_STATIC_EndpointDiscoveryProtocol = true, exchange format v1, and a static XML
      declaring remote participant "attacker" reader userId=1, entityID=4, on the local
      writer's topic. A DataWriterListener prints the matched remote reader's entity ID.
    • Send one SPDP DATA(p) UDP packet to the discovery port carrying
      PID_PROPERTY_LIST (0x0059) with property
      eProsimaEDPStatic_Reader_ALIVE_ID_1 = 300.0.0.4.
    • Observed: publication matched, remote reader entity ID = 2c.00.00.04 (44), i.e.
      the out-of-range announcement was accepted and paired under the truncated ID.
    • Control 1: value 0.0.0.4 -> matched, entity ID 00.00.00.04.
    • Control 2: value 1.2.3.4.5 -> no match (correctly rejected, as intended by
      65010b2).

Fast DDS version/commit

master @ 51521ef (2026-10-20). The unguarded (octet) cast predates the hardening, but
65010b2 (2026-09-10, currently master-only) is the commit whose comment claims
malformed input is rejected, so the gap is most visible there.

Platform/Architecture

Other. Please specify in Additional context section.

Transport layer

UDPv4

Additional context

Linux x86_64 (Ubuntu 22.04 container)

XML configuration file

Relevant log output

Network traffic capture

No response

Activity

  1. added
    triage
    on Oct 25, 2026
  2. added a commit that references this issue on Oct 30, 2026
    5742b93
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

    triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions