Linux Kernel up to 3.14.3 PTY Write drivers/tty/n_tty.c n_tty_write race condition

CVSS Meta Temp Score
CVSS is a standardized scoring system to determine possibilities of attacks. The Temp Score considers temporal factors like disclosure, exploit and countermeasures. The unique Meta Score calculates the average score of different sources to provide a normalized scoring system.
Current Exploit Price (≈)
Our analysts are monitoring exploit markets and are in contact with vulnerability brokers. The range indicates the observed or calculated exploit price to be seen on exploit markets. A good indicator to understand the monetary effort required for and the popularity of an attack.
CTI Interest Score
Our Cyber Threat Intelligence team is monitoring different web sites, mailing lists, exploit markets and social media networks. The CTI Interest Score identifies the interest of attackers and the security community for this specific vulnerability in real-time. A high score indicates an elevated risk to be targeted for this vulnerability.
7.5$0-$5k0.00

Summaryinfo

A vulnerability classified as critical has been found in Linux Kernel up to 3.14.3. Affected by this vulnerability is the function n_tty_write of the file drivers/tty/n_tty.c of the component PTY Write Handler. The manipulation leads to race condition. This vulnerability is referenced as CVE-2014-0196. Furthermore, an exploit is available. This vulnerability has a historic impact because of its background and how it was received. It is suggested to install a patch to address this issue.

Detailsinfo

A vulnerability was found in Linux Kernel up to 3.14.3 (Operating System) and classified as critical. This issue affects the function n_tty_write of the file drivers/tty/n_tty.c of the component PTY Write Handler. The manipulation with an unknown input leads to a race condition vulnerability. Using CWE to declare the problem leads to CWE-362. The product contains a code sequence that can run concurrently with other code, and the code sequence requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence that is operating concurrently. Impacted is confidentiality, integrity, and availability. The summary by CVE is:

The n_tty_write function in drivers/tty/n_tty.c in the Linux kernel through 3.14.3 does not properly manage tty driver access in the "LECHO & !OPOST" case, which allows local users to cause a denial of service (memory corruption and system crash) or gain privileges by triggering a race condition involving read and write operations with long strings.

The weakness was published 05/03/2014 by Jiri Slaby and Peter Hurley as n_tty: Fix n_tty_write crash when echoing in raw mode as confirmed git commit (GIT Repository). The advisory is shared at git.kernel.org. The identification of this vulnerability is CVE-2014-0196 since 12/03/2013. An attack has to be approached locally. Required for exploitation is a simple authentication. Technical details as well as a public exploit are known. The price for an exploit might be around USD $0-$5k at the moment (estimation calculated on 12/19/2024). Due to its background and reception, this vulnerability has a historic impact. The following code is the reason for this vulnerability:

int space = __tty_buffer_request_room(port, goal, flags);
  struct tty_buffer *tb = port->buf.tail;
  ...
  memcpy(char_buf_ptr(tb, tb->used), chars, space);
  ...
  tb->used += space;
The advisory points out:
The tty atomic_write_lock does not provide an exclusion guarantee for the tty driver if the termios settings are LECHO & !OPOST. And since it is unexpected and not allowed to call TTY buffer helpers like tty_insert_flip_string concurrently, this may lead to crashes when concurrect writers call pty_write.

A public exploit has been developed by Matthew Daley in ANSI C and been published 2 weeks after the advisory. The exploit is available at bugfuzz.com. It is declared as attacked. The vulnerability scanner Nessus provides a plugin with the ID 74027 (Debian DSA-2928-1 : linux-2.6 - privilege escalation/denial of service/information leak), which helps to determine the existence of the flaw in a target environment. It is assigned to the family Debian Local Security Checks. The commercial vulnerability scanner Qualys is able to test this issue with plugin 167228 (SUSE Enterprise Linux Security Update for Linux Kernel (SUSE-SU-2014:0807-1)). The CISA Known Exploited Vulnerabilities Catalog lists this issue since 05/12/2023 with a due date of 06/02/2023:

The impacted product is end-of-life and should be disconnected if still in use.

Applying a patch is able to eliminate this problem. The bugfix is ready for download at git.kernel.org. A possible mitigation has been published immediately after the disclosure of the vulnerability. The vulnerability will be addressed with the following lines of code:

struct n_tty_data *ldata = tty->disc_data;

