Bug 1047443 - (CVE-2016-10396) VUL-0: CVE-2016-10396: ipsec-tools: remotely exploitable computational-complexity attack when parsing and storing ISAKMP fragments
(CVE-2016-10396)
VUL-0: CVE-2016-10396: ipsec-tools: remotely exploitable computational-compl...
Status: RESOLVED FIXED
Classification: Novell Products
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents
unspecified
Other Other
: P3 - Medium : Normal
: ---
Assigned To: Security Team bot
Security Team bot
https://smash.suse.de/issue/188029/
CVSSv3:SUSE:CVE-2016-10396:5.9:(AV:N/...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-07-06 06:47 UTC by Marcus Meissner
Modified: 2018-12-14 07:42 UTC (History)
1 user (show)

See Also:
Found By: Security Response Team
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcus Meissner 2017-07-06 06:47:21 UTC
CVE-2016-10396

The racoon daemon in IPsec-Tools 0.8.2 contains a remotely exploitable
computational-complexity attack when parsing and storing ISAKMP fragments. The
implementation permits a remote attacker to exhaust computational resources on
the remote endpoint by repeatedly sending ISAKMP fragment packets in a
particular order such that the worst-case computational complexity is realized
in the algorithm utilized to determine if reassembly of the fragments can take
place.

References:
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-10396
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-10396
https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=51682
http://cvsweb.netbsd.org/bsdweb.cgi/src/crypto/dist/ipsec-tools/src/racoon/isakmp_frag.c?only_with_tag=MAIN
http://cvsweb.netbsd.org/bsdweb.cgi/src/crypto/dist/ipsec-tools/src/racoon/isakmp_frag.c.diff?r1=1.5&r2=1.5.36.1
Comment 1 Jiri Bohac 2017-07-12 20:30:01 UTC
I think the upstream fix is buggy (remotely triggered memory leak, functional regression); I sent this to the netbsd bug tracker; I'll watch what they have to say.

While reviewing the fix for #51682, I found what I believe is a
newly introduced regression / memory leak / DoS.

Bug scenario: the fragments arrive out of order; iph1->frag_chain
already contains some fragments; the newly received fragment has
the lowest frag_num so it should be inserted in the beginning of
the list:

> RCS file: /cvsroot/src/crypto/dist/ipsec-tools/src/racoon/isakmp_frag.c,v
> retrieving revision 1.5
> diff -u -u -r1.5 isakmp_frag.c
> --- isakmp_frag.c	22 Apr 2009 11:24:20 -0000	1.5
> +++ isakmp_frag.c	24 Jan 2017 02:29:15 -0000
> @@ -173,6 +173,38 @@
>  	return ntohl(hp[MD5_DIGEST_LENGTH / sizeof(*hp)]);
>  }
>
> +static int 
> +isakmp_frag_insert(struct ph1handle *iph1, struct isakmp_frag_item *item)
> +{
> +	struct isakmp_frag_item *pitem = NULL;
> +	struct isakmp_frag_item *citem = iph1->frag_chain;
> +

item is not the first to arrive, iph1->frag_chain != NULL,
so the fragment is not inserted here:

> +	if (iph1->frag_chain == NULL) {
> +		iph1->frag_chain = item;
> +		return 0;
> +	}
> +
> +	do {
> +		if (citem->frag_num == item->frag_num)
> +			return -1;
> +

item is lowest-numbered fragment so we want to insert it now ...

> +		if (citem->frag_num > item->frag_num) {

... but pitem is still NULL, we break doing nothing

> +			if (pitem)
> +				pitem->frag_next = item;
> +			item->frag_next = citem;
> +			break;
> +		}
> +
> +		pitem = citem;
> +		citem = citem->frag_next;
> +	} while (citem != NULL);
> +
> +	/* we reached the end of the list, insert */
> +	if (citem == NULL)
> +	      pitem->frag_next = item;
> +	return 0;

We return 0.
The newly received fragment is not inserted in the list -> it's
lost (a regression) and never freed (possible DoS).

I think the correct fix would either need more special cases or
something simpler like: (untested)

static int 
isakmp_frag_insert(struct ph1handle *iph1, struct isakmp_frag_item *item)
{
	struct isakmp_frag_item **pitem = &iph1->frag_chain
	struct isakmp_frag_item *citem = iph1->frag_chain;

	while (citem != NULL) {
		if (citem->frag_num == item->frag_num)
			return -1;

		if (citem->frag_num > item->frag_num) {
			item->frag_next = citem;
			break;
		}

		pitem = &citem->frag_next;
		citem = citem->frag_next;
	}

	(*pitem)->frag_next = item;
	return 0;
}
Comment 2 Swamp Workflow Management 2018-01-26 18:20:06 UTC
This is an autogenerated message for OBS integration:
This bug (1047443) was mentioned in
https://build.opensuse.org/request/show/570012 42.3 / ipsec-tools
Comment 4 Swamp Workflow Management 2018-01-30 12:34:16 UTC
An update workflow for this issue was started.
This issue was rated as moderate.
Please submit fixed packages until 2018-02-13.
When done, reassign the bug to security-team@suse.de.
https://swamp.suse.de/webswamp/wf/63959
Comment 5 Jiri Bohac 2018-02-07 17:09:51 UTC
all versions submitted to BS, reassigning to security-team
Comment 6 Swamp Workflow Management 2018-02-12 11:11:44 UTC
SUSE-SU-2018:0423-1: An update that fixes one vulnerability is now available.

Category: security (moderate)
Bug References: 1047443
CVE References: CVE-2016-10396
Sources used:
SUSE Linux Enterprise Server 11-SP4 (src):    ipsec-tools-0.7.3-1.38.3.1
SUSE Linux Enterprise Debuginfo 11-SP4 (src):    ipsec-tools-0.7.3-1.38.3.1
Comment 7 Swamp Workflow Management 2018-02-12 11:12:20 UTC
SUSE-SU-2018:0424-1: An update that fixes one vulnerability is now available.

Category: security (moderate)
Bug References: 1047443
CVE References: CVE-2016-10396
Sources used:
SUSE Linux Enterprise Server for Raspberry Pi 12-SP2 (src):    ipsec-tools-0.8.0-19.3.1
SUSE Linux Enterprise Server 12-SP3 (src):    ipsec-tools-0.8.0-19.3.1
SUSE Linux Enterprise Server 12-SP2 (src):    ipsec-tools-0.8.0-19.3.1
Comment 8 Marcus Meissner 2018-02-13 09:57:06 UTC
released
Comment 9 Swamp Workflow Management 2018-02-13 14:08:09 UTC
openSUSE-SU-2018:0434-1: An update that fixes one vulnerability is now available.

Category: security (moderate)
Bug References: 1047443
CVE References: CVE-2016-10396
Sources used:
openSUSE Leap 42.3 (src):    ipsec-tools-0.8.0-14.3.1