Security: TLS I/O doesn't handle SSL_ERROR_WANT_READ / SSL_ERROR_WANT_WRITE #160
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
The TLS wrapping code in
src/shared/protocol.c:68-115andsrc/shared/transport_tls.c:80-100treats anySSL_write/SSL_read/SSL_accept/SSL_connectreturn value<= 0as a fatal error. For non-blocking or partially blocking TLS I/O, OpenSSL may returnSSL_ERROR_WANT_READorSSL_ERROR_WANT_WRITE, which should be retried rather than failing immediately. The current code never callsSSL_get_error(), so benign retry conditions are reported as hard failures.Location
src/shared/protocol.c:77-84—SSL_write()errors are treated as fatal.src/shared/protocol.c:98-109—SSL_read()errors are treated as fatal.src/shared/transport_tls.c:88-97—SSL_accept()/SSL_connect()errors are treated as fatal.Suggested fix
SSL_*call that returns<= 0, callSSL_get_error().SSL_ERROR_WANT_READ/SSL_ERROR_WANT_WRITE, retry the operation with the appropriate file descriptor readiness check (select()/poll()).SSL_ERROR_SYSCALL/SSL_ERROR_SSL, log the error and abort the connection.Severity
Medium
Category
security
This issue was automatically generated by the issue-creator agent.