| From stable-bounces@linux.kernel.org Tue Jun 5 05:17:17 2007 |
| From: Patrick McHardy <kaber@trash.net> |
| Date: Tue, 05 Jun 2007 14:14:22 +0200 |
| Subject: NETFILTER: {ip, nf}_conntrack_sctp: fix remotely triggerable NULL ptr dereference (CVE-2007-2876) |
| To: "David S. Miller" <davem@davemloft.net> |
| Cc: security@kernel.org, Adrian Bunk <bunk@stusta.de>, Kiran Kumar Immidi <immidi_kiran@yahoo.com>, stable@kernel.org, Vilmos Nebehaj <vilmos.nebehaj@ramsys.hu> |
| Message-ID: <4665539E.9040005@trash.net> |
| |
| From: Patrick McHardy <kaber@trash.net> |
| |
| When creating a new connection by sending an unknown chunk type, we |
| don't transition to a valid state, causing a NULL pointer dereference in |
| sctp_packet when accessing sctp_timeouts[SCTP_CONNTRACK_NONE]. |
| |
| Fix by don't creating new conntrack entry if initial state is invalid. |
| |
| Noticed by Vilmos Nebehaj <vilmos.nebehaj@ramsys.hu> |
| |
| CC: Kiran Kumar Immidi <immidi_kiran@yahoo.com> |
| Cc: David Miller <davem@davemloft.net> |
| Signed-off-by: Patrick McHardy <kaber@trash.net> |
| Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> |
| Signed-off-by: Chris Wright <chrisw@sous-sol.org> |
| |
| --- |
| net/ipv4/netfilter/ip_conntrack_proto_sctp.c | 3 ++- |
| net/netfilter/nf_conntrack_proto_sctp.c | 3 ++- |
| 2 files changed, 4 insertions(+), 2 deletions(-) |
| |
| --- linux-2.6.21.3.orig/net/ipv4/netfilter/ip_conntrack_proto_sctp.c |
| +++ linux-2.6.21.3/net/ipv4/netfilter/ip_conntrack_proto_sctp.c |
| @@ -460,7 +460,8 @@ static int sctp_new(struct ip_conntrack |
| SCTP_CONNTRACK_NONE, sch->type); |
| |
| /* Invalid: delete conntrack */ |
| - if (newconntrack == SCTP_CONNTRACK_MAX) { |
| + if (newconntrack == SCTP_CONNTRACK_NONE || |
| + newconntrack == SCTP_CONNTRACK_MAX) { |
| DEBUGP("ip_conntrack_sctp: invalid new deleting.\n"); |
| return 0; |
| } |
| --- linux-2.6.21.3.orig/net/netfilter/nf_conntrack_proto_sctp.c |
| +++ linux-2.6.21.3/net/netfilter/nf_conntrack_proto_sctp.c |
| @@ -469,7 +469,8 @@ static int sctp_new(struct nf_conn *conn |
| SCTP_CONNTRACK_NONE, sch->type); |
| |
| /* Invalid: delete conntrack */ |
| - if (newconntrack == SCTP_CONNTRACK_MAX) { |
| + if (newconntrack == SCTP_CONNTRACK_NONE || |
| + newconntrack == SCTP_CONNTRACK_MAX) { |
| DEBUGP("nf_conntrack_sctp: invalid new deleting.\n"); |
| return 0; |
| } |