<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>ClearNet Security: Tag tuning</title>
    <link>http://blog.clearnetsec.com/articles/tag/tuning</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>maximizing nmap scans for accuracy</title>
      <description>&lt;p&gt;There have been some recent newsgroup postings about consistency problems with nmap results (especially when scanning over the internet).  In my experience, if you want the best chance of obtaining accurate nmap scan results, you need to:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;check the latency to your targets (ping some device on the target net block for awhile, what is the average rtt value?)
    &lt;ul&gt;
      &lt;li&gt;use the average to configure the --max_rtt_timeout nmap option (e.g. if your ping time is 300ms, you obviously want to set this option to more than 300ms to prevent nmap for missing an open port if/when a probe takes longer than 300ms. Maybe set it to 500ms or even higher. Speed suffers, but we're chasing accuracy) &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;if you can, check the available bandwidth limit for you and the target net (e.g. T3:45mbps, T1:1.544mbps, DSL, etc.)
    &lt;ul&gt;
      &lt;li&gt;use this to configure the --min-hostgroup and --max-hostgroup nmap options and the --min-parallelism and --max-parallelism options (i.e. the more bandwidth each side has available, the more hosts and ports you can scan in parallel). This can significantly reduce overall scan time while keeping accuracy as the highest priority. I typically use IPTraf to watch pps (packets per second) to guage my bandwidth usage. If my options are too aggressive (i.e. consuming too much bandwidth), I'll kill the current scan and start over with different tuning values. The objective here is to set --min-hostgroup and min-parallelism to something that both sides can handle without sacrificing accuracy. If bandwidth permits, I like to set min_parallelism to 100 (number of parallel SYN requests or whatever scan type you're doing). I've gone up to 300 for --min-hostgroup (had lots of bandwidth and plenty of server horsepower). You don't want to cause your scan server, the target, or any device the probes traverse to drop packets, so the more information you have about all the components involved the better you'll be able to tune these values. &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;if you can, verify there are no 'smart' devices impeding scans (e.g. IPS, rate limiting device, etc.) &lt;/li&gt;
  &lt;li&gt;run multiple nmap scans of the same target, preferably at different times of the day and different days of the week (e.g. nightly backups can saturate certain hosts/links which causes nmap to fail to discover open ports). I like to run multiple services scans (~1600 ports) and do one or two 65k scans depending on circumstances. If time permits, the confidence boost you get knowing you've maximized accuracy by running repeated scans is satisfying. It also shows your assiduity; you can tell your customer you fired off 5 scans at different times to obtain your final list of exposed services. If you missed something after repeated scans (assuming you used safe tuning values), something is likely wrong.&lt;/li&gt;
  &lt;li&gt;set --host_timeout to something you are comfortable with.
    &lt;ul&gt;
      &lt;li&gt;if you determine a scan may take 20 hours to perform a 65k port scan of the target device, then set this option accordingly. Note: you can use 's', 'm', or 'h' to specify seconds, minutes, or hours. &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;set --max-scan-delay to something low if nothing is impeding scans
    &lt;ul&gt;
      &lt;li&gt;I typically set this option to 0 because I'm confident in my other tuning values (no delay between probes, just fire them off)&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;While tuning nmap options can do lots of good things it is still important to verify your scan server can keep up. We've knocked down 8-way Opteron systems w/16GB of RAM, so optimal nmap options may not be realistic for your hardware. &lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;

