refraction-networking / utls

Fork of the Go standard TLS library, providing low-level access to the ClientHello for mimicry purposes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug: `(*Conn).Handshake()` is called upon `(*UConn).Read()`

gaukas opened this issue · comments

This should be considered a high priority bug.

In crypto/tls, upon calling (*Conn).Read(), (*Conn).Handshake() will be called if TLS handshake is not yet performed.

However, UConn in uTLS did not correctly inherit this behavior. By fully inheriting (*Conn).Read(), it also calls (*Conn).Handshake() instead of (*UConn).Handshake(), where the latter is the function performing a uTLS handshake and the former one performs default crypto/tls handshake.

This behavior is not restricted to Read(), but also multiple other functions where UConn directly inherits from Conn.

but basically if you explicitly call UConn.Handshake before UConn.Read you're good right?

but basically if you explicitly call UConn.Handshake before UConn.Read you're good right?

Correct. This issue is more about an inconsistent behavior that when someone switch from crypto/tls to uTLS, where the former does not require an explicit call to Handshake, uTLS may use the default version of handshake if Handshake() is not explicitly called.