tintinweb / scapy-ssl_tls

SSL/TLS layers for scapy the interactive packet manipulation tool
GNU General Public License v2.0
418 stars 156 forks source link

`TLSServerECDHParams` incorrectly defined for TLS 1.1 #142

Open alexmgr opened 6 years ago

alexmgr commented 6 years ago

TLSServerECDHParams is defined as:

class TLSServerECDHParams(PacketNoPayload):
    name = "TLS EC Diffie-Hellman Server Params"
    fields_desc = [ByteEnumField("curve_type", TLSECCurveTypes.NAMED_CURVE, TLS_EC_CURVE_TYPES),
                   ShortEnumField("curve_name", TLSSupportedGroup.SECP256R1, TLS_SUPPORTED_GROUPS),
                   XFieldLenField("p_length", None, length_of="p", fmt="!B"),
                   StrLenField("p", '', length_from=lambda x:x.p_length),
                   ShortEnumField("scheme_type", TLSSignatureScheme.RSA_PKCS1_SHA256, TLS_SIGNATURE_SCHEMES),
                   XFieldLenField("sig_length", None, length_of="sig", fmt="!H"),
                   StrLenField("sig", '', length_from=lambda x:x.sig_length)]

which is correct for TLS 1.2 and above. In TLS1.1 and below, there is no scheme_type field. This causes the guess_payload_class heuristics of TLSServerKeyExchange to fail for TLS 1.1 traffic.

TLSServerKeyExchange needs to be made version tolerant.