Linux HID logitech-dj NULL pointer dereference

2013.09.02
Credit: Kees Cook
Risk: Medium
Local: Yes
Remote: No
CWE: CWE-119


CVSS Base Score: 5.4/10
Impact Subscore: 7.8/10
Exploitability Subscore: 3.4/10
Exploit range: Local
Attack complexity: Medium
Authentication: No required
Confidentiality impact: Partial
Integrity impact: None
Availability impact: Complete

I've found several issues in the Linux HID code. They are making their way into the Linux kernel via the linux-input tree now: http://marc.info/?l=linux-input&m=137772180514608&w=10001-HID-validate-HID-report-id-size.patch http://marc.info/?l=linux-input&m=137772188314631&w=10009-HID-logitech-dj-validate-output-report-details.patch CVE-2013-2895 Requires CONFIG_HID_LOGITECH_DJ Can leak up to 12K of kernel memory contents to device, or NULL deref Oops DoS A HID device could send a malicious output report that would cause the logitech-dj HID driver to leak kernel memory contents to the device, or trigger a NULL dereference during initialization: [ 304.424553] usb 1-1: New USB device found, idVendor=046d, idProduct=c52b ... [ 304.780467] BUG: unable to handle kernel NULL pointer dereference at 0000000000000028 [ 304.781409] IP: [<ffffffff815d50aa>] logi_dj_recv_send_report.isra.11+0x1a/0x90 CVE-2013-2895 Signed-off-by: Kees Cook <keescook@chromium.org> Cc: stable@kernel.org --- drivers/hid/hid-logitech-dj.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c index cd33084..7b99c2a 100644 --- a/drivers/hid/hid-logitech-dj.c +++ b/drivers/hid/hid-logitech-dj.c @@ -461,7 +461,7 @@ static int logi_dj_recv_send_report(struct dj_receiver_dev *djrcv_dev, struct hid_report *report; struct hid_report_enum *output_report_enum; u8 *data = (u8 *)(&dj_report->device_index); - int i; + unsigned int i, length; output_report_enum = &hdev->report_enum[HID_OUTPUT_REPORT]; report = output_report_enum->report_id_hash[REPORT_ID_DJ_SHORT]; @@ -471,7 +471,9 @@ static int logi_dj_recv_send_report(struct dj_receiver_dev *djrcv_dev, return -ENODEV; } - for (i = 0; i < report->field[0]->report_count; i++) + length = min_t(size_t, sizeof(*dj_report) - 1, + report->field[0]->report_count); + for (i = 0; i < length; i++) report->field[0]->value[i] = data[i]; hid_hw_request(hdev, report, HID_REQ_SET_REPORT); @@ -783,6 +785,12 @@ static int logi_dj_probe(struct hid_device *hdev, goto hid_parse_fail; } + if (!hid_validate_report(hdev, HID_OUTPUT_REPORT, REPORT_ID_DJ_SHORT, + 1, 3)) { + retval = -ENODEV; + goto hid_parse_fail; + } + /* Starts the usb device and connects to upper interfaces hiddev and * hidraw */ retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT); -- Jiri Kosina

References:

http://marc.info/?l=linux-input&m=137772180514608&w=10001-HID-validate-HID-report-id-size.patch
http://marc.info/?l=linux-input&m=137772188314631&w=10009-HID-logitech-dj-validate-output-report-details.patch
http://cxsecurity.com/issue/WLB-2013090003
http://cxsecurity.com/issue/WLB-2013090005
http://cxsecurity.com/issue/WLB-2013090006
http://cxsecurity.com/issue/WLB-2013090007
http://cxsecurity.com/issue/WLB-2013090008
http://cxsecurity.com/issue/WLB-2013090009
http://cxsecurity.com/issue/WLB-2013090010
http://cxsecurity.com/issue/WLB-2013090011
http://cxsecurity.com/issue/WLB-2013090012
http://cxsecurity.com/issue/WLB-2013090013
http://cxsecurity.com/issue/WLB-2013090014
http://cxsecurity.com/issue/WLB-2013090015


Vote for this issue:
50%
50%


 

Thanks for you vote!


 

Thanks for you comment!
Your message is in quarantine 48 hours.

Comment it here.


(*) - required fields.  
{{ x.nick }} | Date: {{ x.ux * 1000 | date:'yyyy-MM-dd' }} {{ x.ux * 1000 | date:'HH:mm' }} CET+1
{{ x.comment }}

Copyright 2024, cxsecurity.com

 

Back to Top