BSD TCP/IP广播连接检查漏洞发布时间:2002-03-21 更新时间:2002-03-21 严重程度:低 威胁程度:其它 错误类型:设计错误 利用方式:服务器模式 BUGTRAQ ID:4309 受影响系统 FreeBSD FreeBSD 2.0详细描述 在BSD系统下的TCP/IP实现中存在漏洞,包括FreeBSD, NetBSD 和OpenBSD多种系统台。 RFC1122规定TCP实现需要默默的丢弃地址为广播或者多播地址的进入SYN信息包,有漏洞的BSD实现会基于链路层丢弃该包,而不去检查目的IP地址。 测试代码 尚无 解决方案 Patch for NetBSD (tested): Index: src/sys/netinet/tcp_input.c =================================================================== RCS file: /export/netbsd/ncvs/syssrc/sys/netinet/tcp_input.c,v retrieving revision 1.108.4.10 diff -u -r1.108.4.10 tcp_input.c --- src/sys/netinet/tcp_input.c 24 Jan 2002 22:44:21 -0000 1.108.4.10 +++ src/sys/netinet/tcp_input.c 16 Mar 2002 23:14:14 -0000 @@ -677,7 +677,8 @@ * Make sure destination address is not multicast. * Source address checked in ip_input(). */ - if (IN_MULTICAST(ip->ip_dst.s_addr)) { + if (IN_MULTICAST(ip->ip_dst.s_addr) || + in_broadcast(ip->ip_dst, m->m_pkthdr.rcvif)) { /* XXX stat */ goto drop; } @@ -2183,6 +2184,11 @@ */ if (tiflags & TH_RST) goto drop; + + if (IN_MULTICAST(ip->ip_dst.s_addr) || + in_broadcast(ip->ip_dst, m->m_pkthdr.rcvif)) + goto drop; + { /* * need to recover version # field, which was overwritten on Patch for OpenBSD (untested, problem not verified): Index: src/sys/netinet/tcp_input.c =================================================================== RCS file: /export/openbsd/ncvs/src/sys/netinet/tcp_input.c,v retrieving revision 1.109 diff -u -r1.109 tcp_input.c --- src/sys/netinet/tcp_input.c 15 Mar 2002 18:19:52 -0000 1.109 +++ src/sys/netinet/tcp_input.c 17 Mar 2002 01:08:35 -0000 @@ -1080,8 +1080,6 @@ /* * RFC1122 4.2.3.10, p. 104: discard bcast/mcast SYN - * in_broadcast() should never return true on a received - * packet with M_BCAST not set. */ if (m->m_flags & (M_BCAST|M_MCAST)) goto drop; @@ -1094,7 +1092,8 @@ break; #endif /* INET6 */ case AF_INET: - if (IN_MULTICAST(ip->ip_dst.s_addr)) + if (IN_MULTICAST(ip->ip_dst.s_addr) || + in_broadcast(ip->ip_dst, m->m_pkthdr.rcvif)) { goto drop; break; } @@ -2139,7 +2138,8 @@ break; #endif /* INET6 */ case AF_INET: - if (IN_MULTICAST(ip->ip_dst.s_addr)) + if (IN_MULTICAST(ip->ip_dst.s_addr) || + in_broadcast(ip->ip_dst, m->m_pkthdr.rcvif)) goto drop; } if (tiflags & TH_ACK) { 相关信息 Crist J. Clark <cjclark@alum.mit.edu> 参考:http://online.securityfocus.com/archive/1/262733 http://www.freebsd.org/cgi/query-pr.cgi?pr=35022 |