<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>I'LL BE BACK (security)</title><link>http://ar0.me/</link><description></description><atom:link href="http://ar0.me/blog/en/categories/security.xml" type="application/rss+xml" rel="self"></atom:link><language>en</language><lastBuildDate>Sun, 22 May 2016 13:26:19 GMT</lastBuildDate><generator>Nikola &lt;http://getnikola.com/&gt;</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>How to prevent malicious usage of VMware ESXi 4.1 in NTP reflection DDoS attacks</title><link>http://ar0.me/blog/en/posts/2014/01/howto-prevent-malicious-usage-of-vmware-esxi-in-ntp-reflection-attacks.html</link><description>&lt;div&gt;&lt;p&gt;UPDATE: NTP in ESXi contains &lt;a href="http://support.ntp.org/bin/view/Main/SecurityNotice#Recent_Vulnerabilities"&gt;serious vulnerabilities&lt;/a&gt; and there is no official patches. I recommend to stop using ESXi altogether or disable the NTP service and accept the fact that the time will be inaccurate. December 24, 2014&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Several days ago I've got a message from our hosting company. It stated that one of our IP addresses was used in massive UDP DoS attack. Since that IP address does not belong to any VM and is actually assigned to VMware ESXi host itself, I started my investigation. As it turned out:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;VMware ESXi 4.1 was installed by hosting company (probably with default settings)&lt;/li&gt;
&lt;li&gt;ESXi is based on Linux and contains ntpd 4.2.4p6&lt;/li&gt;
&lt;li&gt;By some unknown reason, default ntpd settings allow anyone to query daemon status using "monlist" command&lt;/li&gt;
&lt;li&gt;Monlist is a remote command that sends the requester a list of the last 600 clients who have connected to that NTP server&lt;/li&gt;
&lt;li&gt;NTP uses UDP as an underlying protocol, therefore source address can be easily spoofed&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;By scanning internet address space, attackers gathered a list of NTP servers which allow querying their status. Then these servers were flooded with NTP monlist command sent from spoofed source address. This spoofed address belongs to the victim being attacked. Each NTP server responds with a list of the last 600 clients which is significantly larger than original request (one 40-byte-long request generates 18252 bytes worth of response traffic). This leads to significant amount of UDP traffic which can be directed by attacker to any destination.&lt;/p&gt;
&lt;h2&gt;How to verify if your server is vulnerable&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;$ ntpdc -c monlist 1.2.3.4&lt;/code&gt;&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre&gt;remote address          port local address      count m ver rstr avgint  lstint
===============================================================================
example.com            64059 1.2.3.4               52 7 2    590      0       0
host.example.com         123 1.2.3.4                1 4 4    590      0      57
....
&lt;/pre&gt;&lt;/div&gt;


