Received: by 10.223.164.202 with SMTP id h10csp422172wrb; Mon, 6 Nov 2017 08:52:28 -0800 (PST) X-Google-Smtp-Source: ABhQp+QIkoLSJb7ZS54GPxFsxyWdclF5ArvVINPYT23x84eXXg5A8vp1jgP66JTd7F3hbY0vD6tQ X-Received: by 10.99.108.132 with SMTP id h126mr15813102pgc.434.1509987147983; Mon, 06 Nov 2017 08:52:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1509987147; cv=none; d=google.com; s=arc-20160816; b=wRpSxRI9bvOxCp7JosEFUt/Gc1GnnGnuOFHeN99yyD5Vrodpcuw5K6ldssU7HDqCVP Jf/1liabCC2oKMNv25qSVC37qdy5NAyVzPnIINnmvoc4ETk0+3qmL4PzcnqZNv8V3cCh XIvpUq50NTgKbKeNLKQ6x/7IZNtxfwg5eHYTU7Kd1syb7HXBLY4jR2oPb2vwE+Tex1qx ERKLFXo0zZEIVEDVLwPluUtm51IlIT/1JvQ4KN4nA2Dhy2AVQcAR19klAUtueBQ6XhnS Owiio6e6wTiRSMHj0I08MA6lHVhIpd6eE0y//A0p7HgZD4BB4mQ0FqPSJPoRr0nMxqVW U/EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=Kz3nzMAdyBlrkHqrXuSHcUkIEbrX2mpjTnKFd0Tl2L0=; b=MyNOWr1FLv+la7m5MB5CkgX7LftfUnff3LaZQbtmJrWMJ/l303cQV4XSHhzJwiOKiy 6HAJ4frbFrX1zCNZNm2KlR38I5zvSATfviWQSTy2NVyNKOY16YO2IaICz+kzIAp561ZA i/QvcHgOJ37wWNfzwBMV4H24zlRuryHQ/6QLzKnnATJpsctDpw5JZmkX1vDvSuYWZR5+ gUebcOrksekOgeUxmki1sOp8ptJT+HUIhaydB/xISIhYKaapF6pW+ERWwaSwZ8Zp0C1z psEZKWuHExD5J7/kHtAksk6OCD0pyNkY+7rTor/3WV+Y0zabTlBw0qX+bsL8ufxeVt/V g++Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i6si12960108pfd.103.2017.11.06.08.52.13; Mon, 06 Nov 2017 08:52:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932480AbdKFPDI (ORCPT + 97 others); Mon, 6 Nov 2017 10:03:08 -0500 Received: from h2.hallyn.com ([78.46.35.8]:49360 "EHLO h2.hallyn.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753840AbdKFPDE (ORCPT ); Mon, 6 Nov 2017 10:03:04 -0500 Received: by h2.hallyn.com (Postfix, from userid 1001) id 0603D120469; Mon, 6 Nov 2017 09:03:02 -0600 (CST) Date: Mon, 6 Nov 2017 09:03:02 -0600 From: "Serge E. Hallyn" To: Mahesh Bandewar =?utf-8?B?KOCkruCkueClh+CktiDgpKzgpILgpKHgpYfgpLXgpL4=?= =?utf-8?B?4KSwKQ==?= Cc: "Serge E. Hallyn" , Mahesh Bandewar , LKML , Netdev , Kernel-hardening , Linux API , Kees Cook , "Eric W . Biederman" , Eric Dumazet , David Miller Subject: Re: [PATCH resend 2/2] userns: control capabilities of some user namespaces Message-ID: <20171106150302.GA26634@mail.hallyn.com> References: <20171103004436.40026-1-mahesh@bandewar.net> <20171104235346.GA17170@mail.hallyn.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Mahesh Bandewar (महेश बंडेवार) (maheshb@google.com): > On Sat, Nov 4, 2017 at 4:53 PM, Serge E. Hallyn wrote: > > > > Quoting Mahesh Bandewar (mahesh@bandewar.net): > > > Init-user-ns is always uncontrolled and a process that has SYS_ADMIN > > > that belongs to uncontrolled user-ns can create another (child) user- > > > namespace that is uncontrolled. Any other process (that either does > > > not have SYS_ADMIN or belongs to a controlled user-ns) can only > > > create a user-ns that is controlled. > > > > That's a huge change though. It means that any system that previously > > used unprivileged containers will need new privileged code (which always > > risks more privilege leaks through the new code) to re-enable what was > > possible without privilege before. That's a regression. > > > I wouldn't call it a regression since the existing behavior is > preserved as it is if the default-mask is not altered. i.e. > uncontrolled process can create user-ns and have full control inside > that user-ns. The only difference is - as an example if 'something' > comes up which makes a specific capability expose ring-0, so admin can > quickly remove the capability in question from the mask, so that no > untrusted code can exploit that capability until either the kernel is Oh, sorry, I misread then, and missed that step. I thought the default with this patchset was that there were no capabilities exposed to user namespaces. > patched or workloads are sanitized keeping in mind what was > discovered. (I have given some real life example vulnerabilities > published recently about CAP_NET_RAW in the cover letter) > > > I'm very much interested in what you want to do, But it seems like > > it would be worth starting with some automated code analysis that shows > > exactly what code becomes accessible to unprivileged users with user > > namespaces which was accessible to unprivileged users before. Then we > > can reason about classifying that code and perhaps limiting access to > > some of it. > I would like to look at this as 'a tool' that is available to admins > who can quickly take possible-compromise-situation under-control > probably at the cost of some functionality-loss until kernel is > patched and the mask is restored to default value. The thing that makes me hesitate with this set is that it is a permanent new feature to address what (I hope) is a temporary problem. What would you think about doing this as a stackable (yama-style) LSM? > I'm not sure if automated tools could discover anything since these > changes should not alter behavior in any way. Seems like there are two naive ways to do it, the first being to just look at all code under ns_capable() plus code called from there. It seems like looking at the result of that could be fruitful. -serge From 1583300568918795183@xxx Mon Nov 06 07:24:47 +0000 2017 X-GM-THRID: 1583003759650790753 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread