Home / exploitsPDF  

Linux HID pantherlord heap overflow

Posted on 03 September 2013

<pre>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&amp;m=137772180514608&amp;w=10001-HID-validate-HID-report-id-size.patch http://marc.info/?l=linux-input&amp;m=137772185414625&amp;w=10006-HID-pantherlord-validate-output-report-details.patch CVE-2013-2892 Requires CONFIG_HID_PANTHERLORD Small past-end-of-heap-alloc zeroing A HID device could send a malicious output report that would cause the pantherlord HID driver to write beyond the output report allocation during initialization, causing a heap overflow: [ 310.939483] usb 1-1: New USB device found, idVendor=0e8f, idProduct=0003 ... [ 315.980774] BUG kmalloc-192 (Tainted: G W ): Redzone overwritten CVE-2013-2892 Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt; Cc: stable@kernel.org --- drivers/hid/hid-pl.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hid-pl.c b/drivers/hid/hid-pl.c index d29112f..2dcd7d9 100644 --- a/drivers/hid/hid-pl.c +++ b/drivers/hid/hid-pl.c @@ -132,8 +132,14 @@ static int plff_init(struct hid_device *hid) strong = &amp;report-&gt;field[0]-&gt;value[2]; weak = &amp;report-&gt;field[0]-&gt;value[3]; debug(&quot;detected single-field device&quot;); - } else if (report-&gt;maxfield &gt;= 4 &amp;&amp; report-&gt;field[0]-&gt;maxusage == 1 &amp;&amp; - report-&gt;field[0]-&gt;usage[0].hid == (HID_UP_LED | 0x43)) { + } else if (report-&gt;field[0]-&gt;maxusage == 1 &amp;&amp; + report-&gt;field[0]-&gt;usage[0].hid == + (HID_UP_LED | 0x43) &amp;&amp; + report-&gt;maxfield &gt;= 4 &amp;&amp; + report-&gt;field[0]-&gt;report_count &gt;= 1 &amp;&amp; + report-&gt;field[1]-&gt;report_count &gt;= 1 &amp;&amp; + report-&gt;field[2]-&gt;report_count &gt;= 1 &amp;&amp; + report-&gt;field[3]-&gt;report_count &gt;= 1) { report-&gt;field[0]-&gt;value[0] = 0x00; report-&gt;field[1]-&gt;value[0] = 0x00; strong = &amp;report-&gt;field[2]-&gt;value[0]; -- Jiri Kosina SUSE Labs </pre>

 

TOP