&lt;h2&gt;How to fix&lt;/h2&gt;
&lt;h3&gt;1. Get access to local or remote (ssh) ESXi console&lt;/h3&gt;
&lt;p&gt;Launch VMware vSphere Client and connect to your ESXi server. On the "Configuration" tab open "Security Profile" and start "Local Tech Support" or "Remote Tech Support (SSH)" service. To use local mode you need either physical server access or remote KVM. For remote mode, SSH client is sufficient.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Configuration -&amp;gt; Security Profile" src="http://ar0.me/images/2014/01/11-esxi-ntp/configuration-security-profile.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="Tech Support" src="http://ar0.me/images/2014/01/11-esxi-ntp/local-tech-support.png"&gt;&lt;/p&gt;
&lt;h3&gt;2. Change NTP settings&lt;/h3&gt;
&lt;p&gt;Edit /etc/ntp.conf and add "noquery" to a line which contains "restrict default":&lt;/p&gt;
&lt;p&gt;&lt;img alt="Tech Support Console" src="http://ar0.me/images/2014/01/11-esxi-ntp/tech-support-console.png"&gt;&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre&gt;restrict default kod nomodify notrap noquery nopeer
restrict 127.0.0.1
server pool.ntp.org
driftfile /etc/ntp.drift
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Do not forget to restart NTP daemon:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;$ /etc/init.d/ntpd restart&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;And make sure it is running after restart:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;$ ps ax | grep ntp&lt;/code&gt;&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre&gt;&lt;span class="mi"&gt;1234&lt;/span&gt; &lt;span class="mi"&gt;1234&lt;/span&gt; &lt;span class="n"&gt;ntpd&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;sbin&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;ntpd&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;h3&gt;3. Verify that monlist command no longer works&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;$ ntpdc -c monlist 1.2.3.4&lt;/code&gt;&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre&gt;&lt;span class="mf"&gt;1.2.3.4&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;timed&lt;/span&gt; &lt;span class="n"&gt;out&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;nothing&lt;/span&gt; &lt;span class="n"&gt;received&lt;/span&gt;
&lt;span class="o"&gt;***&lt;/span&gt;&lt;span class="n"&gt;Request&lt;/span&gt; &lt;span class="n"&gt;timed&lt;/span&gt; &lt;span class="n"&gt;out&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;h2&gt;Other possible countermeasures&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Upgrade NTP to the latest version which do not contain "monlist" command (this is problematic on ESXi)&lt;/li&gt;
&lt;li&gt;Add ACL to inbound firewall or NTPD itself to allow only trusted clients&lt;/li&gt;
&lt;li&gt;Rate-limit responses to individual IP addresses&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In an ideal world every provider should filter spoofed packets at their source (spoofed address does not belong to provider's networks). This is described in detail in &lt;a href="http://www.bcp38.info/index.php/Main_Page"&gt;BCP38&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Related links&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.symantec.com/connect/blogs/hackers-spend-christmas-break-launching-large-scale-ntp-reflection-attacks"&gt;Hackers Spend Christmas Break Launching Large Scale NTP-Reflection Attacks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://arstechnica.com/security/2014/01/dos-attacks-that-took-down-big-game-sites-abused-webs-time-synch-protocol/"&gt;DoS attacks that took down big game sites abused Web’s time-sync protocol&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.cloudflare.com/technical-details-behind-a-400gbps-ntp-amplification-ddos-attack"&gt;Technical Details Behind a 400Gbps NTP Amplification DDoS Attack&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://isc.sans.org/forums/diary/NTP+reflection+attack/17300"&gt;NTP reflection attack&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cert.litnet.lt/en/docs/ntp-distributed-reflection-dos-attacks"&gt;NTP DoS reflection attacks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;amp;cmd=displayKC&amp;amp;externalId=1017910"&gt;Using Tech Support Mode in ESXi 4.1 and ESXi 5.x&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://kb.vmware.com/selfservice/microsites/search.do?cmd=displayKC&amp;amp;docType=kc&amp;amp;docTypeID=DT_KB_1_1&amp;amp;externalId=1017022"&gt;Editing configuration files in VMware ESXi and ESX&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;amp;cmd=displayKC&amp;amp;externalId=1036357"&gt;Enabling remote query of NTP service on ESX/ESXi 4.0&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Share this!&lt;/h2&gt;
&lt;blockquote class="tweetable"&gt;
&lt;p&gt;How to secure VMware ESXi host against being used in NTP amplification attacks (monlist command)?&lt;/p&gt;
&lt;p class="tweetable-buttons"&gt;&lt;a class="tweetable-button" title="Click to share on Twitter" href="https://twitter.com/share?text=How+to+secure+VMware+ESXi+host+against+being+used+in+NTP+amplification+attacks+%28monlist+command%29%3F+%23vmware+%23ddos&amp;amp;url=http%3A%2F%2Far0.me%2Fblog%2Fposts%2F2014%2F01%2Fhowto-prevent-malicious-usage-of-vmware-esxi-in-ntp-reflection-attacks.html" target="_blank"&gt;&lt;span class="fa fa-twitter-square"&gt;&lt;/span&gt;&lt;/a&gt;
&lt;a href="javascript:void(0)" title="Click to share on Google+" class="tweetable-button g-interactivepost" data-clientid="1076888313582-4aec6j1rgghifnvm8l7dc621d3ns3dbe.apps.googleusercontent.com" data-cookiepolicy="single_host_origin" data-contenturl="http://ar0.me/blog/posts/2014/01/howto-prevent-malicious-usage-of-vmware-esxi-in-ntp-reflection-attacks.html" data-calltoactionurl="http://ar0.me/blog/posts/2014/01/howto-prevent-malicious-usage-of-vmware-esxi-in-ntp-reflection-attacks.html" data-prefilltext="How to secure VMware ESXi host against being used in NTP amplification attacks (monlist command)? #vmware #ddos"&gt;&lt;span class="fa fa-google-plus-square"&gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class="tweetable-button" title="Copy the text, then click to share on Facebook" href="https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Far0.me%2Fblog%2Fposts%2F2014%2F01%2Fhowto-prevent-malicious-usage-of-vmware-esxi-in-ntp-reflection-attacks.html" target="_blank"&gt;&lt;span class="fa fa-facebook-square"&gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class="tweetable-button" title="Click to share on LinkedIn" href="http://www.linkedin.com/shareArticle?mini=true&amp;amp;url=http%3A%2F%2Far0.me%2Fblog%2Fposts%2F2014%2F01%2Fhowto-prevent-malicious-usage-of-vmware-esxi-in-ntp-reflection-attacks.html&amp;amp;title=How+to+secure+VMware+ESXi+host+against+being+used+in+NTP+amplification+attacks+%28monlist+command%29%3F" target="_blank"&gt;&lt;span class="fa fa-linkedin-square"&gt;&lt;/span&gt;&lt;/a&gt;
&lt;a class="tweetable-button" title="Click to share on VKontakte" href="https://vk.com/share.php?url=http%3A%2F%2Far0.me%2Fblog%2Fposts%2F2014%2F01%2Fhowto-prevent-malicious-usage-of-vmware-esxi-in-ntp-reflection-attacks.html&amp;amp;title=How+to+secure+VMware+ESXi+host+against+being+used+in+NTP+amplification+attacks+%28monlist+command%29%3F+%23vmware+%23ddos" target="_blank"&gt;&lt;span class="fa fa-vk"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;&lt;/div&gt;</description><category>esxi</category><category>vmware</category><category>security</category><guid>http://ar0.me/blog/en/posts/2014/01/howto-prevent-malicious-usage-of-vmware-esxi-in-ntp-reflection-attacks.html</guid><pubDate>Sat, 11 Jan 2014 03:18:00 GMT</pubDate></item></channel></rss>