From patchwork Fri Dec 7 12:36:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Quantal, Precise, CVE, 1/1] UBUNTU: SAUCE: tools: hv: Netlink source address validation allows DoS Date: Fri, 07 Dec 2012 02:36:53 -0000 From: Luis Henriques X-Patchwork-Id: 204475 Message-Id: <1354883813-7201-2-git-send-email-luis.henriques@canonical.com> To: kernel-team@lists.ubuntu.com From: Tomas Hozza CVE-2012-5532 BugLink: http://bugs.launchpad.net/bugs/1084777 The source code without this patch caused hypervkvpd to exit when it processed a spoofed Netlink packet which has been sent from an untrusted local user. Now Netlink messages with a non-zero nl_pid source address are ignored and a warning is printed into the syslog. Signed-off-by: Tomas Hozza Acked-by: K. Y. Srinivasan Signed-off-by: Greg Kroah-Hartman (cherry-picked from commit 91a8a3052685c61d6061c0b11376edfee9d74f61 git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git) Signed-off-by: Luis Henriques --- tools/hv/hv_kvp_daemon.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c index 2984ffb..60a8e29 100644 --- a/tools/hv/hv_kvp_daemon.c +++ b/tools/hv/hv_kvp_daemon.c @@ -727,13 +727,19 @@ int main(void) len = recvfrom(fd, kvp_recv_buffer, sizeof(kvp_recv_buffer), 0, addr_p, &addr_l); - if (len < 0 || addr.nl_pid) { + if (len < 0) { syslog(LOG_ERR, "recvfrom failed; pid:%u error:%d %s", addr.nl_pid, errno, strerror(errno)); close(fd); return -1; } + if (addr.nl_pid) { + syslog(LOG_WARNING, "Received packet from untrusted pid:%u", + addr.nl_pid); + continue; + } + incoming_msg = (struct nlmsghdr *)kvp_recv_buffer; incoming_cn_msg = (struct cn_msg *)NLMSG_DATA(incoming_msg); hv_msg = (struct hv_kvp_msg *)incoming_cn_msg->data;