From 8d51adae9608ba5bdc6d0ac547eb2554ce88f966 Mon Sep 17 00:00:00 2001 From: Hubert Kario Date: Mon, 15 Aug 2016 10:53:24 +0200 Subject: [PATCH] add probes for srp extension from RFC 5054 --- prober.py | 8 +++++++- probes.py | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/prober.py b/prober.py index fb421fa..6ea8fb7 100755 --- a/prober.py +++ b/prober.py @@ -206,7 +206,13 @@ ECPointFormatsOverflow12PFS(), ECPointFormatsCompOnly(), ECPointFormatsCompOnly12(), - ECPointFormatsCompOnly12PFS() + ECPointFormatsCompOnly12PFS(), + SRPNull(), + SRPNull12(), + SRPNull12PFS(), + SRPOverflow(), + SRPOverflow12(), + SRPOverflow12PFS() ] def probe(ipaddress, port, starttls, specified_probe): diff --git a/probes.py b/probes.py index 678649e..288d357 100644 --- a/probes.py +++ b/probes.py @@ -1884,3 +1884,47 @@ class ECPointFormatsCompOnly12PFS(ECPointFormatsCompOnly, NormalHandshake12PFS): '''As with ECPointFormatsCompOnly but in PFS TLS v1.2 hello''' pass + + +class SRPNull(NormalHandshake): + '''Send empty srp extension in hello''' + + def make_srp_hello(self, value): + srp_ext = Extension.create( + extension_type=12, + data=value) + return self.make_hello([srp_ext]) + + def test(self, sock): + logging.debug('Sending Client Hello...') + # normally the extension has client's identity, don't include any + sock.write(self.make_srp_hello(b'')) + + +class SRPNull12(SRPNull, NormalHandshake12): + '''Send empty srp extension in TLSv1.2 hello''' + pass + + +class SRPNull12PFS(SRPNull, NormalHandshake12PFS): + '''Send empty srp extension in PFS TLSv1.2 hello''' + pass + + +class SRPOverflow(SRPNull): + '''Send srp extension with too large length in hello''' + + def test(self, sock): + logging.debug('Sending Client Hello...') + # first byte is the length, send too large + sock.write(self.make_srp_hello(b'\x06test')) + + +class SRPOverflow12(SRPOverflow, NormalHandshake12): + '''Send srp extension with too large length in TLSv1.2 hello''' + pass + + +class SRPOverflow12PFS(SRPOverflow, NormalHandshake12PFS): + '''Send srp extension with too large length in PFS TLSv1.2 hello''' + pass