Red Hat Bugzilla – Bug 1327656
gnutls-serv: closing connection without sending an Alert message
Last modified: 2017-04-20 11:40:15 EDT
Description of problem: Malformed Client Key Exchange messages sent during DHE key exchange are not rejected by server using an Alert message Version-Release number of selected component (if applicable): gnutls-2.8.5-19.el6_7.x86_64 How reproducible: Always Steps to Reproduce: git clone https://github.com/tomato42/tlsfuzzer.git pushd tlsfuzzer git checkout bad-dhe # won't be necessary in future git clone https://github.com/warner/python-ecdsa .python-ecdsa ln -s .python-ecdsa/ecdsa ecdsa git clone https://github.com/tomato42/tlslite-ng.git .tlslite-ng pushd .tlslite-ng git checkout buffered-socket # won't be necessary in future popd ln -s .tlslite-ng/tlslite tlslite popd openssl req -x509 -newkey rsa -keyout localhost.key -out localhost.crt -nodes -batch -subj /CN=localhost gnutls-serv --http -p 4433 --priority NORMAL:+VERS-TLS1.2 --x509keyfile localhost.key --x509certfile localhost.crt --disable-client-cert # in separate terminal PYTHONPATH=tlsfuzzer python tlsfuzzer/scripts/test-dhe-rsa-key-exchange-with-bad-messages.py Actual results: "padded Client Key Exchange" and "invalid dh_Yc value - 8192b" test cases fail with server closing connection without sending an Alert message Expected results: padded Client Key Exchange ... OK invalid dh_Yc value - 8192b ... OK sanity check DHE_RSA_AES_128 ... OK truncated dh_Yc value ... OK Test end successful: 4 failed: 0 Additional info:
Not enough information to triage the bug. Is the bug on gnutls-serv not sending an alert message, or is the bug on some malformed DHE client key exchange message being accepted?
> test cases fail with server [gnutls-serv] closing connection without sending an Alert message
Created attachment 1189225 [details] capture of tls connections I'm unable to use the reproducer in a useful way. The reproducer runs 4 tests, and it is unclear which ones should succeed. In any case, making the server return an alert on all situations does not make the reproducer any happier. All I get is unexpected closure from peer, without any details on what is wrong. padded Client Key Exchange ... Error encountered while processing node <tlsfuzzer.expect.ExpectAlert object at 0x2467810> (child: <tlsfuzzer.expect.ExpectClose object at 0x2467850>) with last message being: None Error while processing Traceback (most recent call last): File "tlsfuzzer/scripts/test-dhe-rsa-key-exchange-with-bad-messages.py", line 137, in main runner.run() File "/root/tlsfuzzer/tlsfuzzer/runner.py", line 152, in run raise AssertionError("Unexpected closure from peer") AssertionError: Unexpected closure from peer invalid dh_Yc value - 8192b ... Error encountered while processing node <tlsfuzzer.expect.ExpectAlert object at 0x24673d0> (child: <tlsfuzzer.expect.ExpectClose object at 0x2467410>) with last message being: None Error while processing Traceback (most recent call last): File "tlsfuzzer/scripts/test-dhe-rsa-key-exchange-with-bad-messages.py", line 137, in main runner.run() File "/root/tlsfuzzer/tlsfuzzer/runner.py", line 152, in run raise AssertionError("Unexpected closure from peer") AssertionError: Unexpected closure from peer
(In reply to Nikos Mavrogiannopoulos from comment #4) > Created attachment 1189225 [details] > capture of tls connections > > I'm unable to use the reproducer in a useful way. The reproducer runs 4 > tests, and it is unclear which ones should succeed. all of them "fail" means "server failed to meet test expected behaviour" > In any case, making the > server return an alert on all situations does not make the reproducer any > happier. All I get is unexpected closure from peer, without any details on > what is wrong. it's expecting an alert message while the connection is closed during reading. from packet capture, it looks like the alert is sent after few seconds, not immediately > padded Client Key Exchange ... > Error encountered while processing node <tlsfuzzer.expect.ExpectAlert object > at 0x2467810> (child: <tlsfuzzer.expect.ExpectClose object at 0x2467850>) > with last message being: None > Error while processing > Traceback (most recent call last): > File "tlsfuzzer/scripts/test-dhe-rsa-key-exchange-with-bad-messages.py", > line 137, in main > runner.run() > File "/root/tlsfuzzer/tlsfuzzer/runner.py", line 152, in run > raise AssertionError("Unexpected closure from peer") > AssertionError: Unexpected closure from peer > > > invalid dh_Yc value - 8192b ... > Error encountered while processing node <tlsfuzzer.expect.ExpectAlert object > at 0x24673d0> (child: <tlsfuzzer.expect.ExpectClose object at 0x2467410>) > with last message being: None > Error while processing > Traceback (most recent call last): > File "tlsfuzzer/scripts/test-dhe-rsa-key-exchange-with-bad-messages.py", > line 137, in main > runner.run() > File "/root/tlsfuzzer/tlsfuzzer/runner.py", line 152, in run > raise AssertionError("Unexpected closure from peer") > AssertionError: Unexpected closure from peer
(In reply to Hubert Kario from comment #5) > (In reply to Nikos Mavrogiannopoulos from comment #4) > > Created attachment 1189225 [details] > > capture of tls connections > > > > I'm unable to use the reproducer in a useful way. The reproducer runs 4 > > tests, and it is unclear which ones should succeed. > > all of them How can I run only one test?
for now, you can comment out the line that adds the specific test (conversation) to the array of tests to run (conversations), for this test those are lines 53, 79, 103, 125
I've updated the test case in the client-hello-fuzzing branch, you can run a single test from it by just specifying its name, like so: PYTHONPATH=tlsfuzzer python tlsfuzzer/scripts/test-dhe-rsa-key-exchange-with-bad-messages.py 'padded Client Key Exchange' there's also ability to change the host using -h and the port using -p, like so: PYTHONPATH=tlsfuzzer python tlsfuzzer/scripts/test-dhe-rsa-key-exchange-with-bad-messages.py -h 192.168.0.1 -p 443
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHSA-2017-0574.html