diff mbox

[Quantal,Precise,CVE,1/1] UBUNTU: SAUCE: tools: hv: Netlink source address validation allows DoS

Message ID 1354883813-7201-2-git-send-email-luis.henriques@canonical.com
State New
Headers show

Commit Message

Luis Henriques Dec. 7, 2012, 12:36 p.m. UTC
From: Tomas Hozza <thozza@redhat.com>

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 <thozza@redhat.com>
Acked-by:  K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry-picked from commit 91a8a3052685c61d6061c0b11376edfee9d74f61 git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git)
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 tools/hv/hv_kvp_daemon.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Tim Gardner Dec. 7, 2012, 12:50 p.m. UTC | #1
Does userspace have the equivalent of WARN_ON_ONCE() ? This could still 
be a real log stuffer.
Luis Henriques Dec. 7, 2012, 1:19 p.m. UTC | #2
Tim Gardner <tim.gardner@canonical.com> writes:

> Does userspace have the equivalent of WARN_ON_ONCE() ? This could still be a
> real log stuffer.

I don't think syslog has such facility, but if I remember correctly,
it does handle a flood of similar messages by merging them together.

Cheers,
--
Luis
Herton Ronaldo Krzesinski Dec. 7, 2012, 3:23 p.m. UTC | #3

Tim Gardner Dec. 7, 2012, 3:39 p.m. UTC | #4

diff mbox

Patch

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;