From a07e5d5ece0459e34ea09abb32c59c5140f618ef Mon Sep 17 00:00:00 2001 From: Guillaume Valadon Date: Tue, 24 Sep 2024 23:06:27 +0200 Subject: [PATCH] Fix crash with StreamSocket and TLS (#4535) Co-authored-by: Guillaume Valadon Co-authored-by: gpotter2 <10530980+gpotter2@users.noreply.github.com> --- scapy/layers/tls/session.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scapy/layers/tls/session.py b/scapy/layers/tls/session.py index f7b219a6835..3ac56789e91 100644 --- a/scapy/layers/tls/session.py +++ b/scapy/layers/tls/session.py @@ -1167,6 +1167,8 @@ def tcp_reassemble(cls, data, metadata, session): length = struct.unpack("!H", data[3:5])[0] + 5 if len(data) >= length: # get the underlayer as it is used to populate tls_session + if "original" not in metadata: + return cls(data) underlayer = metadata["original"][TCP].copy() underlayer.remove_payload() # eventually get the tls_session now for TLS.dispatch_hook