Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1327656 - gnutls-serv: closing connection without sending an Alert message
gnutls-serv: closing connection without sending an Alert message
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: gnutls (Show other bugs)
6.8
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Nikos Mavrogiannopoulos
Hubert Kario
:
Depends On:
Blocks: 1343211 1339222 1444127
  Show dependency treegraph
 
Reported: 2016-04-15 10:51 EDT by Hubert Kario
Modified: 2017-04-20 11:40 EDT (History)
2 users (show)

See Also:
Fixed In Version: gnutls-2.12.23-5.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1444127 (view as bug list)
Environment:
Last Closed: 2017-03-21 05:03:39 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
capture of tls connections (13.27 KB, application/octet-stream)
2016-08-09 07:45 EDT, Nikos Mavrogiannopoulos
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2017:0574 normal SHIPPED_LIVE Moderate: gnutls security, bug fix, and enhancement update 2017-03-21 08:23:04 EDT

  None (edit)
Description Hubert Kario 2016-04-15 10:51:26 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:
Comment 1 Nikos Mavrogiannopoulos 2016-05-26 03:43:04 EDT
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?
Comment 2 Hubert Kario 2016-05-26 06:17:54 EDT
> test cases fail with server [gnutls-serv] closing connection without sending an Alert message
Comment 4 Nikos Mavrogiannopoulos 2016-08-09 07:45 EDT
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
Comment 5 Hubert Kario 2016-08-22 10:06:59 EDT
(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
Comment 6 Nikos Mavrogiannopoulos 2016-08-23 03:51:59 EDT
(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?
Comment 8 Hubert Kario 2016-08-23 13:32:28 EDT
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
Comment 9 Hubert Kario 2016-10-12 12:26:22 EDT
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
Comment 14 errata-xmlrpc 2017-03-21 05:03:39 EDT
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

Note You need to log in before you can comment on or make changes to this bug.