Skip to content

Validate WebSocket frames against RFC 6455 malformed payloads (Issue #5506) - #5507

Open
Prit44421 wants to merge 1 commit into
pocoproject:develfrom
Prit44421:fix-websocket-opcode-5506
Open

Prit44421 wants to merge 1 commit into
pocoproject:develfrom
Prit44421:fix-websocket-opcode-5506

Conversation

@Prit44421

Copy link
Copy Markdown

Draft fix for #5506.

I reproduced the vulnerability locally using a raw TCP socket script, which confirmed receiveFrame was bypassing RFC validations. I've added strict validations in WebSocketImpl.cpp to catch:

Reserved opcodes
Non-zero RSV bits
Control frame fragmentation & payload limits
Masking direction (_mustMaskPayload)
The core logic successfully catches and rejects the malformed frames locally.

Also I had an Architectural question, I know that RFC 6455 requires failing the connection for non-zero RSV bits unless an extension is negotiated. Currently, I am rejecting all non-zero RSV bits. Does Poco natively track if a specific WebSocket extension was negotiated during the handshake so I can selectively allow RSV bits, or is a blanket rejection acceptable for our current scope?

Also, could a maintainer point me to the best file in Net/testsuite to add the unit tests for these specific framing errors? I'll get those added before marking this ready for review.

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