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

Severity

44%

Complexity

34%

Confidentiality

106%

Race condition in Oracle MySQL before 5.5.52, 5.6.x before 5.6.33, 5.7.x before 5.7.15, and 8.x before 8.0.1; MariaDB before 5.5.52, 10.0.x before 10.0.28, and 10.1.x before 10.1.18; Percona Server before 5.5.51-38.2, 5.6.x before 5.6.32-78-1, and 5.7.x before 5.7.14-8; and Percona XtraDB Cluster before 5.5.41-37.0, 5.6.x before 5.6.32-25.17, and 5.7.x before 5.7.14-26.17 allows local users with certain permissions to gain privileges by leveraging use of my_copystat by REPAIR TABLE to repair a MyISAM table.

Race condition in Oracle MySQL before 5.5.52, 5.6.x before 5.6.33, 5.7.x before 5.7.15, and 8.x before 8.0.1; MariaDB before 5.5.52, 10.0.x before 10.0.28, and 10.1.x before 10.1.18; Percona Server before 5.5.51-38.2, 5.6.x before 5.6.32-78-1, and 5.7.x before 5.7.14-8; and Percona XtraDB Cluster before 5.5.41-37.0, 5.6.x before 5.6.32-25.17, and 5.7.x before 5.7.14-26.17 allows local users with certain permissions to gain privileges by leveraging use of my_copystat by REPAIR TABLE to repair a MyISAM table.

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

CVSS 2.0 Base Score 4.4. CVSS Attack Vector: local. CVSS Attack Complexity: medium. CVSS Vector: (AV:L/AC:M/Au:N/C:P/I:P/A:P).

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

Type

Oracle MySQL

First reported 8 years ago

2016-12-13 21:59:00

Last updated 5 years ago

2019-03-05 18:23:00

Affected Software

Oracle MySQL -

Oracle MySQL 8.0

8.0

References

RHSA-2016:2130

Third Party Advisory

RHSA-2016:2131

Third Party Advisory

RHSA-2016:2595

Third Party Advisory

RHSA-2016:2749

Third Party Advisory

RHSA-2016:2927

Third Party Advisory

RHSA-2016:2928

Third Party Advisory

RHSA-2017:0184

Third Party Advisory

20161101 MySQL / MariaDB / PerconaDB - Privilege Escalation / Race Condition Exploit [CVE-2016-6663 / OCVE-2016-5616]

Mailing List, Third Party Advisory

[oss-security] 20161025 Re: CVE-2016-6662 - MySQL Remote Root Code Execution / Privilege Escalation ( 0day )

Mailing List, Third Party Advisory

http://www.oracle.com/technetwork/security-advisory/cpuoct2016-2881722.html

Patch, Vendor Advisory

92911

Third Party Advisory, VDB Entry

93614

Third Party Advisory, VDB Entry

https://dev.mysql.com/doc/relnotes/mysql/5.5/en/news-5-5-52.html

Issue Tracking, Vendor Advisory

https://dev.mysql.com/doc/relnotes/mysql/5.6/en/news-5-6-33.html

Issue Tracking, Vendor Advisory

https://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-15.html

Issue Tracking, Vendor Advisory

https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-1.html

Issue Tracking, Vendor Advisory

https://github.com/MariaDB/server/commit/347eeefbfc658c8531878218487d729f4e020805

Issue Tracking, Patch, Third Party Advisory

https://github.com/mysql/mysql-server/commit/4e5473862e6852b0f3802b0cd0c6fa10b5253291

Issue Tracking, Patch, Third Party Advisory

https://legalhackers.com/advisories/MySQL-Maria-Percona-PrivEscRace-CVE-2016-6663-5616-Exploit.html

Exploit, Third Party Advisory

https://mariadb.com/kb/en/mariadb/mariadb-10028-release-notes/

Release Notes, Vendor Advisory

https://mariadb.com/kb/en/mariadb/mariadb-10118-release-notes/

Release Notes, Vendor Advisory

https://mariadb.com/kb/en/mariadb/mariadb-5552-release-notes/

Release Notes, Vendor Advisory

40678

Exploit, Third Party Advisory, VDB Entry

https://www.percona.com/blog/2016/11/02/percona-responds-to-cve-2016-6663-and-cve-2016-6664/

Vendor Advisory

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.