Skip to content

Fix Stack Out-of-Bounds Read Issue in ForwardOpen Parsing#587

Open
MrAlaskan wants to merge 1 commit into
EIPStackGroup:masterfrom
MrAlaskan:fix/forward-open-oob-read
Open

Fix Stack Out-of-Bounds Read Issue in ForwardOpen Parsing#587
MrAlaskan wants to merge 1 commit into
EIPStackGroup:masterfrom
MrAlaskan:fix/forward-open-oob-read

Conversation

@MrAlaskan

Copy link
Copy Markdown

Summary

This change fixes an out-of-bounds read in the Forward Open request path by rejecting undersized requests before they reach ConnectionObjectInitializeFromMessage().

Vulnerability Description

A Forward Open or Large Forward Open request can reach the connection object parser without a minimum input length check. A short request may therefore trigger out-of-bounds reads while multiple fixed fields are decoded from the incoming buffer (see #564).

Fix Logic

This fix keeps the change small and localized to source/src/cip/cipconnectionmanager.c.

The fix works as follows:

  1. Preserve whether the current request is Forward Open or Large Forward Open
  2. Reinitialize g_dummy_connection_object to a known empty state before parsing
  3. Enforce a minimum request payload length before calling ConnectionObjectInitializeFromMessage()
  4. Reject undersized requests with kCipErrorNotEnoughData

The minimum lengths used are:

  • 35 bytes for Forward Open
  • 39 bytes for Large Forward Open

After this fix, short requests are rejected at the entry point and no longer reach the unbounded field reads in the connection object initializer.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant