diff options
author | Paul Moore <paul@paul-moore.com> | 2020-04-20 16:24:34 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-04-29 16:33:18 +0200 |
commit | 83f82fd5552c91f4f01921428c871dc8d82abccf (patch) | |
tree | c3827f1558bbf0e1d2e7e6f318eef11b90838454 /kernel | |
parent | 20821047aca466571b81e04cc24e2944564ecc86 (diff) | |
download | linux-stable-83f82fd5552c91f4f01921428c871dc8d82abccf.tar.gz linux-stable-83f82fd5552c91f4f01921428c871dc8d82abccf.tar.bz2 linux-stable-83f82fd5552c91f4f01921428c871dc8d82abccf.zip |
audit: check the length of userspace generated audit records
commit 763dafc520add02a1f4639b500c509acc0ea8e5b upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/audit.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/audit.c b/kernel/audit.c index dfc45063cb56..fcfbb3476ccd 100644 --- a/kernel/audit.c +++ b/kernel/audit.c @@ -1325,6 +1325,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 */ |