</description>
      <pubDate>Wed, 03 May 2006 01:05:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:0f284715-f876-43ac-933c-561b64142161</guid>
      <author>tate@ClearNetSec.com (Tate Hansen)</author>
      <link>http://blog.clearnetsec.com/articles/2006/05/03/maximizing-nmap-scans-for-accuracy</link>
      <category>nmap</category>
      <category>tuning</category>
      <category>performance</category>
      <category>ClearNet Security</category>
      <category>Tate Hansen</category>
      <category>accuracy</category>
    </item>
    <item>
      <title>Which vulnerability tests did Nessus run?   How long did it take?  Which tests take the most time?</title>
      <description>&lt;p&gt;Which vulnerability tests did Nessus run?   How long did it take?  Which tests take the most time?&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.clearnetsec.com/roller/resources/cns/parseNessusdMessages.pl"&gt;Here is a quick perl piece&lt;/a&gt; I wrote awhile back to answer these questions. My main goal at the time was to find which vulnerability tests were consuming the most time. The script parsers the nessusd.messages file and generates an output which looks like the following (I added color to this sample to emphasize the different components): &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;[suse] &amp;gt; ./parseNessusdMessages.pl 10&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;===========================================================&lt;br /&gt;
  xx.xxx.78.65: &lt;span class="style1"&gt;completed checks = 2262&lt;/span&gt;: &lt;span class="style2"&gt;Time to complete host scan = 369.65 (0:6:9)&lt;/span&gt;&lt;br /&gt;
  68.785 (%18.608) invision_gallery_st_sql_injection.nasl&lt;br /&gt;
  55.707 (%15.070) lighttpd_cgi.nasl&lt;br /&gt;
  49.862 (%13.489) DDI_IIS_Compromised.nasl&lt;br /&gt;
  47.847 (%12.944) horde_detect.nasl&lt;br /&gt;
  31.121 (%8.419) rpc_portmap.nasl&lt;br /&gt;
  30.254 (%8.184) amanda_detect.nasl&lt;br /&gt;
  18.491 (%5.002) h323_detection.nasl&lt;br /&gt;
  17.578 (%4.755) dont_print_on_printers.nasl&lt;br /&gt;
  17.525 (%4.741) basilix_inc_files.nasl&lt;br /&gt;
  16.554 (%4.478) ventrilo_detect.nasl&lt;br /&gt;
  16.474 (%4.457) krb_pingpong.nasl&lt;br /&gt;
  &lt;em&gt;not showing remaining list... (only showing 10)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;===========================================================&lt;br /&gt;
  ===========================================================&lt;br /&gt;
  xx.xxx.217.250: &lt;span class="style1"&gt;completed checks = 2262&lt;/span&gt;: &lt;span class="style2"&gt;Time to complete host scan = 677.22 (0:11:17)&lt;/span&gt;&lt;br /&gt;
  224.901 (%33.209) office_files.nasl&lt;br /&gt;
  62.777 (%9.270) sql_injection.nasl&lt;br /&gt;
  61.661 (%9.105) mozilla_default_perms.nasl&lt;br /&gt;
  60.220 (%8.892) NetSphere.nasl&lt;br /&gt;
  55.007 (%8.122) shells.nasl&lt;br /&gt;
  47.335 (%6.990) mozilla_176.nasl&lt;br /&gt;
  46.044 (%6.799) bnc_auth_bypass.nasl&lt;br /&gt;
  45.214 (%6.676) qpopper2.nasl&lt;br /&gt;
  45.110 (%6.661) squid_dos.nasl&lt;br /&gt;
  44.425 (%6.560) dont_print_on_printers.nasl&lt;br /&gt;
  44.394 (%6.555) CA_License_Service_Stack_Overflow.nasl&lt;br /&gt;
  &lt;em&gt;not showing remaining list... (only showing 10)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;===========================================================&lt;br /&gt;
  ===========================================================&lt;br /&gt;
  xx.xxx.78.6: &lt;span class="style1"&gt;completed checks = 2350&lt;/span&gt;: &lt;span class="style2"&gt;Time to complete host scan = 647.36 (0:10:47)&lt;/span&gt;&lt;br /&gt;
  163.406 (%25.242) sendmail_ident.nasl&lt;br /&gt;
  163.162 (%25.204) traceroute.nasl&lt;br /&gt;
  120.236 (%18.573) nessus_detect.nasl&lt;br /&gt;
  106.080 (%16.387) ftp_backdoor.nasl&lt;br /&gt;
  101.724 (%15.714) mozilla_nntp_heap_overflow.nasl&lt;br /&gt;
  96.309 (%14.877) quote.nasl&lt;br /&gt;
  74.986 (%11.583) eserv_dir_traversal.nasl&lt;br /&gt;
  60.184 (%9.297) cfengine_authdiag.nasl&lt;br /&gt;
  53.321 (%8.237) crlinux_file_reading.nasl&lt;br /&gt;
  45.546 (%7.036) bnc_auth_bypass.nasl&lt;br /&gt;
  45.315 (%7.000) ircd_ignition_ircop_vuln2.nasl&lt;br /&gt;
