diff --git a/prober.py b/prober.py index 7105691..b66002b 100755 --- a/prober.py +++ b/prober.py @@ -164,7 +164,10 @@ OCSPUnderflow12PFS(), DoubleExtension(), DoubleExtension12(), - DoubleExtension12PFS() + DoubleExtension12PFS(), + UserMappingNull(), + UserMappingNull12(), + UserMappingNull12PFS() ] def probe(ipaddress, port, starttls, specified_probe): diff --git a/probes.py b/probes.py index f6914e9..38a1bdd 100644 --- a/probes.py +++ b/probes.py @@ -1583,3 +1583,29 @@ class DoubleExtension12(DoubleExtension, NormalHandshake12): class DoubleExtension12PFS(DoubleExtension, NormalHandshake12PFS): '''Duplicate secure renegotiation extension in PFS TLSv1.2 hello''' pass + + +class UserMappingNull(NormalHandshake): + '''Send empty user mapping extension in hello''' + + def make_user_mapping_ext(self, value): + user_mapping_ext = Extension.create( + extension_type=6, + data=value) + return self.make_hello([user_mapping_ext]) + + def test(self, sock): + logging.debug('Sending Client Hello...') + # extension consists of an array and the array needs at least one + # element, don't send any + sock.write(self.make_user_mapping_ext(b'')) + + +class UserMappingNull12(UserMappingNull, NormalHandshake12): + '''Send empty user mapping extension in TLSv1.2 hello''' + pass + + +class UserMappingNull12PFS(UserMappingNull, NormalHandshake12PFS): + '''Send empty user mapping extension in PFS TLSv1.2 hello''' + pass diff --git a/tests/test_probes.py b/tests/test_probes.py index 66963d0..24b9f9a 100644 --- a/tests/test_probes.py +++ b/tests/test_probes.py @@ -3013,3 +3013,64 @@ def test_test(self): b'\x00' b'\xff\x01\x00\x01' b'\x00']) + + +class TestUserMappingNull(unittest.TestCase): + def test_test(self): + probe = UserMappingNull() + sock = MockSock() + + probe.test(sock) + + self.assertEqual(sock.sent_data, + [b'\x16\x03\x01\x00?' + b'\x01\x00\x00;' + b'\x03\x01' + + RANDOM_STR + + b'\x00' + b'\x00\x0e' + + DEFAULT_CIPHERS_STR + + b'\x01\x00' + b'\x00\x04' + b'\x00\x06\x00\x00']) + + +class TestUserMappingNull12(unittest.TestCase): + def test_test(self): + probe = UserMappingNull12() + sock = MockSock() + + probe.test(sock) + + self.assertEqual(sock.sent_data, + [b'\x16\x03\x01\x00W' + b'\x01\x00\x00S' + b'\x03\x03' + + RANDOM_STR + + b'\x00' + b'\x00&' + + DEFAULT_12_CIPHERS_STR + + b'\x01\x00' + b'\x00\x04' + b'\x00\x06\x00\x00']) + + +class TestUserMappingNull12PFS(unittest.TestCase): + def test_test(self): + probe = UserMappingNull12PFS() + sock = MockSock() + + probe.test(sock) + + self.maxDiff = None + self.assertEqual(sock.sent_data, + [b"\x16\x03\x01\x00\x8f" + b"\x01\x00\x00\x8b" + b"\x03\x03" + + RANDOM_STR + + b"\x00" + b"\x00^" + + DEFAULT_PFS_CIPHERS_STR + + b"\x01\x00" + b'\x00\x04' + b'\x00\x06\x00\x00'])