FTP iptables vulnerability in 2.4 kernel

김정균의 이미지

커널 2.4 의 netfilter 에 보안 버그가 있습니다 :-)

iptables 를 이용해 방화벽을 구성하는 예가 요즘 많이 있는것 같던데.. 주의 하십시오. iptables 를 사용할때 firewall 을 통해 FTP "RELATED" 접속을 허용할 경우 임의의 규칙을 추가시킬수 있는 버그라고 하더군요 :-)

커널 2.4.4 에서 패치가 되어 있으니 2.4 커널을 사용하시는 분들은 커널 업을 권장합니다. 또는 다음의 패치를 이용할수 있습니다.

참고 문서
http://www.tempest.com.br/advisories/01-2001.html
http://www.securityfocus.com/templates/archive.pike?list=1&mid=177070
http://slashdot.org/comments.pl?sid=01/04/19/047249&cid=36

diff -urN linux-2.4.3.orig/net/ipv4/netfilter/ip_conntrack_ftp.c linux/net/ipv4/netfilter/ip_conntrack_ftp.c
- --- linux-2.4.3.orig/net/ipv4/netfilter/ip_conntrack_ftp.c Fri Aug 11 05:35:15 2000
+++ linux/net/ipv4/netfilter/ip_conntrack_ftp.c Mon Apr 16 02:18:30 2001
@@ -187,7 +187,12 @@
(int)matchlen, data + matchoff,
matchlen, ntohl(tcph->seq) + matchoff);

- - /* Update the ftp info */
+ /*
+ * Update the ftp info only if the source address matches the address specified
+ * in the PORT or PASV command. Closes hole where packets could be dangerously
+ * marked as RELATED to bypass filtering rules. Thanks to Cristiano Lincoln
+ * Mattos for the report.
+ */
LOCK_BH(&ip_ftp_lock);
if (htonl((array[0] << 24) | (array[1] << 16) | (array[2] << 8) | array[3])
== ct->tuplehash[dir].tuple.src.ip) {
@@ -197,13 +202,8 @@
info->ftptype = dir;
info->port = array[4] << 8 | array[5];
} else {
- - /* Enrico Scholz's passive FTP to partially RNAT'd ftp
- - server: it really wants us to connect to a
- - different IP address. Simply don't record it for
- - NAT. */
- - DEBUGP("conntrack_ftp: NOT RECORDING: %u,%u,%u,%u != %u.%u.%u.%u\n",
- - array[0], array[1], array[2], array[3],
- - NIPQUAD(ct->tuplehash[dir].tuple.src.ip));
+ UNLOCK_BH(&ip_ftp_lock);
+ return NF_ACCEPT;
}

t = ((struct ip_conntrack_tuple)

=====[ Demonstration tool ]===============================================

관리자 주제: 

댓글

v0rt2x의 이미지

헐헐....버그라 하여튼 감사:)

댓글 달기