fix-CVE-2017-6519.patch 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. Upstream-Status: Backport [https://github.com/lathiat/avahi/commit/e111def]
  2. CVE: CVE-2017-6519
  3. Signed-off-by: Kai Kang <kai.kang@windriver.com>
  4. From e111def44a7df4624a4aa3f85fe98054bffb6b4f Mon Sep 17 00:00:00 2001
  5. From: Trent Lloyd <trent@lloyd.id.au>
  6. Date: Sat, 22 Dec 2018 09:06:07 +0800
  7. Subject: [PATCH] Drop legacy unicast queries from address not on local link
  8. When handling legacy unicast queries, ensure that the source IP is
  9. inside a subnet on the local link, otherwise drop the packet.
  10. Fixes #145
  11. Fixes #203
  12. CVE-2017-6519
  13. CVE-2018-1000845
  14. ---
  15. avahi-core/server.c | 8 ++++++++
  16. 1 file changed, 8 insertions(+)
  17. diff --git a/avahi-core/server.c b/avahi-core/server.c
  18. index a2cb19a8..a2580e38 100644
  19. --- a/avahi-core/server.c
  20. +++ b/avahi-core/server.c
  21. @@ -930,6 +930,7 @@ static void dispatch_packet(AvahiServer *s, AvahiDnsPacket *p, const AvahiAddres
  22. if (avahi_dns_packet_is_query(p)) {
  23. int legacy_unicast = 0;
  24. + char t[AVAHI_ADDRESS_STR_MAX];
  25. /* For queries EDNS0 might allow ARCOUNT != 0. We ignore the
  26. * AR section completely here, so far. Until the day we add
  27. @@ -947,6 +948,13 @@ static void dispatch_packet(AvahiServer *s, AvahiDnsPacket *p, const AvahiAddres
  28. legacy_unicast = 1;
  29. }
  30. + if (!is_mdns_mcast_address(dst_address) &&
  31. + !avahi_interface_address_on_link(i, src_address)) {
  32. +
  33. + avahi_log_debug("Received non-local unicast query from host %s on interface '%s.%i'.", avahi_address_snprint(t, sizeof(t), src_address), i->hardware->name, i->protocol);
  34. + return;
  35. + }
  36. +
  37. if (legacy_unicast)
  38. reflect_legacy_unicast_query_packet(s, p, i, src_address, port);