while (nr > 0) {
   mutex_lock(&ldata->output_lock);
      c = tty->ops->write(tty, b, nr);
   mutex_unlock(&ldata->output_lock);
      if (c < 0) {
         retval = c;
         goto break_out;

The vulnerability is also documented in the databases at X-Force (93099), Exploit-DB (33516), Tenable (74027), SecurityFocus (BID 67282†) and OSVDB (106646†). bugzilla.redhat.com is providing further details. Similar entries are available at VDB-11302, VDB-11755, VDB-12214 and VDB-12411. If you want to get the best quality for vulnerability data then you always have to consider VulDB.

Not Affected

  • Red Hat Enterprise Linux 5

Productinfo

Type

Vendor

Name

Version

License

Website

CPE 2.3info

CPE 2.2info

CVSSv4info

VulDB Vector: 🔍
VulDB Reliability: 🔍

CVSSv3info

VulDB Meta Base Score: 7.8
VulDB Meta Temp Score: 7.5

VulDB Base Score: 7.8
VulDB Temp Score: 7.5
VulDB Vector: 🔍
VulDB Reliability: 🔍

CVSSv2info

AVACAuCIA
💳💳💳💳💳💳
💳💳💳💳💳💳
💳💳💳💳💳💳
VectorComplexityAuthenticationConfidentialityIntegrityAvailability
UnlockUnlockUnlockUnlockUnlockUnlock
UnlockUnlockUnlockUnlockUnlockUnlock
UnlockUnlockUnlockUnlockUnlockUnlock

VulDB Base Score: 🔍
VulDB Temp Score: 🔍
VulDB Reliability: 🔍

NVD Base Score: 🔍

Exploitinginfo

Class: Race condition
CWE: CWE-362
CAPEC: 🔍
ATT&CK: 🔍

Physical: Partially
Local: Yes
Remote: No

Availability: 🔍
Access: Public
Status: Attacked
Author: Matthew Daley
Programming Language: 🔍
Download: 🔍

EPSS Score: 🔍
EPSS Percentile: 🔍

KEV Added: 🔍
KEV Due: 🔍
KEV Remediation: 🔍
KEV Ransomware: 🔍
KEV Notice: 🔍

Price Prediction: 🔍
Current Price Estimation: 🔍

0-DayUnlockUnlockUnlockUnlock
TodayUnlockUnlockUnlockUnlock

Nessus ID: 74027
Nessus Name: Debian DSA-2928-1 : linux-2.6 - privilege escalation/denial of service/information leak
Nessus File: 🔍
Nessus Risk: 🔍
Nessus Family: 🔍
Nessus Port: 🔍

OpenVAS ID: 702926
OpenVAS Name: Debian Security Advisory DSA 2926-1 (linux - security update
OpenVAS File: 🔍
OpenVAS Family: 🔍

Qualys ID: 🔍
Qualys Name: 🔍

Exploit-DB: 🔍

Threat Intelligenceinfo

Interest: 🔍
Active Actors: 🔍
Active APT Groups: 🔍

Countermeasuresinfo

Recommended: Patch
Status: 🔍

Reaction Time: 🔍
0-Day Time: 🔍
Exposure Time: 🔍
Exploit Delay Time: 🔍

Patch: git.kernel.org

Timelineinfo

12/03/2013 🔍
04/29/2014 +147 days 🔍
05/03/2014 +4 days 🔍
05/03/2014 +0 days 🔍
05/05/2014 +2 days 🔍
05/06/2014 +1 days 🔍
05/07/2014 +1 days 🔍
05/07/2014 +0 days 🔍
05/07/2014 +0 days 🔍
05/08/2014 +1 days 🔍
05/12/2014 +4 days 🔍
05/16/2014 +4 days 🔍
05/26/2014 +10 days 🔍
12/19/2024 +3860 days 🔍

Sourcesinfo

Vendor: kernel.org

Advisory: n_tty: Fix n_tty_write crash when echoing in raw mode
Researcher: Jiri Slaby, Peter Hurley
Status: Confirmed
Confirmation: 🔍

CVE: CVE-2014-0196 (🔍)
GCVE (CVE): GCVE-0-2014-0196
GCVE (VulDB): GCVE-100-13145

OVAL: 🔍

X-Force: 93099 - Linux Kernel n_tty_write privilege escalation, High Risk
SecurityFocus: 67282 - RETIRED: Linux Kernel 'n_tty.c' Memory Corruption Vulnerability
Secunia: 58082 - Linux Kernel "n_tty_write()" Race Condition Vulnerability, Less Critical
OSVDB: 106646
SecurityTracker: 1030192 - Linux Kernel PTY Write Buffer Race Condition Lets Local Users Deny Service and Potentially Gain Elevated Privileges
Vulnerability Center: 44406 - Linux Kernel Through 3.14.3 DoS and Code Execution due to a Flaw in the n_tty_write Function, High

scip Labs: https://www.scip.ch/en/?labs.20161013
Misc.: 🔍
See also: 🔍

Entryinfo

Created: 05/06/2014 12:53
Updated: 12/19/2024 19:44
Changes: 05/06/2014 12:53 (104), 05/27/2017 10:45 (8), 06/19/2021 10:11 (3), 04/28/2024 15:56 (29), 09/09/2024 22:30 (1), 12/19/2024 19:44 (1)
Complete: 🔍
Cache ID: 216:D80:103

Discussion

No comments yet. Languages: en.

Please log in to comment.

Want to stay up to date on a daily basis?

Enable the mail alert feature now!