Userland can send a netlink message requesting SOCK_DIAG_BY_FAMILY
with a family greater or equal then AF_MAX -- the array size of
sock_diag_handlers[]. The current code does not test for this
condition therefore is vulnerable to an out-of-bound access opening
doors for a privilege escalation.
Signed-off-by: Mathias Krause <minipli@googlemail.com>
Acked-by: Eric Dumazet <edumazet@google.com>
BUG=chromium-os:39185
TEST=link build, exploit PoC fails
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43867
Reviewed-by: Olof Johansson <olofj@chromium.org>
Change-Id: I4b4e35eed77a39fa7e0415008b8e1a034feacf49
(cherry picked from ToT commit
947e5e383ef70e673a05325830e560119ab2ce3f)
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43872
Reviewed-by: Julien Tinnes <jln@chromium.org>
Reviewed-by: Grant Grundler <grundler@chromium.org>
if (nlmsg_len(nlh) < sizeof(*req))
return -EINVAL;
+ if (req->sdiag_family >= AF_MAX)
+ return -EINVAL;
+
hndl = sock_diag_lock_handler(req->sdiag_family);
if (hndl == NULL)
err = -ENOENT;