Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 584508 (CVE-2016-5117) - <net-misc/openntpd-6.0_p1: OpenNTPD not verifying CN during HTTPS constraints request
Summary: <net-misc/openntpd-6.0_p1: OpenNTPD not verifying CN during HTTPS constraints...
Status: RESOLVED FIXED
Alias: CVE-2016-5117
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: Gentoo Security
URL: http://www.openwall.com/lists/oss-sec...
Whiteboard: B3 [noglsa]
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-30 08:10 UTC by Agostino Sarubbo
Modified: 2016-07-09 01:12 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Add openntpd-6.0_p1 ebuild (0001-net-misc-openntpd-Bump-to-6.0_p1-fix-bug-584508.patch,7.95 KB, patch)
2016-05-31 03:47 UTC, Paul B. Henson
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2016-05-30 08:10:57 UTC
From ${URL} :

Upstream patch:
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.sbin/ntpd/constraint.c.diff?r1=1.27&r2=1.28

Affected versions:
All OpenNTPD versions containing constraints before May 21st 2016 are
affected.
OpenBSD 5.9 is affected.

Description:
OpenNTPD constraints is an experimental functionality to mitigate
NTP man-in-the-middle attacks. When enabled (by default on OpenBSD base
install), it request timestamps from trusted HTTPS servers through HTTP
Date: header and the average of the values obtained are used to filter
out deviating NTP responses.

Common Name verification was disabled while configuring the HTTPS request,
allowing upstream network attackers to intercept and forward the request to
a malicious server that could provide forged timestamp
constraints presenting valid certificates without the server noticing it.

The vulnerable function is httpsdate_init at
/src/usr.sbin/ntpd/constraint.c on OpenBSD source:

[...]
/* XXX we have to pre-resolve, so name and host are not equal */
tls_config_insecure_noverifyname(httpsdate->tls_config);
[...]



@maintainer(s): after the bump, in case we need to stabilize the package, please let us know if it is ready for the stabilization or not.
Comment 1 Paul B. Henson 2016-05-31 03:46:34 UTC
Upstream released 6.0p1 as the official fix, there won't be a 5.9 release with the patch. 6.0p1 includes another fix I was thinking of backporting to 5.9_p1 anyway, so rather than backport that and the security fix to the currently unstable 5.9p1 I've attached a portage patch to add a 6.0p1 ebuild.

