Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3300916yba; Tue, 16 Apr 2019 08:36:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqzCzgSfbioz82WkfcWofRY91lG6LWKXUV2z98H/lbej0upGLyHBi0Rf5ddETxx7ZIq/y9da X-Received: by 2002:a63:b64:: with SMTP id a36mr78144501pgl.58.1555428973306; Tue, 16 Apr 2019 08:36:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555428973; cv=none; d=google.com; s=arc-20160816; b=JNQoy/upJGuni/BBMKfqAWcLgIpT9ZrszrIR2nG3h9PeD24LKyVDgFvS1+cihcUyqO jc8h8dgy1ZyqeRr8HEC+mLdsyu3DxQJegxy//si/lECSNom2gVDEq7JFvTjCf/ODsTNW 9JterRKkm7sVxiJt6EkCJXDhwqfhzBwvlfN8EjBHSxYSZpjdPCWpHem4nSUzywZIbLyn boQzj+BrfRWH99sxxnOo7BOhk0YMHye36KmsP6VHyToD4KaikO//AQRa109jjfKbssOE VyPhzjOqFnSOWjmyMe8qDreJL35kKhjz7mEnpkmrrNQrq2KZeHXEZAFBlg7L7RWbi5cX COCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:organization:message-id:date:subject:cc:to :from; bh=k0TYO1nZucRK8iv8EkkIYu9M9chUeRitUwkEcl5gJuE=; b=r9FuhlD7TrRmNsuSIEXeZU8gOlF3dVa6XkK7Bmd2tGfcz88nDyYtjY31qqcg6yeNN9 36vkhMQ2jqSFSTErTDgpPq3xownbt58ZBT4KtwwVj+6YRDyyGVvaeykBMdg47qx8uBdb pwJPr3uQd3MP+nZs2kBvOKmHGzOzaqsBqQ3YCzn8hhAj2VbyQwhxXBN1TodUf0QtWL0X e/NlJPoHXv+IkEQx2M++qM3Kn3RPcJ6LSlCwewDA+aCvl8r+AGAeJf8G8y2PvPCeM6yo 6/xkxBvh+WOYFcjrosbFxFtRHkDi043Aqlx257AjlfXhhL2C1uwpjFd8v4nLWLIs84Xb h5Hg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v21si48317351plo.34.2019.04.16.08.35.56; Tue, 16 Apr 2019 08:36:13 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729915AbfDPPeX (ORCPT + 99 others); Tue, 16 Apr 2019 11:34:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51466 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726713AbfDPPeW (ORCPT ); Tue, 16 Apr 2019 11:34:22 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C6B678665D; Tue, 16 Apr 2019 15:34:15 +0000 (UTC) Received: from x2.localnet (ovpn-120-96.rdu2.redhat.com [10.10.120.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2000919C7D; Tue, 16 Apr 2019 15:34:09 +0000 (UTC) From: Steve Grubb To: Florian Weimer Cc: Jan Kara , =?ISO-8859-1?Q?Micka=EBl_Sala=FCn?= , linux-kernel@vger.kernel.org, Al Viro , James Morris , Jonathan Corbet , Kees Cook , Matthew Garrett , Michael Kerrisk , =?ISO-8859-1?Q?Micka=EBl_Sala=FCn?= , Mimi Zohar , Philippe =?ISO-8859-1?Q?Tr=E9buchet?= , Shuah Khan , Thibaut Sautereau , Vincent Strubel , Yves-Alexis Perez , kernel-hardening@lists.openwall.com, linux-api@vger.kernel.org, linux-security-module@vger.kernel.org, linux-fsdevel@vger.kernel.org, Matthew Bobrowski Subject: Re: [RFC PATCH v1 1/5] fs: Add support for an O_MAYEXEC flag on sys_open() Date: Tue, 16 Apr 2019 11:34:07 -0400 Message-ID: <2361288.r9sZr2NHLB@x2> Organization: Red Hat In-Reply-To: <87wojuxj8s.fsf@oldenburg2.str.redhat.com> References: <20181212081712.32347-1-mic@digikod.net> <3452959.b6JmBh7Lnt@x2> <87wojuxj8s.fsf@oldenburg2.str.redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 16 Apr 2019 15:34:22 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday, April 16, 2019 7:49:39 AM EDT Florian Weimer wrote: > * Steve Grubb: > > This flag that is being proposed means that you would have to patch all > > interpreters to use it. If you are sure that upstreams will accept that, > > why not just change the policy to interpreters shouldn't execute > > anything unless the execute bit is set? That is simpler and doesn't need > > a kernel change. And setting the execute bit is an auditable event. > > I think we need something like O_MAYEXEC so that security policies can > be enforced and noexec mounts can be detected. Application whitelisting can already today stop unknown software without needing O_MAYEXEC. > I don't think it's a good idea to do this in userspace, especially the > latter. The problem is that passing O_MAYEXEC is opt-in. You can use ptrace/seccomp/ bpf/LD_PRELOAD/LD_AUDIT to remove that bit from an otherwise normal program. This does not require privs to do so. But let's consider that this comes to pass and every interpreter is updated and IMA can see the O_MAYEXEC flag. Attackers now simply pivot to running programs via stdin. It never touches disk and therefore nothing enforces security policy. This already is among the most common ways that malware runs today to evade detection. -Steve