From owner-svn-src-stable-7@FreeBSD.ORG Sat Apr 9 10:58:38 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 757BF1065673; Sat, 9 Apr 2011 10:58:38 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 62A868FC15; Sat, 9 Apr 2011 10:58:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p39AwcYm011596; Sat, 9 Apr 2011 10:58:38 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p39AwcoG011594; Sat, 9 Apr 2011 10:58:38 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201104091058.p39AwcoG011594@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 9 Apr 2011 10:58:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r220484 - stable/7/sys/netipsec X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2011 10:58:38 -0000 Author: bz Date: Sat Apr 9 10:58:38 2011 New Revision: 220484 URL: http://svn.freebsd.org/changeset/base/220484 Log: MFC r220247: Do not allow directly recursive RFC3173 IPComp payload. Security: CVE-2011-1547 Modified: stable/7/sys/netipsec/xform_ipcomp.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/netipsec/xform_ipcomp.c ============================================================================== --- stable/7/sys/netipsec/xform_ipcomp.c Sat Apr 9 10:53:36 2011 (r220483) +++ stable/7/sys/netipsec/xform_ipcomp.c Sat Apr 9 10:58:38 2011 (r220484) @@ -139,10 +139,31 @@ ipcomp_input(struct mbuf *m, struct seca struct tdb_crypto *tc; struct cryptodesc *crdc; struct cryptop *crp; + struct ipcomp *ipcomp; + caddr_t addr; int hlen = IPCOMP_HLENGTH; IPSEC_SPLASSERT_SOFTNET(__func__); + /* + * Check that the next header of the IPComp is not IPComp again, before + * doing any real work. Given it is not possible to do double + * compression it means someone is playing tricks on us. + */ + if (m->m_len < skip + hlen && (m = m_pullup(m, skip + hlen)) == NULL) { + ipcompstat.ipcomps_hdrops++; /*XXX*/ + DPRINTF(("%s: m_pullup failed\n", __func__)); + return (ENOBUFS); + } + addr = (caddr_t) mtod(m, struct ip *) + skip; + ipcomp = (struct ipcomp *)addr; + if (ipcomp->comp_nxt == IPPROTO_IPCOMP) { + m_freem(m); + ipcompstat.ipcomps_pdrops++; /* XXX have our own stats? */ + DPRINTF(("%s: recursive compression detected\n", __func__)); + return (EINVAL); + } + /* Get crypto descriptors */ crp = crypto_getreq(1); if (crp == NULL) {