Skip to content

fix: avoid never ending loop when peer sends close notify during TLS handshake#142

Closed
felipeek wants to merge 1 commit intowildfly-security:mainfrom
felipeek:FixInfiniteLoopWhenPeerSendsCloseNotify
Closed

fix: avoid never ending loop when peer sends close notify during TLS handshake#142
felipeek wants to merge 1 commit intowildfly-security:mainfrom
felipeek:FixInfiniteLoopWhenPeerSendsCloseNotify

Conversation

@felipeek
Copy link

@felipeek felipeek commented Sep 6, 2024

When acting as a client, if the peer sends a closeNotify message during the TLS handshake, a bug may occur in which wildfly becomes stuck in the unwrap or wrap functions. This happens because the underlying sslEngine.[un]wrap functions eventually return a result with status CLOSED and with 0 bytes consumed, but the caller does not handle it properly, and simply proceed to the next iteration even though no data was consumed.

This issue is easily reproduced by setting up a custom TLS server that forcefully emits closeNotify messages during the handshake, using wildfly engine as a client connection, and observing the behavior.

The proposed modifications seems to fix the issue.

@felipeek
Copy link
Author

felipeek commented Sep 6, 2024

superseded by #143

@felipeek felipeek closed this Sep 6, 2024
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