I was planning to stabilize 5.9p1 shortly, so after 6.0p1 sits for the requisite 30 days I'm going to look at stabilizing it instead. The bug is only present with USE=libressl, and there is no stable version of libressl, so this bug doesn't currently apply to a stable system in any case.
Comment 2 Paul B. Henson 2016-05-31 03:47:35 UTC
Created attachment 435894 [details, diff]
Add openntpd-6.0_p1 ebuild
Comment 3 Agostino Sarubbo gentoo-dev 2016-05-31 08:22:30 UTC
(In reply to Paul B. Henson from comment #2)
> Created attachment 435894 [details, diff] [details, diff]
> Add openntpd-6.0_p1 ebuild

make a PR?
Comment 4 Kristian Fiskerstrand (RETIRED) gentoo-dev 2016-05-31 08:32:56 UTC
(In reply to Agostino Sarubbo from comment #3)
> (In reply to Paul B. Henson from comment #2)
> > Created attachment 435894 [details, diff] [details, diff] [details, diff]
> > Add openntpd-6.0_p1 ebuild
> 
> make a PR?

a pull request (in particular if referring to a github variant) isn't a requirement for workflow in Gentoo (although I would like to see more use of git request-pull in general).

For review purposes a unified diff to the latest version is often helpful in addition to the ebuild itself though
Comment 5 Paul B. Henson 2016-05-31 08:41:50 UTC
(In reply to Agostino Sarubbo from comment #3)
> (In reply to Paul B. Henson from comment #2)
> > Created attachment 435894 [details, diff] [details, diff] [details, diff]
> > Add openntpd-6.0_p1 ebuild
> 
> make a PR?

I'm a proxy maintainer for openntpd, Ottxor usually commits stuff for me.

I could add a diff between the ebuild versions but it would be empty as pretty much the only change this time around was renaming it :).

Every dev seems to have their own preference for how they want patches to be submitted for packages they maintain, when you mostly submit one offs here and there it's hard to know in advance which way to go.
Comment 6 Christoph Junghans (RETIRED) gentoo-dev 2016-05-31 16:39:46 UTC
For reference, I prefer PR on github as well, but:

commit 3b3cb584e265efd23d1a59c6ef85c3a3eb5407f4
Author: Paul B. Henson <henson@acm.org>
Date:   Mon May 30 20:31:35 2016 -0700

    net-misc/openntpd: Bump to 6.0_p1, fix bug #584508

@security: "All OpenNTPD versions containing constraints before May 21st 2016 are
affected." (CVE-2016-5117). Hence stable openntpd-5.7_p4-r2 is also affected. I think we should quick stabilize openntpd-6.0_p1 (or back-port the patch to openntpd-5.7_p4-r2).
Comment 7 Paul B. Henson 2016-06-01 02:02:48 UTC
(In reply to Christoph Junghans from comment #6)
> For reference, I prefer PR on github as well, but:

Hmm, hadn't heard that before, but so noted.

> affected. I think we should quick stabilize openntpd-6.0_p1 (or back-port
> the patch to openntpd-5.7_p4-r2).

I'd prefer to stabilize openntpd-6.0_p1, I was just about to stabilize 5.9p1, and 6.0_p1 despite the major rev change only has a few differences relative to 5.9p1.From the release announcement:

Changes since OpenNTPD 5.9p1                                                    
============================                                                    
                                                                                
    * Fixed a link failure on older Linux distributions and a build             
      failure on FreeBSD.                                                       
    * Set MOD_MAXERROR to avoid unsynced time status when using                 
      ntp_adjtime.                                                              
    * Fixed HTTP Timestamp header parsing to use strptime in a more             
      portable fashion.                                                         
    * Hardened TLS for ntpd constraints, enabling server name                   
      verification. Thanks to Luis M. Merino.
Comment 8 Agostino Sarubbo gentoo-dev 2016-06-01 11:02:10 UTC
Arches, please test and mark stable:
=net-misc/openntpd-6.0_p1
Target keywords : "alpha amd64 arm hppa ia64 ppc ppc64 sparc x86"
Comment 9 Agostino Sarubbo gentoo-dev 2016-06-01 14:45:27 UTC
amd64 stable
Comment 10 Agostino Sarubbo gentoo-dev 2016-06-01 14:45:53 UTC
x86 stable
Comment 11 Tobias Klausmann (RETIRED) gentoo-dev 2016-06-01 15:18:34 UTC
Stable on alpha.
Comment 12 G.K.MacGregor 2016-06-02 19:45:49 UTC
I don't appear to be able to upgrade to this version...

# emerge -u1 openntpd
Calculating dependencies... done!

>>> Verifying ebuild manifests

!!! Digest verification failed:
!!! /usr/portage/net-misc/openntpd/openntpd-6.0_p1.ebuild
!!! Reason: Filesize does not match recorded size
!!! Got: 2971
!!! Expected: 2972

>>> Emerging (1 of 1) net-misc/openntpd-6.0_p1::gentoo

!!! Digest verification failed:
!!! /usr/portage/net-misc/openntpd/openntpd-6.0_p1.ebuild
!!! Reason: Filesize does not match recorded size
!!! Got: 2971
!!! Expected: 2972

>>> Failed to emerge net-misc/openntpd-6.0_p1
 * 
 * The following package has failed to build, install, or execute postinst:
 * 
 *  (net-misc/openntpd-6.0_p1:0/0::gentoo, ebuild scheduled for merge)
 *
Comment 13 Paul B. Henson 2016-06-03 01:15:36 UTC
I can verify this:

# ls -l /usr/portage/net-misc/openntpd/openntpd-6.0_p1.ebuild
-rw-r--r-- 1 portage portage 2971 Jun  1 08:18 /usr/portage/net-misc/openntpd/openntpd-6.0_p1.ebuild

# grep openntpd-6.0_p1.ebuild /usr/portage/net-misc/openntpd/Manifest 
EBUILD openntpd-6.0_p1.ebuild 2972

Whoever last touched it seems to have left it corrupted.

# tail /usr/portage/net-misc/openntpd/ChangeLog                      

  01 Jun 2016; Agostino Sarubbo <ago@gentoo.org> openntpd-6.0_p1.ebuild:
  x86 stable wrt bug #584508

  Package-Manager: portage-2.2.28
  RepoMan-Options: --include-arches="x86"
  Signed-off-by: Agostino Sarubbo <ago@gentoo.org>

ago? Think you updated the manifest before you marked it stable? That would explain the 1 character size discrepancy :).
Comment 14 Christoph Junghans (RETIRED) gentoo-dev 2016-06-03 02:05:43 UTC
Well, Manifest in git don't include the ebuilds:
https://github.com/gentoo/gentoo/blob/master/net-misc/openntpd/Manifest
Comment 15 Paul B. Henson 2016-06-03 02:12:16 UTC
(In reply to Christoph Junghans from comment #14)
> Well, Manifest in git don't include the ebuilds:
> https://github.com/gentoo/gentoo/blob/master/net-misc/openntpd/Manifest

Umm. Where does it get added then? Is there a broken automated process somewhere?
Comment 16 Jeroen Roovers (RETIRED) gentoo-dev 2016-06-03 03:33:30 UTC
Stable for PPC64.
Comment 17 Markus Meier gentoo-dev 2016-06-04 05:09:38 UTC
arm stable
Comment 18 Jeroen Roovers (RETIRED) gentoo-dev 2016-06-21 11:39:59 UTC
Stable for HPPA.
Comment 19 Agostino Sarubbo gentoo-dev 2016-07-08 07:58:37 UTC
ppc stable
Comment 20 Agostino Sarubbo gentoo-dev 2016-07-08 10:07:09 UTC
sparc stable
Comment 21 Agostino Sarubbo gentoo-dev 2016-07-08 12:06:21 UTC
ia64 stable.

Maintainer(s), please cleanup.
Security, please vote.
Comment 22 Christoph Junghans (RETIRED) gentoo-dev 2016-07-08 15:06:19 UTC
commit 109249d85bf67f406203b8e7ace75e3e0dc62810
Author: Christoph Junghans <ottxor@gentoo.org>
Date:   Fri Jul 8 09:05:25 2016 -0600

    net-misc/openntpd: drop <6 (bug #584508

    Package-Manager: portage-2.2.28
Comment 23 Aaron Bauman (RETIRED) gentoo-dev 2016-07-09 01:12:14 UTC
GLSA Vote: No