From owner-freebsd-bugs@FreeBSD.ORG Tue Feb 21 20:30:15 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A1E9106567D for ; Tue, 21 Feb 2012 20:30:15 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id CE3988FC25 for ; Tue, 21 Feb 2012 20:30:11 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q1LKUBTU069229 for ; Tue, 21 Feb 2012 20:30:11 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q1LKUBw0069227; Tue, 21 Feb 2012 20:30:11 GMT (envelope-from gnats) Resent-Date: Tue, 21 Feb 2012 20:30:11 GMT Resent-Message-Id: <201202212030.q1LKUBw0069227@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Arnaud Lacombe Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7BCE0106564A for ; Tue, 21 Feb 2012 20:25:28 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 6BCFA8FC1A for ; Tue, 21 Feb 2012 20:25:28 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q1LKPSYA052390 for ; Tue, 21 Feb 2012 20:25:28 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id q1LKPSno052389; Tue, 21 Feb 2012 20:25:28 GMT (envelope-from nobody) Message-Id: <201202212025.q1LKPSno052389@red.freebsd.org> Date: Tue, 21 Feb 2012 20:25:28 GMT From: Arnaud Lacombe To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: misc/165373: Obvious use-after-free in ipfw_nat() X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Feb 2012 20:30:15 -0000 >Number: 165373 >Category: misc >Synopsis: Obvious use-after-free in ipfw_nat() >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Feb 21 20:30:11 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Arnaud Lacombe >Release: 10-current >Organization: n/a >Environment: >Description: ipfw_nat() reads the following: mcl = m_megapullup(m, m->m_pkthdr.len); if (mcl == NULL) { args->m = NULL; return (IP_FW_DENY); } ip = mtod(mcl, struct ip *); [...] if (retval == PKT_ALIAS_RESPOND) m->m_flags |= M_SKIP_FIREWALL It is quite obvious that `m' is no longer valid in the second conditional. I reported this months ago on freebsd-net@ and did provide a patch to fix it, but no developers seems to actually care about such a bug. >How-To-Repeat: read the code. >Fix: s/m/mcl/ >Release-Note: >Audit-Trail: >Unformatted: