Bug 889332 (CVE-2014-3676) - VUL-0: CVE-2014-3676: shim: buffer overflow and OOB access in shim trusted code path
Summary: VUL-0: CVE-2014-3676: shim: buffer overflow and OOB access in shim trusted co...
Status: RESOLVED FIXED
Alias: CVE-2014-3676
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents (show other bugs)
Version: unspecified
Hardware: Other Other
: P1 - Urgent : Major
Target Milestone: ---
Deadline: 2014-10-20
Assignee: Johannes Segitz
QA Contact: Security Team bot
URL:
Whiteboard: maint:released:sle11-sp3:59756
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-29 09:55 UTC by Sebastian Krahmer
Modified: 2020-10-16 10:27 UTC (History)
12 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
MOK OOB patch (2.61 KB, patch)
2014-08-12 09:19 UTC, Sebastian Krahmer
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Krahmer 2014-07-29 09:55:34 UTC
Using shim latest git commit 81ee561dde0213bc487aa1b701799f6d2faeaf31

shim contains a OOB access in

get_v6_bootfile_url(), trusting option->Length and
advancing the ptr to OOB.

Also theres an overflow in str2ip6() that takes as an argument
the tftp:// url ipv6 address, parsed from the dhcpv6 packet and
doesnt expect so many ':' inside the loop:

        static UINT16 ip[8];

        for(i=0; i < 8; i++) {
                ip[i] = 0;
        }
        len = strlen(str);
        a = b = str;
        for(i=p=0; i < len; i++, b++) {
                if (*b != ':')
                        continue;
                *b = '\0';
                ip[p++] = str2ns(a);
                *b = ':';
                a = b + 1;
                if ( *(b+1) == ':' )
                        break;
        }


so that "a:a:a:a:a:a:a:a:a:a:a:a:a" will overwrite ip array.
Input is at most 40bytes, as checked in the dhcpv6 parsing, but this
suffices to cause a segfault via the

memcpy(&tftp_addr.v6, str2ip6(ip6str), 16);

call triggered by user input via a dhcpv6 packet.
Comment 1 Sebastian Krahmer 2014-07-29 09:56:55 UTC
Note that this overflow is a potential code execution vulnerability
while running in the trusted boot path, e.g. you can execute code
at the highest privilege level possible on such UEFI secure boot
machine.
Comment 2 Swamp Workflow Management 2014-07-29 22:00:21 UTC
bugbot adjusting priority
Comment 3 Sebastian Krahmer 2014-07-30 12:55:31 UTC
Created attachment 600372 [details]
patch for both issues

.
Comment 4 SMASH SMASH 2014-07-30 14:30:19 UTC
Affected packages:

SLE-11-SP3: shim
Comment 5 Johannes Segitz 2014-07-31 08:16:54 UTC
Notified Peter Jones and added him to this bug. We're discussing on how to proceed.
Comment 6 Sebastian Krahmer 2014-08-04 09:11:46 UTC
Looks like there is more OOB indeed when enrolling MoK's
which seem to be user input from a file.
Comment 7 Sebastian Krahmer 2014-08-04 09:25:19 UTC
static UINT32 count_keys(void *Data, UINTN DataSize)

that is basically operating on user data taken from a input file
blindly trusts SignatureListSize, that can be used to
create OOB memory reads or making it loop forever if SignatureListSize
is 0.
Comment 8 Sebastian Krahmer 2014-08-04 09:33:21 UTC
Similar with the call to build_mok_list() which follows count_keys()
and operates on the same input data w/o any boundary checks.
Comment 11 Sebastian Krahmer 2014-08-12 09:19:10 UTC
Created attachment 602006 [details]
MOK OOB patch

patch for MOK OOB access.

Both patches need to be applied to fix all issues.
Comment 12 Sebastian Krahmer 2014-08-12 09:23:28 UTC
So I will request 3 CVE's later on:

1. OOB access when parsing DHCPv6 option list (DoS)
2. Heap overflow when parsing ipv6 address (RCE)
3. OOB access when parsing MOK List/Certificates on MOK enrollment (DoS)

1+2 are fixed with first patch, 3 is fixed with second patch.
Comment 34 Sebastian Krahmer 2014-10-01 06:34:41 UTC
Via Kurt Seifried:

Please use the following CVEs:

CVE-2014-3675 shim OOB read access when parsing DHCPv6 packets (remote DoS).

CVE-2014-3676 shim Heap overflow when parsing IPv6 addresses provided by
tftp:// DHCPv6 boot option (RCE).

CVE-2014-3677 shim Memory corruption when processing user provided MOK
lists.
Comment 36 Sebastian Krahmer 2014-10-01 12:54:22 UTC
New CRD is Oct. 13th.
Comment 38 Swamp Workflow Management 2014-10-13 14:21:14 UTC
An update workflow for this issue was started.
This issue was rated as important.
Please submit fixed packages until 2014-10-20.
When done, reassign the bug to security-team@suse.de.
https://swamp.suse.de/webswamp/wf/59352
Comment 42 Swamp Workflow Management 2014-12-11 18:05:34 UTC
SUSE-SU-2014:1619-1: An update that solves three vulnerabilities and has three fixes is now available.

Category: security (important)
Bug References: 813448,863205,866690,875385,889332,889765
CVE References: CVE-2014-3675,CVE-2014-3676,CVE-2014-3677
Sources used:
SUSE Linux Enterprise Software Development Kit 11 SP3 (src):    gnu-efi-3.0u-0.7.2
SUSE Linux Enterprise Server 11 SP3 for VMware (src):    gnu-efi-3.0u-0.7.2, shim-0.7.318.81ee561d-0.9.2
SUSE Linux Enterprise Server 11 SP3 (src):    gnu-efi-3.0u-0.7.2, shim-0.7.318.81ee561d-0.9.2
SUSE Linux Enterprise Desktop 11 SP3 (src):    shim-0.7.318.81ee561d-0.9.2
Comment 43 Johannes Segitz 2015-01-26 08:17:46 UTC
all updates were released (openSUSE didn't show up, but an update for 13.1 went out. 13.2 already had a fixed shim)
Comment 44 Joachim Wagner 2015-01-26 13:03:11 UTC
The update says
┌───────────────────────────────────────────────────────────────┐
│  ┌──────────────────────────────────────────────────────────┐ │
│  │Patch openSUSE-2015-48-1.noarch                           │ │
│  │                                                          │ │
│  │This update requires you to confirm a dialog on the first │ │
│  │reboot after installing the update! This is only          │ │
│  │necessary once.                                           │ │
│  │                                                          │ │
│  │                                                          │ │
│  │                                                          │ │
│  └──────────────────────────────────────────────────────────┘ │
│                                                               │
│                             [OK]                              │
└───────────────────────────────────────────────────────────────┘
How will this work when I don't have access to screen and keyboard?

 - JJ
Comment 45 Johannes Segitz 2015-01-26 13:12:33 UTC
(In reply to Joachim Wagner from comment #44)
First you have to clarify if this affects you. See
http://lists.opensuse.org/opensuse/2015-01/msg00513.html
for details. It's very likely that this doesn't affect you.

If you are using a secure boot setup (so bootctl shows you that you used shim to boot your system) then you will either have to find a way to confirm this dialog or you don't install this update.
Comment 46 Joachim Wagner 2015-01-26 14:09:45 UTC
(In reply to Johannes Segitz from comment #45)
Thanks for the quick clarification. The command bootctl seems to be unavailable on openSUSE 12.3. However, as the machine uses legacy BIOS for booting, I guess it won't be affected. JJ
Comment 47 Swamp Workflow Management 2017-07-26 20:33:01 UTC
openSUSE-SU-2017:1967-1: An update that contains security fixes can now be installed.

Category: security (moderate)
Bug References: 798043,807760,808106,813079,813448,841426,863205,866690,867974,872503,873857,875385,877003,889332,889765
CVE References: 
Sources used:
openSUSE 13.1 (src):    gnu-efi-3.0u-2.5.1, pesign-0.109-3.9.2, shim-0.7.318.81ee561d-7.2
openSUSE 12.3 (src):    gnu-efi-3.0u-6.5.1, pesign-0.109-3.19.1, shim-0.7.318.81ee561d-3.22.1
Comment 48 Swamp Workflow Management 2019-05-14 10:12:36 UTC
This is an autogenerated message for OBS integration:
This bug (889332) was mentioned in
https://build.opensuse.org/request/show/702795 Factory / shim