Bug 1300257 - (CVE-2016-0758) CVE-2016-0758 kernel: tags with indefinite length can corrupt pointers in asn1_find_indefinite_length()
CVE-2016-0758 kernel: tags with indefinite length can corrupt pointers in asn...
Status: CLOSED ERRATA
Product: Security Response
Classification: Other
Component: vulnerability (Show other bugs)
unspecified
All Linux
high Severity high
: ---
: ---
Assigned To: Red Hat Product Security
impact=important,public=20160512,repo...
: Security
Depends On: 1303981 1308814 1308815 1325957 1325958 1325959 1325960 1335386
Blocks: 1302159
  Show dependency treegraph
 
Reported: 2016-01-20 06:15 EST by Adam Mariš
Modified: 2016-06-02 10:57 EDT (History)
29 users (show)

See Also:
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.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-05-12 06:35:16 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Adam Mariš 2016-01-20 06:15:44 EST
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 06:28:03 EST
Acknowledgments:

Red Hat would like to thank Philip Pettersson of Samsung for reporting this issue.
Comment 6 Wade Mealing 2016-04-11 07:57:22 EDT
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 03:06:58 EDT
Created kernel tracking bugs for this issue:

Affects: fedora-all [bug 1335386]
Comment 11 errata-xmlrpc 2016-05-12 03:59:15 EDT
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 06:00:32 EDT
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 06:06:09 EDT
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 08:01:24 EDT
Posted upstream: https://lkml.org/lkml/2016/5/12/270
Comment 15 Fedora Update System 2016-05-24 14:02:28 EDT
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-24 20:52:28 EDT
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 10:57:17 EDT
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.