&lt;em&gt;not showing remaining list... (only showing 10)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The script parses all the tests found in the nessusd.messages file which were executed (not skipped) and displays the results organized by target IP address. It also sorts and displays in descending order the vulnerability tests which consumed the most time. The parseNessusdMessages.pl takes a single argument which specifies how many vulnerability checks to display per IP address (i.e. in the above example, 10). Few notes: &lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;This works best if you start with a empty nessusd.messages file. Run a nessus scan and after it is complete then you can run the script to generate the output like above.&lt;/li&gt;
  &lt;li&gt;The nessusd.messages file is not always located in the same spot. You may have to modify the path in the script (likely locations include /opt/nessus/var/nessus/logs/nessusd.messages or /usr/local/var/nessus/logs/nessusd.messages). By default, you need root permission to view the nessusd.messages file. I often just copy the nessusd.messages (using sudo) file to my homedir and change the path in the script to check &amp;quot;~/nessusd.messages&amp;quot;.&lt;/li&gt;
  &lt;li&gt;The 1st column is the number of seconds the vulnerability test took followed by the percentage of overall time  (i.e. how long it took to scan the target IP).
&lt;/ul&gt;
&lt;p&gt;So, if you are in the business of tuning your Nessus scanner, then this script may provide you some value.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;

</description>
      <pubDate>Tue, 31 Jan 2006 23:41:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:609e993c-1ec7-4643-aca0-3e6b231c5f3a</guid>
      <author>tate@ClearNetSec.com (Tate Hansen)</author>
      <link>http://blog.clearnetsec.com/articles/2006/01/31/which-vulnerability-tests-did-nessus-run-how-long-did-it-take-which-tests-take-the-most-time</link>
      <category>nessus</category>
      <category>tuning</category>
      <category>ClearNet Security</category>
      <category>Tate Hansen</category>
      <category>nasl</category>
      <category>scripts</category>
    </item>
    <item>
      <title>$70,000 worth of new opteron servers for nmap scanning and  they suck?</title>
      <description>&lt;p&gt;&lt;img src="http://www.clearnetsec.com/roller/resources/cns/img_3.jpg" width="199" height="157" align="right" /&gt;&lt;/p&gt;
&lt;p&gt;We recently performed a relatively large TCP port scan for a  client; a full 65k SYN scan of ~70,000 IP addresses.&amp;nbsp; &lt;a href="http://www.insecure.org/nmap/index.html"&gt;Nmap&lt;/a&gt; is a great port scanner  and was our first choice.&amp;nbsp; We had two new  and beautiful &lt;a href="http://www.sun.com/servers/entry/v40z/specs.jsp"&gt;Sun  quad v40z dual core opteron servers&lt;/a&gt; (16GB of RAM each) dedicated to the  task.&amp;nbsp; We were under a restrictive change  control window and time was the limiting factor.&amp;nbsp; We broke the scans down like this:&lt;/p&gt;
&lt;ul type="disc"&gt;
  &lt;li&gt;Executed       8 unique nmap instances on each system (one for each &amp;lsquo;virtual&amp;rsquo; processor)&lt;/li&gt;
  &lt;li&gt;Divided       the scans on /24 blocks (the optimal breakdown would&amp;rsquo;ve been on a 100       boundary, but we ran with this)&lt;/li&gt;
  &lt;li&gt;Set       min_hostgroup to 100 (minimum number of devices to scan in parallel)&lt;/li&gt;
  &lt;li&gt;Set       min_parallelism to 100 (minimum number or ports to scan in parallel)&lt;/li&gt;
  &lt;li&gt;Set       max_rtt_timeout to 1250 (wait a maximum of 1.25 seconds to receive a reply       from a port query)&lt;/li&gt;
  &lt;li&gt;Other       command line options used (-vv: verbose, -sS: SYN Scan, -P0: no ICMP, -p:       port range)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All together, a single nmap statement looked like the  following: &lt;br /&gt;
  &lt;span class="style9"&gt;		/usr/local/bin/nmap  -vv -sS -P0 -p 1-65535 -n --min_hostgroup 100
  --max_rtt_timeout 1250 --min_parallelism 100  &amp;lt;a_/24_block&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;We paid close attention to the number of outbound pps  (packets per second) using &lt;a href="http://iptraf.seul.org/"&gt;iptraf&lt;/a&gt; for a  couple reasons:&amp;nbsp; To watch our bandwidth  utilizations to avoid ISP overage charges and to gain a rough baseline so we  could detect a problem.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.clearnetsec.com/roller/resources/cns/iptraf-dstat1.gif" width="561" height="352" /&gt;&lt;/p&gt;
