All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] audit: check the length of userspace generated audit records
@ 2020-04-20 21:36 Paul Moore
  2020-04-20 21:56 ` Richard Guy Briggs
  2020-04-21 21:24 ` Paul Moore
  0 siblings, 2 replies; 7+ messages in thread
From: Paul Moore @ 2020-04-20 21:36 UTC (permalink / raw)
  To: linux-audit

Commit 756125289285 ("audit: always check the netlink payload length
in audit_receive_msg()") fixed a number of missing message length
checks, but forgot to check the length of userspace generated audit
records.  The good news is that you need CAP_AUDIT_WRITE to submit
userspace audit records, which is generally only given to trusted
processes, so the impact should be limited.

Cc: stable@vger.kernel.org
Fixes: 756125289285 ("audit: always check the netlink payload length in audit_receive_msg()")
Reported-by: syzbot+49e69b4d71a420ceda3e@syzkaller.appspotmail.com
Signed-off-by: Paul Moore <paul@paul-moore.com>
---
 kernel/audit.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/audit.c b/kernel/audit.c
index b69c8b460341..87f31bf1f0a0 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -1326,6 +1326,9 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
 	case AUDIT_FIRST_USER_MSG2 ... AUDIT_LAST_USER_MSG2:
 		if (!audit_enabled && msg_type != AUDIT_USER_AVC)
 			return 0;
+		/* exit early if there isn't at least one character to print */
+		if (data_len < 2)
+			return -EINVAL;
 
 		err = audit_filter(msg_type, AUDIT_FILTER_USER);
 		if (err == 1) { /* match or error */

--
Linux-audit mailing list
Linux-audit@redhat.com
https://www.redhat.com/mailman/listinfo/linux-audit


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-04-21 21:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-20 21:36 [PATCH] audit: check the length of userspace generated audit records Paul Moore
2020-04-20 21:56 ` Richard Guy Briggs
2020-04-20 23:29   ` Paul Moore
2020-04-20 23:56     ` Lenny Bruzenak
2020-04-21  0:18       ` Richard Guy Briggs
2020-04-21 12:48         ` Steve Grubb
2020-04-21 21:24 ` Paul Moore

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.