CVE-2016-5195 - Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')

Severity

72%

Complexity

39%

Confidentiality

165%

Race condition in mm/gup.c in the Linux kernel 2.x through 4.x before 4.8.3 allows local users to gain privileges by leveraging incorrect handling of a copy-on-write (COW) feature to write to a read-only memory mapping, as exploited in the wild in October 2016, aka "Dirty COW."

Race condition in mm/gup.c in the Linux kernel 2.x through 4.x before 4.8.3 allows local users to gain privileges by leveraging incorrect handling of a copy-on-write (COW) feature to write to a read-only memory mapping, as exploited in the wild in October 2016, aka "Dirty COW."

CVSS 3.0 Base Score 7.8. CVSS Attack Vector: local. CVSS Attack Complexity: low. CVSS Vector: (CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).

CVSS 2.0 Base Score 7.2. CVSS Attack Vector: local. CVSS Attack Complexity: low. CVSS Vector: (AV:L/AC:L/Au:N/C:C/I:C/A:C).

Demo Examples

Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')

CWE-362

This code could be used in an e-commerce application that supports transfers between accounts. It takes the total amount of the transfer, sends it to the new account, and deducts the amount from the original account.


               
NotifyUser("New balance: $newbalance");
FatalError("Bad Transfer Amount");
FatalError("Insufficient Funds");

A race condition could occur between the calls to GetBalanceFromDatabase() and SendNewBalanceToDatabase().

Suppose the balance is initially 100.00. An attack could be constructed as follows:


               
PROGRAM-2 sends a request to update the database, setting the balance to 99.00

At this stage, the attacker should have a balance of 19.00 (due to 81.00 worth of transfers), but the balance is 99.00, as recorded in the database.

To prevent this weakness, the programmer has several options, including using a lock to prevent multiple simultaneous requests to the web application, or using a synchronization mechanism that includes all the code between GetBalanceFromDatabase() and SendNewBalanceToDatabase().

Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')

CWE-362

The following function attempts to acquire a lock in order to perform operations on a shared resource.


               
}
pthread_mutex_unlock(mutex);/* access shared resource */

However, the code does not check the value returned by pthread_mutex_lock() for errors. If pthread_mutex_lock() cannot acquire the mutex for any reason, the function may introduce a race condition into the program and result in undefined behavior.

In order to avoid data races, correctly written programs must check the result of thread synchronization functions and appropriately handle all errors, either by attempting to recover from them or reporting it to higher levels.


               
}
return pthread_mutex_unlock(mutex);
return result;
/* access shared resource */

Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')

CWE-362

Suppose a processor's Memory Management Unit (MMU) has 5 other shadow MMUs to distribute its workload for its various cores. Each MMU has the start address and end address of "accessible" memory. Any time this accessible range changes (as per the processor's boot status), the main MMU sends an update message to all the shadow MMUs.

Suppose the interconnect fabric does not prioritize such "update" packets over other general traffic packets. This introduces a race condition. If an attacker can flood the target with enough messages so that some of those attack packets reach the target before the new access ranges gets updated, then the attacker can leverage this scenario.

Overview

First reported 8 years ago

2016-11-10 21:59:00

Last updated 5 years ago

2020-02-17 16:15:00

Affected Software

Canonical Ubuntu Core 15.04

15.04

Canonical Ubuntu Linux 12.04 LTS

12.04

Canonical Ubuntu Linux 16.04 LTS (Long-Term Support)

16.04

Linux Kernel

Red Hat Enterprise Linux 5

5

Red Hat Enterprise Linux 6.0

6.0

Red Hat Enterprise Linux (RHEL) 7.0 (7)

7.0

Debian Linux 7.0

7.0

Debian Linux 8.0 (Jessie)

8.0

References

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=19be0eaffa3ac7d8eb6784ad9bdbc7d67ed8e619

Issue Tracking, Patch, Vendor Advisory

openSUSE-SU-2020:0554

RHSA-2016:2098

Third Party Advisory

RHSA-2016:2105

Third Party Advisory

RHSA-2016:2106

Third Party Advisory

RHSA-2016:2107

Third Party Advisory

RHSA-2016:2110

Third Party Advisory

RHSA-2016:2118

Third Party Advisory

