Bug 1300257 (CVE-2016-0758) - CVE-2016-0758 kernel: tags with indefinite length can corrupt pointers in asn1_find_indefinite_length()
Summary: CVE-2016-0758 kernel: tags with indefinite length can corrupt pointers in asn...
Keywords:
Status: CLOSED ERRATA
Alias: CVE-2016-0758
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard: impact=important,public=20160512,repo...
Depends On: 1303981 1308814 1308815 1325957 1325958 1325959 1325960 1335386
Blocks: 1302159
TreeView+ depends on / blocked
 
Reported: 2016-01-20 11:15 UTC by Adam Mariš
Modified: 2019-06-08 20:56 UTC (History)
29 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
A flaw was found in the way the Linux kernel's ASN.1 DER decoder processed certain certificate files with tags of indefinite length. A local, unprivileged user could use a specially crafted X.509 certificate DER file to crash the system or, potentially, escalate their privileges on the system.
Clone Of:
Environment:
Last Closed: 2016-05-12 10:35:16 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:1033 normal SHIPPED_LIVE Important: kernel security and bug fix update 2016-05-12 13:55:26 UTC
Red Hat Product Errata RHSA-2016:1051 normal SHIPPED_LIVE Important: kernel-rt security, bug fix, and enhancement update 2016-05-12 13:55:44 UTC
Red Hat Product Errata RHSA-2016:1055 normal SHIPPED_LIVE Important: kernel-rt security and bug fix update 2016-05-12 11:58:56 UTC

Description Adam Mariš 2016-01-20 11:15:44 UTC
An issue with ASN.1 DER decoder was reported that could lead to memory corruptions, possible privilege escalation, or complete local denial of service via x509 certificate DER files.

Tags with indefinite length can be used to corrupt the _dp and _len pointers in asn1_find_indefinite_length() in lib/asn1_decoder.c

Vulnerable code:

...
next_tag:
        if (unlikely(datalen - dp < 2)) {
                if (datalen == dp)
                        goto missing_eoc;
                goto data_overrun_error;
        }
...
        n = len - 0x80;
        if (unlikely(n > sizeof(size_t) - 1))
                goto length_too_long;
        if (unlikely(n > datalen - dp))
                goto data_overrun_error;
        for (len = 0; n > 0; n--) {
                len <<= 8;
                len |= data[dp++];
        }
        dp += len;
        goto next_tag;
...

dp can be corrupted and the check at next_tag is not sufficient to prevent this.

Upstream fix:
https://lkml.org/lkml/2016/5/12/270

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=23c8a812dc3c621009e4f0e5342aa4e2ede1ceaa

Comment 2 Adam Mariš 2016-01-20 11:28:03 UTC
Acknowledgments:

Red Hat would like to thank Philip Pettersson of Samsung for reporting this issue.

Comment 6 Wade Mealing 2016-04-11 11:57:22 UTC
Statement:

This issue does not affect the Linux kernel packages as shipped with Red Hat Enterprise Linux 5 and 6.

This issue affects the Linux kernel packages as shipped with Red Hat Enterprise Linux 7 and Red Hat Enterprise MRG 2.

Comment 10 Petr Matousek 2016-05-12 07:06:58 UTC
Created kernel tracking bugs for this issue:

Affects: fedora-all [bug 1335386]

Comment 11 errata-xmlrpc 2016-05-12 07:59:15 UTC
This issue has been addressed in the following products:

  MRG for RHEL-6 v.2

Via RHSA-2016:1055 https://rhn.redhat.com/errata/RHSA-2016-1055.html

Comment 12 errata-xmlrpc 2016-05-12 10:00:32 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2016:1033 https://rhn.redhat.com/errata/RHSA-2016-1033.html

Comment 13 errata-xmlrpc 2016-05-12 10:06:09 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2016:1051 https://rhn.redhat.com/errata/RHSA-2016-1051.html

Comment 14 David Howells 2016-05-12 12:01:24 UTC
Posted upstream: https://lkml.org/lkml/2016/5/12/270

Comment 15 Fedora Update System 2016-05-24 18:02:28 UTC
kernel-4.5.5-300.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.

Comment 16 Fedora Update System 2016-05-25 00:52:28 UTC
kernel-4.4.10-200.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.

Comment 17 Fedora Update System 2016-06-02 14:57:17 UTC
kernel-4.5.5-201.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.