Bug 1252346

Summary: Use after free in nfct_helper_free
Product: Red Hat OpenStack Reporter: Ján Rusnačko <jrusnack>
Component: libnetfilter_cthelperAssignee: RHOS Maint <rhos-maint>
Status: CLOSED DUPLICATE QA Contact: Shai Revivo <srevivo>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.0 (Juno)CC: amuller, apevec, haliu, lhh, pwouters
Target Milestone: ---Keywords: ZStream
Target Release: 8.0 (Liberty)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1252344 Environment:
Last Closed: 2016-09-16 18:37:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1252344    
Bug Blocks: 1235638    

Description Ján Rusnačko 2015-08-11 08:39:47 UTC
+++ This bug was initially created as a clone of Bug #1252344 +++

Use after free flaw was found in the following code:

void nfct_helper_free(struct nfct_helper *h)
{
        int i;

        free(h);
        for (i=0; i<NF_CT_HELPER_CLASS_MAX; i++) {
                if (h->expect_policy[i])
                        free(h->expect_policy[i]);
        }
}

This was reported on oss-security as potential vulnerability and fixed by upstream in master in commit 0c52422eb236b16bc663a7f22df3e30fb9c8bf71.

It is also reported by Coverity:

Error: USE_AFTER_FREE (CWE-825): [#def1]
libnetfilter_cthelper-1.0.0/src/libnetfilter_cthelper.c:116: freed_arg: "free" frees "h".
libnetfilter_cthelper-1.0.0/src/libnetfilter_cthelper.c:118: deref_after_free: Dereferencing freed pointer "h".
#  116|   	free(h);
#  117|   	for (i=0; i<NF_CT_HELPER_CLASS_MAX; i++) {
#  118|-> 		if (h->expect_policy[i])
#  119|   			free(h->expect_policy[i]);
#  120|   	}

Additional info:
https://bugzilla.netfilter.org/show_bug.cgi?id=990
http://seclists.org/oss-sec/2015/q2/228

Comment 4 Lon Hohberger 2016-09-16 18:37:35 UTC

*** This bug has been marked as a duplicate of bug 1252344 ***