From 5c7b694854ca5d6901192dde004a74864f0cf6c3 Mon Sep 17 00:00:00 2001 From: Frank Buss <55055211+Frank-Buss@users.noreply.github.com> Date: Tue, 3 Sep 2024 09:22:23 +0200 Subject: [PATCH] Don't crash on invalid certificates (TLS) (#4494) --- scapy/layers/tls/handshake.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scapy/layers/tls/handshake.py b/scapy/layers/tls/handshake.py index 3f5154ecc15..6a5e3834c76 100644 --- a/scapy/layers/tls/handshake.py +++ b/scapy/layers/tls/handshake.py @@ -1006,11 +1006,11 @@ def post_dissection_tls_session_update(self, msg_str): connection_end = self.tls_session.connection_end if connection_end == "client": if self.certs: - sc = [x.cert[1] for x in self.certs] + sc = [x.cert[1] for x in self.certs if hasattr(x, 'cert')] self.tls_session.server_certs = sc else: if self.certs: - cc = [x.cert[1] for x in self.certs] + cc = [x.cert[1] for x in self.certs if hasattr(x, 'cert')] self.tls_session.client_certs = cc