Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp6977134ybn; Mon, 30 Sep 2019 06:51:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqwzHUul/RHQ5i9qGfDX8w+XpLuE54Fduk+TBeXDYadT7xJEP0+S7w6oaC92Ql7BIP55DlJq X-Received: by 2002:a17:907:41db:: with SMTP id og19mr19556787ejb.307.1569851473597; Mon, 30 Sep 2019 06:51:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569851473; cv=none; d=google.com; s=arc-20160816; b=uZM5AB+T4vZfi9d/zoJvcTnLTkpvC98rqaWN3vYHBSDOSlgnLrCufIkiB1aFBpu9ed tsynaCokwS3lI6rEB/dogvT85yMpC1ZTYQCjRGcz+lJOPj5Z+zmz3q4tz8bg9Q5r/FEG t6Mp2THfFduE5K8SV/zN7rO2I482Fduhs/GTDAw59+UpxfS+8jkSWWlLi9eS14AptFbY vDQRWzinDHFcnR5Fw1VOkNaPllls7tTF7y9WEluqyX4Ulgo6+HqqJU9InwmPOD03d85M sjBA1Yvc/nIMZyEUsFSOSzqyQlNP+achHODRNuTcYbj5qrUdBlMEQTzHGUX2p1VsIuTd v1Vg== 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=304MHP84qSi0lRA41pHn8CHKRLOuMCOZILddbfLfue0=; b=enO/0PfM5I1lzALZNrJb/P8WMxLQJz1UTMi9nXtqwqveP3VFFhJiR+QNxh7+W4JNv0 Iq8+Qz1jnmOuzHmr74+qMCEPbNPFNU9D5u8W3LUKI2AyxmBBegJ1YaFu+F38IKsHjzKd NHKiIOg9+8nn+NiBlHybFx0GOEhEZifvvIoaii1tZDsYPT1ufV6sfYpDE340IGI0QegQ Xlwnz5hrzbRkgLcjXdK+pRkIQX35kmyyIaoT5CAOnRCMsvWUEIpWAF463+q92XB+BM/w 0YI4b13mK4pOTtiwyclKTVao7QiBMDWhREalinGKDRNGhtF8peg1Gi3WhljNkWmpcv2e HLrw== 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 z14si6856055ejw.396.2019.09.30.06.50.47; Mon, 30 Sep 2019 06:51: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 S1731174AbfI3NuS convert rfc822-to-8bit (ORCPT + 99 others); Mon, 30 Sep 2019 09:50:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58051 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730583AbfI3NuS (ORCPT ); Mon, 30 Sep 2019 09:50:18 -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 4AEE33082E10; Mon, 30 Sep 2019 13:50:17 +0000 (UTC) Received: from x2.localnet (ovpn-117-72.phx2.redhat.com [10.3.117.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id A7D0E261D1; Mon, 30 Sep 2019 13:50:01 +0000 (UTC) From: Steve Grubb To: Paul Moore Cc: Kees Cook , linux-kernel@vger.kernel.org, =?ISO-8859-1?Q?J=E9r=E9mie?= Galarneau , s.mesoraca16@gmail.com, viro@zeniv.linux.org.uk, dan.carpenter@oracle.com, akpm@linux-foundation.org, Mathieu Desnoyers , kernel-hardening@lists.openwall.com, linux-audit@redhat.com, Linus Torvalds Subject: Re: [PATCH] audit: Report suspicious O_CREAT usage Date: Mon, 30 Sep 2019 09:50:00 -0400 Message-ID: <2065829.xbNJnTdZ4q@x2> Organization: Red Hat In-Reply-To: References: <201909251348.A1542A52@keescook> MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset="iso-8859-1" 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.46]); Mon, 30 Sep 2019 13:50:17 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday, September 26, 2019 11:31:32 AM EDT Paul Moore wrote: > On Wed, Sep 25, 2019 at 5:02 PM Kees Cook wrote: > > This renames the very specific audit_log_link_denied() to > > audit_log_path_denied() and adds the AUDIT_* type as an argument. This > > allows for the creation of the new AUDIT_ANOM_CREAT that can be used to > > report the fifo/regular file creation restrictions that were introduced > > in commit 30aba6656f61 ("namei: allow restricted O_CREAT of FIFOs and > > regular files"). Without this change, discovering that the restriction > > is enabled can be very challenging: > > https://lore.kernel.org/lkml/CA+jJMxvkqjXHy3DnV5MVhFTL2RUhg0WQ-XVFW3ngDQO > > dkFq0PA@mail.gmail.com > > > > Reported-by: J?r?mie Galarneau > > Signed-off-by: Kees Cook > > --- > > This is not a complete fix because reporting was broken in commit > > 15564ff0a16e ("audit: make ANOM_LINK obey audit_enabled and > > audit_dummy_context") > > which specifically goes against the intention of these records: they > > should _always_ be reported. If auditing isn't enabled, they should be > > ratelimited. > > > > Instead of using audit, should this just go back to using > > pr_ratelimited()? > > I'm going to ignore the rename and other aspects of this patch for the > moment so we can focus on the topic of if/when/how these records > should be emitted by the kernel. > > Unfortunately, people tend to get very upset if audit emits *any* > records when they haven't explicitly enabled audit, the significance > of the record doesn't seem to matter, which is why you see patches > like 15564ff0a16e ("audit: make ANOM_LINK obey audit_enabled and > audit_dummy_context"). We could consider converting some records to > printk()s, rate-limited or not, but we need to balance this with the > various security certifications which audit was created to satisfy. > In some cases a printk() isn't sufficient. > > Steve is probably the only one who really keeps track of the various > auditing requirements of the different security certifications; what > say you Steve on this issue with ANOM_CREAT records? Common Criteria and other security standards I track do not call out for anomoly detection. So, there are no requirements on this. That said, we do have other anomaly detections because they give early warning that something strange is happening. I think adding this event is a nice improvement as long as it obeys audit_enabled before emitting an event - for example, look at the AUDIT_ANOM_ABEND event. -Steve