Bug 866286 (CVE-2014-0016) - VUL-0: CVE-2014-0016: stunnel: PRNG reseed vulnerability
Summary: VUL-0: CVE-2014-0016: stunnel: PRNG reseed vulnerability
Status: RESOLVED INVALID
Alias: CVE-2014-0016
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents (show other bugs)
Version: unspecified
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Deadline: 2014-03-21
Assignee: Daniel Rahn
QA Contact: Security Team bot
URL:
Whiteboard: . CVSSv2:RedHat:CVE-2014-0017:4.3:(AV...
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-28 13:13 UTC by Marcus Meissner
Modified: 2018-02-15 15:36 UTC (History)
2 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
relevant patch between stunnel 5.00b1 and 5.00 ga (645 bytes, patch)
2014-03-06 16:06 UTC, Marcus Meissner
Details | Diff
Fix for CVE-2014-0016 (458 bytes, patch)
2014-03-07 12:36 UTC, Daniel Rahn
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Comment 4 Swamp Workflow Management 2014-02-28 23:00:18 UTC
bugbot adjusting priority
Comment 5 Marcus Meissner 2014-03-05 06:44:11 UTC
is public now.

Date: Wed, 05 Mar 2014 11:11:07 +0530
From: Huzaifa Sidhpurwala <huzaifas@redhat.com>
Subject: [oss-security] libssh and stunnel PRNG flaws

Hi All,

Aris Adamantiadis reported the following to us:

I have found a vulnerability in stunnel (fork mode) and libssh server
(if implemented with fork) that is similar to problems found in
postgresql [1]. When accepting a new connection, the server forks and
the child process handles the request. The RAND_bytes() function of
openssl doesn't reset its state after the fork, but simply adds the
current process id (getpid) to the PRNG state, which is not guaranteed
to be unique.

stunnel uses libssl, which also seeds the PRNG with the output of
time(NULL), which means that vulnerability has to be exploited under a
second. I have exploit code that can reproduce the issue on OpenBSD 5.4
(thanks to random PIDs) but I think it may be exploitable on other unix
systems as well.

The following CVEs have been assigned:

CVE-2014-0016 stunnel PRNG vulnerability
CVE-2014-0017 libssh PRNG vulnerability

Mitigations implemented into openssl-0.9.8j (2009) makes the
vulnerability not exploitable in stock openssl. The signing code for
ECDSA and DSA explicitly seeds the pool with the digest to sign.


References:

libssh:
https://bugzilla.redhat.com/show_bug.cgi?id=1072191
http://www.libssh.org/2014/03/04/libssh-0-6-3-security-release/
http://git.libssh.org/projects/libssh.git/commit/?id=e99246246b4061f7e71463f8806b9dcad65affa0
stunnel:
https://bugzilla.redhat.com/show_bug.cgi?id=1072180
There is no upstream patch yet
Comment 7 Marcus Meissner 2014-03-06 16:06:15 UTC
Created attachment 581220 [details]
relevant patch between stunnel 5.00b1 and 5.00 ga

this is the diff I think
Comment 11 Daniel Rahn 2014-03-07 12:36:21 UTC
Created attachment 581369 [details]
Fix for CVE-2014-0016

Backported fix for CVE-2014-0016.
Comment 14 Swamp Workflow Management 2014-03-07 13:19:30 UTC
The SWAMPID for this issue is 56563.
This issue was rated as moderate.
Please submit fixed packages until 2014-03-21.
When done, please reassign the bug to security-team@suse.de.
Patchinfo will be handled by security team.
Comment 15 SMASH SMASH 2014-03-07 13:20:12 UTC
Affected packages:

SLE-11-SP3: stunnel
SLE-10-SP3-TERADATA: stunnel
SLE-11-SP2: stunnel
Comment 16 Swamp Workflow Management 2014-03-07 13:24:31 UTC
The SWAMPID for this issue is 56564.
This issue was rated as moderate.
Please submit fixed packages until 2014-03-21.
When done, please reassign the bug to security-team@suse.de.
Patchinfo will be handled by security team.
Comment 25 Daniel Rahn 2014-03-10 09:01:20 UTC
Hm, I don't think we need to update SLE10:

--with-threads=pthreads

(and that's the default if nothing is given)

in other words, stunnel on SLE10 and SLE11 is using pthreads and does not fork.
Verified that on a test system here with a debug patch. Code is not being executed as expected. We are always using pthread threading model, not fork. So #ifdef USE_FORK does not trigger, and the CVE does not apply. The patch effort would only help customers recompiling stunnel with different options. Not sure we should go through the update effort for that.

Marcus, what do you say/think?

For SLES9 I need to find the build logs to be sure.
Comment 26 Daniel Rahn 2014-03-10 09:02:53 UTC
Ok, SLE9 uses pthread, too.
Comment 29 Marcus Meissner 2014-03-14 08:29:42 UTC
resolved