RHSA-2016:2120

Third Party Advisory

RHSA-2016:2124

Third Party Advisory

RHSA-2016:2126

Third Party Advisory

RHSA-2016:2127

Third Party Advisory

RHSA-2016:2128

Third Party Advisory

RHSA-2016:2132

Third Party Advisory

RHSA-2016:2133

Third Party Advisory

http://www.kernel.org/pub/linux/kernel/v4.x/ChangeLog-4.8.3

Release Notes, Vendor Advisory

[oss-security] 20161026 Re: CVE-2016-5195 "Dirty COW" Linux kernel privilege escalation vulnerability

Mailing List, Third Party Advisory

http://www.oracle.com/technetwork/security-advisory/cpujul2018-4258247.html

Patch, Third Party Advisory

93793

Third Party Advisory, VDB Entry

1037078

Third Party Advisory, VDB Entry

RHSA-2017:0372

Third Party Advisory

https://access.redhat.com/security/cve/cve-2016-5195

Third Party Advisory

https://access.redhat.com/security/vulnerabilities/2706661

Third Party Advisory

https://bto.bluecoat.com/security-advisory/sa134

Third Party Advisory

https://bugzilla.redhat.com/show_bug.cgi?id=1384344

Issue Tracking, Third Party Advisory

https://bugzilla.suse.com/show_bug.cgi?id=1004418

Issue Tracking, Third Party Advisory

https://dirtycow.ninja

Third Party Advisory

https://github.com/dirtycow/dirtycow.github.io/wiki/PoCs

Third Party Advisory

https://github.com/dirtycow/dirtycow.github.io/wiki/VulnerabilityDetails

Third Party Advisory

https://github.com/torvalds/linux/commit/19be0eaffa3ac7d8eb6784ad9bdbc7d67ed8e619

Issue Tracking, Patch, Third Party Advisory

https://h20566.www2.hpe.com/hpsc/doc/public/display?docLocale=en_US&docId=emr_na-hpesbgn03707en_us

Third Party Advisory

https://h20566.www2.hpe.com/hpsc/doc/public/display?docLocale=en_US&docId=emr_na-hpesbgn03722en_us

Third Party Advisory

https://h20566.www2.hpe.com/hpsc/doc/public/display?docLocale=en_US&docId=emr_na-hpesbgn03742en_us

Third Party Advisory

https://h20566.www2.hpe.com/hpsc/doc/public/display?docLocale=en_US&docId=emr_na-hpesbgn03761en_us

Third Party Advisory

https://h20566.www2.hpe.com/portal/site/hpsc/public/kb/docDisplay?docId=emr_na-c05341463

Third Party Advisory

https://h20566.www2.hpe.com/portal/site/hpsc/public/kb/docDisplay?docId=emr_na-c05347541

Third Party Advisory

https://h20566.www2.hpe.com/portal/site/hpsc/public/kb/docDisplay?docId=emr_na-c05352241

Third Party Advisory

https://help.ecostruxureit.com/display/public/UADCO8x/StruxureWare+Data+Center+Operation+Software+Vulnerability+Fixes

Third Party Advisory

https://kc.mcafee.com/corporate/index?page=content&id=SB10176

Third Party Advisory

https://people.canonical.com/~ubuntu-security/cve/2016/CVE-2016-5195.html

Third Party Advisory

https://security.netapp.com/advisory/ntap-20161025-0001/

Third Party Advisory

https://security.paloaltonetworks.com/CVE-2016-5195

https://security-tracker.debian.org/tracker/CVE-2016-5195

Issue Tracking, Third Party Advisory

https://source.android.com/security/bulletin/2016-11-01.html

Third Party Advisory

https://source.android.com/security/bulletin/2016-12-01.html

Third Party Advisory

40611

Third Party Advisory, VDB Entry

40616

Third Party Advisory, VDB Entry

40839

Third Party Advisory, VDB Entry

40847

Third Party Advisory, VDB Entry

VU#243144

Third Party Advisory, US Government Resource

Stay updated

ExploitPedia is constantly evolving. Sign up to receive a notification when we release additional functionality.

Get in touch

If you'd like to report a bug or have any suggestions for improvements then please do get in touch with us using this form. We will get back to you as soon as we can.