&lt;p&gt;If I remember right, the outbound pps initially was between  2k and 4k per server.&amp;nbsp; Things were  rocking and it looked like we would sail through the port scans.&amp;nbsp; Alas, when doing a quick check after ~30  hours of scanning, we noticed the pps had slowed to ~550 per server.&amp;nbsp; We deduced nmap had some memory management  issues when used the way we crafted.&amp;nbsp;  Each nmap instance was consuming ~1.2GBytes of RAM, appeared to be  increasing, and the CPU idle time for all processors was a continuous 0.&amp;nbsp; This caught us off guard somewhat because we  had successfully performed an nmap TCP services scan (~1668 ports) of the  70,000 IP addresses in less than 40 hours.&amp;nbsp;  This was all on &lt;a href="http://www.novell.com/products/linuxenterpriseserver/"&gt;SuSE Linux  Enterprise Server 9&lt;/a&gt; (x86_64) with nmap version 3.93.&amp;nbsp; We knew now this was not going to be  easy.&amp;nbsp; The number of SYN requests to do  this is big, roughly:&amp;nbsp; 65,535 hosts x  65535 ports x 2 (number of port query attempts) = 8,589,672,450 outbound SYN  packets.&amp;nbsp; If we could sustain ~3,500  outbound pps on each server, then we could finish in approximately 15 days  (within the change control window).&amp;nbsp; At  1,100 total pps, it is ~90 days, ouch!&amp;nbsp; &lt;/p&gt;
&lt;p&gt;In the mix of this engagement, there was a timely posting on  the network security &lt;a href="http://www.securityfocus.com/archive/101"&gt;pen-test  newsgroup&lt;/a&gt; asking about scanning a large network with nmap in which &lt;a href="http://www.securityfocus.com/archive/101/416490"&gt;I posted a reply&lt;/a&gt;.&amp;nbsp; I subsequently received a &lt;a href="http://www.securityfocus.com/archive/101/418822/30/0/threaded"&gt;response from  Fyodor&lt;/a&gt; (the author of nmap) which not only confirmed our experiences but  also contained a link to an updated version to better enable nmap to handle this scenario (thanks Fyodor!!).&amp;nbsp; I  haven&amp;rsquo;t had a chance to use this updated version yet, but I&amp;rsquo;m excited to check  it out.&amp;nbsp; Also I am going to explore some  home grown scanners we used while building a vulnerability scan engine and play  around with the &lt;a href="http://www.doxpara.com/read.php/docs/scanrand_logs.html"&gt;scanrand&lt;/a&gt; and &lt;a href="http://www.unicornscan.org/"&gt;unicorn&lt;/a&gt; scanners.&amp;nbsp; This ended up being a great experience and a  wake-up call to verify the tools we depend on work at the scale we need before  accepting the next job. &lt;/p&gt;


</description>
      <pubDate>Tue, 27 Dec 2005 22:51:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:d76207a6-d266-444a-a2e4-f9ccf516233c</guid>
      <author>tate@ClearNetSec.com (Tate Hansen)</author>
      <link>http://blog.clearnetsec.com/articles/2005/12/27/70-000-worth-of-new-opteron-servers-for-nmap-scanning-and-they-suck</link>
      <category>nmap</category>
      <category>v40z</category>
      <category>port</category>
      <category>scanning</category>
      <category>tuning</category>
      <category>ClearNet Security</category>
      <category>Tate Hansen</category>
    </item>
  </channel>
</rss>
