NetBSD Problem Report #57161

From www@netbsd.org  Thu Jan  5 01:05:48 2023
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 61C021A9239
	for <gnats-bugs@gnats.NetBSD.org>; Thu,  5 Jan 2023 01:05:48 +0000 (UTC)
Message-Id: <20230105010516.E144E1A923A@mollari.NetBSD.org>
Date: Thu,  5 Jan 2023 01:05:16 +0000 (UTC)
From: cmeerw@cmeerw.org
Reply-To: cmeerw@cmeerw.org
To: gnats-bugs@NetBSD.org
Subject: "wgconfig wg0 show private-key" shows private key as non-root user
X-Send-Pr-Version: www-1.0

>Number:         57161
>Category:       security
>Synopsis:       "wgconfig wg0 show private-key" shows private key as non-root user
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    security-officer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 05 01:10:00 +0000 2023
>Closed-Date:    Fri Mar 31 10:00:00 +0000 2023
>Last-Modified:  Fri Mar 31 10:00:00 +0000 2023
>Originator:     Christof Meerwald
>Release:        10.0_BETA
>Organization:
>Environment:
NetBSD arm64 10.0_BETA NetBSD 10.0_BETA (GENERIC64) #0: Wed Dec 28 14:38:51 UTC 2022  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/evbarm/compile/GENERIC64 evbarm

>Description:
Checked out the wireguard support in NetBSD and successfully set up a tunnel to route48.org. Everything is working fine, however, when running

  wgconfig wg0 show private-key

as a non-root user it does show the private key for the wireguard tunnel.

  $ id
  uid=1002(test) gid=100(users) groups=100(users)
  $ wgconfig wg0 show private-key
  private-key: ...

>How-To-Repeat:
Configure wireguard with a private key (as root) and then as non-root run "wgconfig wg0 show private-key"

>Fix:

>Release-Note:

>Audit-Trail:
From: "Jonathan A. Kollasch" <jakllsch@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57161 CVS commit: src/sys/net
Date: Thu, 5 Jan 2023 02:38:51 +0000

 Module Name:	src
 Committed By:	jakllsch
 Date:		Thu Jan  5 02:38:51 UTC 2023

 Modified Files:
 	src/sys/net: if_wg.c

 Log Message:
 Check for authorization for SIOCSDRVSPEC and SIOCGDRVSPEC ioctls for wg(4).

 Addresses PR 57161.


 To generate a diff of this commit:
 cvs rdiff -u -r1.71 -r1.72 src/sys/net/if_wg.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->needs-pullups
State-Changed-By: martin@NetBSD.org
State-Changed-When: Thu, 05 Jan 2023 07:14:22 +0000
State-Changed-Why:
netbsd-10 is affected


From: "Jonathan A. Kollasch" <jakllsch@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57161 CVS commit: src/sys
Date: Thu, 5 Jan 2023 18:29:46 +0000

 Module Name:	src
 Committed By:	jakllsch
 Date:		Thu Jan  5 18:29:46 UTC 2023

 Modified Files:
 	src/sys/net: if_wg.c
 	src/sys/secmodel/suser: secmodel_suser.c
 	src/sys/sys: kauth.h

 Log Message:
 wg(4): Allow non-root to retrieve information other than the private
 key and the peer preshared key.

 Add kauth(9) enums for wg(4) and add use them in suser secmodel.

 Refines fix for PR 57161.


 To generate a diff of this commit:
 cvs rdiff -u -r1.72 -r1.73 src/sys/net/if_wg.c
 cvs rdiff -u -r1.56 -r1.57 src/sys/secmodel/suser/secmodel_suser.c
 cvs rdiff -u -r1.88 -r1.89 src/sys/sys/kauth.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: needs-pullups->pending-pullups
State-Changed-By: jakllsch@NetBSD.org
State-Changed-When: Thu, 12 Jan 2023 18:35:48 +0000
State-Changed-Why:
pullup to 10 requsted in ticket 49


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57161 CVS commit: [netbsd-10] src/sys
Date: Fri, 13 Jan 2023 19:14:13 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Fri Jan 13 19:14:13 UTC 2023

 Modified Files:
 	src/sys/net [netbsd-10]: if_wg.c
 	src/sys/secmodel/suser [netbsd-10]: secmodel_suser.c
 	src/sys/sys [netbsd-10]: kauth.h

 Log Message:
 Pull up following revision(s) (requested by jakllsch in ticket #49):

 	sys/secmodel/suser/secmodel_suser.c: revision 1.57
 	sys/sys/kauth.h: revision 1.89
 	sys/net/if_wg.c: revision 1.72
 	sys/net/if_wg.c: revision 1.73
 	sys/net/if_wg.c: revision 1.74

 Check for authorization for SIOCSDRVSPEC and SIOCGDRVSPEC ioctls for wg(4).
 Addresses PR 57161.

 wg(4): Allow non-root to retrieve information other than the private
 key and the peer preshared key.

 Add kauth(9) enums for wg(4) and add use them in suser secmodel.

 Refines fix for PR 57161.

 centralize the kauth ugliness.


 To generate a diff of this commit:
 cvs rdiff -u -r1.71 -r1.71.2.1 src/sys/net/if_wg.c
 cvs rdiff -u -r1.55.20.1 -r1.55.20.2 src/sys/secmodel/suser/secmodel_suser.c
 cvs rdiff -u -r1.87.4.1 -r1.87.4.2 src/sys/sys/kauth.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: pending-pullups->closed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Fri, 31 Mar 2023 10:00:00 +0000
State-Changed-Why:
fixed and pulled up to netbsd-10


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.