|
|
c687bc |
From 89c4300c97739aa3291f0322037bb65068e08d41 Mon Sep 17 00:00:00 2001
|
|
|
c687bc |
From: Jon Maloy <jmaloy@redhat.com>
|
|
|
c687bc |
Date: Tue, 19 Jan 2021 23:34:33 -0500
|
|
|
c687bc |
Subject: [PATCH] Drop bogus IPv6 messages
|
|
|
c687bc |
MIME-Version: 1.0
|
|
|
c687bc |
Content-Type: text/plain; charset=UTF-8
|
|
|
c687bc |
Content-Transfer-Encoding: 8bit
|
|
|
c687bc |
|
|
|
c687bc |
RH-Author: Jon Maloy <jmaloy@redhat.com>
|
|
|
c687bc |
Message-id: <20210119233433.1352902-2-jmaloy@redhat.com>
|
|
|
c687bc |
Patchwork-id: 100695
|
|
|
c687bc |
O-Subject: [RHEL-8.4.0 qemu-kvm PATCH 1/1] Drop bogus IPv6 messages
|
|
|
c687bc |
Bugzilla: 1918054
|
|
|
c687bc |
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
|
c687bc |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
c687bc |
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
|
c687bc |
|
|
|
c687bc |
From: Ralf Haferkamp <rhafer@suse.com>
|
|
|
c687bc |
|
|
|
c687bc |
Drop IPv6 message shorter than what's mentioned in the payload
|
|
|
c687bc |
length header (+ the size of the IPv6 header). They're invalid an could
|
|
|
c687bc |
lead to data leakage in icmp6_send_echoreply().
|
|
|
c687bc |
|
|
|
c687bc |
(cherry picked from libslirp commit c7ede54cbd2e2b25385325600958ba0124e31cc0)
|
|
|
c687bc |
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
|
|
|
c687bc |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
c687bc |
---
|
|
|
c687bc |
slirp/src/ip6_input.c | 7 +++++++
|
|
|
c687bc |
1 file changed, 7 insertions(+)
|
|
|
c687bc |
|
|
|
c687bc |
diff --git a/slirp/src/ip6_input.c b/slirp/src/ip6_input.c
|
|
|
c687bc |
index d9d2b7e9cd4..0f2b17853ad 100644
|
|
|
c687bc |
--- a/slirp/src/ip6_input.c
|
|
|
c687bc |
+++ b/slirp/src/ip6_input.c
|
|
|
c687bc |
@@ -49,6 +49,13 @@ void ip6_input(struct mbuf *m)
|
|
|
c687bc |
goto bad;
|
|
|
c687bc |
}
|
|
|
c687bc |
|
|
|
c687bc |
+ // Check if the message size is big enough to hold what's
|
|
|
c687bc |
+ // set in the payload length header. If not this is an invalid
|
|
|
c687bc |
+ // packet
|
|
|
c687bc |
+ if (m->m_len < ntohs(ip6->ip_pl) + sizeof(struct ip6)) {
|
|
|
c687bc |
+ goto bad;
|
|
|
c687bc |
+ }
|
|
|
c687bc |
+
|
|
|
c687bc |
/* check ip_ttl for a correct ICMP reply */
|
|
|
c687bc |
if (ip6->ip_hl == 0) {
|
|
|
c687bc |
icmp6_send_error(m, ICMP6_TIMXCEED, ICMP6_TIMXCEED_INTRANS);
|
|
|
c687bc |
--
|
|
|
c687bc |
2.27.0
|
|
|
c687bc |
|