CVE-2026-71263 PUBLISHED

FreeModbus LINUXTCP Port Off-by-One Global Buffer Overflow in xMBPortTCPPool()

Assigner: TuranSec
Reserved: 05.08.2026 Published: 05.08.2026 Updated: 05.08.2026

The LINUXTCP port of FreeModbus contains an off-by-one bounds check in xMBPortTCPPool() (demo/LINUXTCP/port/porttcp.c). The check if (usTCPFrameBytesLeft > MB_TCP_BUF_SIZE) uses a strict greater-than comparison instead of greater-than-or-equal against the 263-byte MB_TCP_BUF_SIZE limit. An MBAP frame with a Length field of 264 makes usTCPFrameBytesLeft equal to 263, which passes the flawed check, and the subsequent recv() call writes up to 263 bytes starting at buffer offset 7 into the 263-byte static buffer aucTCPBuf, overflowing it by 7 bytes into the adjacent static variable usTCPBufPos. A single crafted, unauthenticated Modbus TCP packet triggers the overflow, since Modbus has no built-in authentication.

Metrics

CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H
CVSS Score: 9.1

Product Status

Vendor cwalter-at
Product FreeModbus
Versions Default: unaffected
  • affected from 0 to * (incl.)

Credits

  • Alibek Baxtiyorov finder

References

Problem Types

  • CWE-787 CWE