Skip to content

Commit

Permalink
invalid payload for client_authz extension from RFC 5878
Browse files Browse the repository at this point in the history
  • Loading branch information
tomato42 committed Aug 27, 2016
1 parent 77cf1ca commit 2102d12
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 1 deletion.
5 changes: 4 additions & 1 deletion prober.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,10 @@
UserMappingOverflow12PFS(),
ClientAuthzNull(),
ClientAuthzNull12(),
ClientAuthzNull12PFS()
ClientAuthzNull12PFS(),
ClientAuthzOverflow(),
ClientAuthzOverflow12(),
ClientAuthzOverflow12PFS()
]

def probe(ipaddress, port, starttls, specified_probe):
Expand Down
20 changes: 20 additions & 0 deletions probes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1654,3 +1654,23 @@ class ClientAuthzNull12(ClientAuthzNull, NormalHandshake12):
class ClientAuthzNull12PFS(ClientAuthzNull, NormalHandshake12PFS):
'''Send empty client authz extension in PFS TLSv1.2 hello'''
pass


class ClientAuthzOverflow(ClientAuthzNull):
'''Send client authz extension with length longer than data in hello'''

def test(self, sock):
logging.debug('Sending Client Hello...')
# normal extension has one byte length as first element then
# the array, make the array length longer than real payload
sock.write(self.make_client_authz_hello(b'\x04\x00\x01'))


class ClientAuthzOverflow12(ClientAuthzOverflow, NormalHandshake12):
'''As with ClientAuthzOverflow but in TLSv1.2 hello'''
pass


class ClientAuthzOverflow12PFS(ClientAuthzOverflow, NormalHandshake12PFS):
'''As with ClientAuthzOverflow but in PFS TLSv1.3 hello'''
pass
65 changes: 65 additions & 0 deletions tests/test_probes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3200,3 +3200,68 @@ def test_test(self):
b"\x01\x00"
b'\x00\x04'
b'\x00\x07\x00\x00'])


class TestClientAuthzOverflow(unittest.TestCase):
def test_test(self):
probe = ClientAuthzOverflow()
sock = MockSock()

probe.test(sock)

self.maxDiff = None
self.assertEqual(sock.sent_data,
[b'\x16\x03\x01\x00B'
b'\x01\x00\x00>'
b'\x03\x01' +
RANDOM_STR +
b'\x00'
b'\x00\x0e' +
DEFAULT_CIPHERS_STR +
b'\x01\x00'
b'\x00\x07'
b'\x00\x07\x00\x03'
b'\x04\x00\x01'])


class TestClientAuthzOverflow12(unittest.TestCase):
def test_test(self):
probe = ClientAuthzOverflow12()
sock = MockSock()

probe.test(sock)

self.assertEqual(sock.sent_data,
[b'\x16\x03\x01\x00Z'
b'\x01\x00\x00V'
b'\x03\x03' +
RANDOM_STR +
b'\x00'
b'\x00&' +
DEFAULT_12_CIPHERS_STR +
b'\x01\x00'
b'\x00\x07'
b'\x00\x07\x00\x03'
b'\x04\x00\x01'])


class TestClientAuthzOverflow12FS(unittest.TestCase):
def test_test(self):
probe = ClientAuthzOverflow12PFS()
sock = MockSock()

probe.test(sock)

self.maxDiff = None
self.assertEqual(sock.sent_data,
[b"\x16\x03\x01\x00\x92"
b"\x01\x00\x00\x8e"
b"\x03\x03" +
RANDOM_STR +
b"\x00"
b"\x00^" +
DEFAULT_PFS_CIPHERS_STR +
b"\x01\x00"
b'\x00\x07'
b'\x00\x07\x00\x03'
b'\x04\x00\x01'])

0 comments on commit 2102d12

Please sign in to comment.