Received: by 10.223.164.200 with SMTP id h8csp856622wrb; Sun, 5 Nov 2017 23:24:47 -0800 (PST) X-Google-Smtp-Source: ABhQp+SSYFAxv09yBrPY+iicSurvFeMGqSG+WhFEJ72KYxQToePaALHyuFkgEP0JwxE05atDzMJl X-Received: by 10.159.249.9 with SMTP id bf9mr14014020plb.383.1509953087762; Sun, 05 Nov 2017 23:24:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1509953087; cv=none; d=google.com; s=arc-20160816; b=g6zxij2IaPqfi5qgCCQ7GxtiKUKLvUcGj3ZnUXOHUvHd69vD8Yf7QR6vGDa7OvNmor xcOU2X2oabDQCkhc/cS6ZhF6L5TKzgJlb+z1Aq1woUHkvoU4UXC481LiAt5+kRtbagER OsVY5nmHfqYZzlmO/0R64KDOz1vtW4tOY6ehKdUQZbjegE+gKZxdaBERcGWMq20x2bmL 4v3qq9NcujMm/y56S04J5mjE4TnlHCGthNEU1hH20dGRf0hNWZbmV7aff9fotZPNv6Gg CF1PWeQNXyc60locLD59J6HYxOdNlQfGTgl8NOEAcoF5cN5aB9PVJ3nAkIZxkCcljXBX Cnwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=Mk5sh+p/LF9pv5QS3zYCZvw35+//YT9e22nGA5LqbIY=; b=lHx8GW/knc8uT7sF4fuiT0d1cr1vsSez2Zsycxn05mluOS/FP2iETRCnyQzPbOnfHS MK4rlrs9cqRfDYYg6u9h5Y87LuZdPTGX/U8nMzUZ9IRw4SpwwgaHjXEgtVQM8lK4ubWf wMcEJlkgAoN95SzGld95R5qC/UQWOeX6GnHIfyAHAZWSydeHV/j6gg1SVX1bDY5TgZos fUABQQeU1faqZVoebjmN2cspbAMEVFfBpOh8VICT6Sw5+4QK1dhKFNFx+FqYr6VG4tRw maiWqxfj8F/+hhdM2Qzfx3S3xMfv+amGUPvEhWxumuZ5jhh8UpVAha+qU+C3DFMolkcB 3QGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=wDxZg3cc; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u19si11636930pfg.51.2017.11.05.23.24.34; Sun, 05 Nov 2017 23:24:47 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=wDxZg3cc; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751534AbdKFHX5 (ORCPT + 99 others); Mon, 6 Nov 2017 02:23:57 -0500 Received: from mail-yw0-f196.google.com ([209.85.161.196]:55851 "EHLO mail-yw0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751092AbdKFHXz (ORCPT ); Mon, 6 Nov 2017 02:23:55 -0500 Received: by mail-yw0-f196.google.com with SMTP id t11so7039228ywg.12 for ; Sun, 05 Nov 2017 23:23:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Mk5sh+p/LF9pv5QS3zYCZvw35+//YT9e22nGA5LqbIY=; b=wDxZg3ccNhMBnJBfnB5dJOD2coZ9yCJ/BJgz8TdEO8niPmX8aipcafm+uZrKezVfYt Te3o6g2G/z0ySagBZvCMMKXf+1sJDSRU0FCXDtAEvDheIMhI834h31Ad3puCjI5Y9KKD e4Gsjg0lcaFk4EpOoV5iuL4g+5xbKEQDrMuQVXH7HgaLfCoO6ZySDuNuPYgQAzbGwRNo 0RF3ACCvXl2C7PoOx6A1nXi5pFxGKi2t05+b7tKIJyUccrOvUcl9DPgNEVL/TLIrrezT uvyHIFwx7aO32o8ncjcDgso+MO91SEktLZtosko/0qS5Lgx5lsvt/+cHaCldOj1EQdnO 7EtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Mk5sh+p/LF9pv5QS3zYCZvw35+//YT9e22nGA5LqbIY=; b=fmkFUVOQnSOVEl/rsgDtY1Z0VeDIO+gw5duLeY+0YYEuF48dbnYwSrv3tpZzk8KsIT kN5pE9Wbf/4wzapf6asx0y/J08A8eptdEj8ixbVMTQeDDB2NXPKRZUNA1ilgjpP0QZQU J0YKgfdVIY1T6C9J/c5GZHf5jjSZeK/jBIgS6JsrYh7KfWOAGx+cyxF9EqEEtPJZkPjq z2kvvDwpHLKapsUeFfHqG/BnYUNv4ncPMDL9R6j+qj8r/sB1eitSzD0VdzuUcn1Vn9d8 YAXXyFXKiTenVLMMLImWHwXdwHbZ0pylIdXclU0QxZLKAoTVR5Hr2zRadQVTOiU2sYZT 7y8g== X-Gm-Message-State: AMCzsaXrheFtJx3lR/52CtbsffNXpcogqP5ElbmlNaybocXh931APyDp coZjokwD3J/INHytrpyh0IwEla30hEfDtXgnaEUHFZEN X-Received: by 10.129.209.9 with SMTP id w9mr9207517ywi.208.1509953034159; Sun, 05 Nov 2017 23:23:54 -0800 (PST) MIME-Version: 1.0 Received: by 10.37.131.198 with HTTP; Sun, 5 Nov 2017 23:23:33 -0800 (PST) In-Reply-To: <20171104235346.GA17170@mail.hallyn.com> References: <20171103004436.40026-1-mahesh@bandewar.net> <20171104235346.GA17170@mail.hallyn.com> From: =?UTF-8?B?TWFoZXNoIEJhbmRld2FyICjgpK7gpLngpYfgpLYg4KSs4KSC4KSh4KWH4KS14KS+4KSwKQ==?= Date: Sun, 5 Nov 2017 23:23:33 -0800 Message-ID: Subject: Re: [PATCH resend 2/2] userns: control capabilities of some user namespaces To: "Serge E. Hallyn" Cc: Mahesh Bandewar , LKML , Netdev , Kernel-hardening , Linux API , Kees Cook , "Eric W . Biederman" , Eric Dumazet , David Miller Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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. I'm not sure if automated tools could discover anything since these changes should not alter behavior in any way. From 1583181746771490562@xxx Sat Nov 04 23:56:10 +0000 2017 X-GM-THRID: 1583003759650790753 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread