<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Security Advancements at the Monastery &#187; Snort</title>
	<atom:link href="http://blog.securitymonks.com/category/snort/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.securitymonks.com</link>
	<description>Information about developments at the Monastery</description>
	<lastBuildDate>Fri, 03 Sep 2010 05:41:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Three Open Source IDS/IPS Engines: The Setup</title>
		<link>http://blog.securitymonks.com/2010/08/26/three-little-idsips-engines-build-their-open-source-solutions/</link>
		<comments>http://blog.securitymonks.com/2010/08/26/three-little-idsips-engines-build-their-open-source-solutions/#comments</comments>
		<pubDate>Thu, 26 Aug 2010 07:08:28 +0000</pubDate>
		<dc:creator>John Gerber</dc:creator>
				<category><![CDATA[Bro]]></category>
		<category><![CDATA[IDS]]></category>
		<category><![CDATA[OISF]]></category>
		<category><![CDATA[Snort]]></category>
		<category><![CDATA[Suricata]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[dumbpig]]></category>

		<guid isPermaLink="false">http://blog.securitymonks.com/2010/08/19/three-little-idsips-engines-build-their-open-source-solutions/</guid>
		<description><![CDATA[Confused over the different functionality and information IDS/IPS engines provide?  Are you looking for an open source solution?  There are options, each with different features and strengths.  To help determine what might work best in your environment, we will walk through the setup of three popular open source intrusion detection packages: Bro, [...]]]></description>
			<content:encoded><![CDATA[<p>Confused over the different functionality and information IDS/IPS engines provide?  Are you looking for an open source solution?  There are options, each with different features and strengths.  To help determine what might work best in your environment, we will walk through the setup of three popular open source intrusion detection packages: <a href="http://www.bro-ids.org">Bro</a>, <a href="http://www.snort.org">Snort</a>, and <a href="http://www.openinfosecfoundation.org">Suricata</a>.  Keep in mind, IDS/IPS engines are not simple setup and leave security solutions.  The systems need to be configured and tuned to the unique environment they are operating in.  While configuration and tuning are essential tasks, it will be considered outside the scope of this post.  In later posts, we will tune the systems and examine the results as we test out sample malicious traffic captures.  After trying the different open source IDS/IPS tools, the reader will be in a better position to judge how the software might meet the particular requirements of their organizations.</p>
<p><h2><b>Recent Controversy</b></h2>
</p>
<p>
There has been a bit of a verbal flare up between the folks behind Snort and Suricata.  Matt Jonkman, founder of <a href="http://www.emergingthreats.net">Emerging Threats</a> and OISF&#8217;s president, recent statement that &#8220;[Intrusion detection technology] has been stagnant for the last five years&#8221; [<a href="http://www.computerworld.com/s/article/9179436/DHS_vendors_unveil_open_source_intrusion_detection_engine">7</a>] did not sit well with Martin Roesch, Snort&#8217;s creator.  Roesch questioned Suricata&#8217;s stated benefits when he responded, &#8220;OISF has wrapped Suricata in some cool computer science concepts, but they have not delivered on their vision. [Suricata] offers a sub-set of Snort&#8217;s functionality at a fraction of its performance.&#8221; [<a href="http://www.networkworld.com/news/2010/072010-is-snort-dead.html?page=1<br />
">8</a>]  Roesch went on to say, &#8220;They&#8217;ve produced a clone of Snort that performs worse at taxpayer&#8217;s expense.&#8221;
</p>
<p>
Matt Olney, a senior research engineer for the Sourcefire Vulnerability Research Team (VRT) addressed the multi-threaded benefit when he wrote, &#8220;Trust me, if multi-threading were the answer, the industry would have moved there in short order.&#8221; [<a href="http://vrt-sourcefire.blogspot.com/2010/07/innovation-you-keep-using-that-word.html">10</a>]  Olney went on to quote results of an internal test pitting Snort against Suricata, &#8220;With rules loaded, Suricata runs up to about 200MB per second. Snort, with rules, hits 894MB per second with no drops.&#8221;
</p>
<p>
Jonkman questioned those finding when he wrote, &#8220;Those stats are ridiculous, and they refuse to publish details of the equipment and configuration used.&#8221;  Jonkman goes on to explain, &#8220;We know that we&#8217;re not, right now, cycle for cycle, faster than Snort &#8230; but we&#8217;re getting six times the performance as Snort on the same hardware, with version 1.0.&#8221;  Victor Julien, lead developer of Suricata, explain [<a href="http://www.inliniac.net/blog/2010/07/22/on-suricata-performance.html<br />
">14</a>], &#8220;Is Suricata faster than Snort on a single core cycle for cycle, tick for tick? No. It’s pretty clear we aren’t, I didn’t expect us to be either.  But we scale. We’ve had reports of running on a 32 core box and scaling to use all cores.&#8221;  Russ McRee, a senior security analyst / researcher and founder of holisticinfosec.org, adds, &#8220;Consider that an unnamed military body has tested Suricata versus Snort on a large scale platform (24 processors and 128GB of RAM) and saw a very clear 6-fold speed increase over a tuned Snort implementation on the same platform.&#8221;
</p>
<p><h2><b>Features</b><br />
</h2>
</p>
<p>
Russ McRee article on Suricata in August&#8217;s ISSA Journal [<a href="http://holisticinfosec.org/toolsmith/pdf/august2010.pdf">18</a>] contained a table comparing features, which we will add Bro information to:
</p>
<table border=1 cellspacing=5 cellpadding=5>
<tr>
<th>Features</th>
<th>Bro</th>
<th>Snort</th>
<th>Suricata</th>
</tr>
<tr>
<td>Multi-Threaded Processing</td>
<td>No</td>
<td>No</td>
<td>Yes</td>
</tr>
<tr>
<td>Complete IPv6 Support</td>
<td>Yes</td>
<td>Some</td>
<td>Complete</td>
</tr>
<tr>
<td>IP Reputation</td>
<td>Somewhat</td>
<td>No</td>
<td>Yes (soon)</td>
</tr>
<tr>
<td>Automated Protocol Detection</td>
<td>Yes</td>
<td>No</td>
<td>Yes</td>
</tr>
<tr>
<td>GPU Acceleration</td>
<td>No</td>
<td>No</td>
<td>Yes (soon)</td>
</tr>
<tr>
<td>Global Variables/Flowbits</td>
<td>Yes</td>
<td>No</td>
<td>Yes (soon)</td>
</tr>
<tr>
<td>Inline Windows Support</td>
<td>No</td>
<td>No</td>
<td>Yes</td>
</tr>
<tr>
<td>GeoIP Lookups</td>
<td>Yes</td>
<td>No</td>
<td>Yes (soon)</td>
</tr>
<tr>
<td>Advanced HTTP Parsing</td>
<td>Yes</td>
<td>No</td>
<td>Yes</td>
</tr>
<tr>
<td>HTTP Access Logging</td>
<td>Yes</td>
<td>No</td>
<td>Yes</td>
</tr>
<tr>
<td>SMB Access Logging</td>
<td>Planned</td>
<td>No</td>
<td>Yes (soon)</td>
</tr>
<tr>
<td>HTTP Blocklist Lookups</td>
<td>Yes</td>
<td>No</td>
<td>Yes (soon)</td>
</tr>
<tr>
<td>Free</td>
<td>Yes</td>
<td>Some</td>
<td>Yes</td>
</tr>
</table>
<p>
<a href="http://www.linkedin.com/in/sethh">Seth Hall</a>, Information Security Detection-Response Architect at GE (and one of the top Bro developers), addressed the above table and pointed out some of the strong features of Bro.  Seth writes:</p>
<blockquote>
<ul>
<li><b>Multithreaded processing</b>: Work is ongoing on this, but nothing releasable yet. Bro does have a fully functional cluster deployment model which helps users to scale support on a single box and/or across multiple boxes.</li>
<li><b>IPv6 Support</b>: Due to a bug, which hopefully will be addressed by the next release, IPv6 support is unusable in large scale production.</li>
<li><b>IP reputation</b>: You could say that Bro has IP reputation, it&#8217;s easy to utilize lists of addresses at least. I&#8217;m going to be working heavily on an intelligence sources framework for Bro soon too which will be able to consume a wide range of intelligence sources including IP addresses.</li>
<li><b>Automated protocol detection</b>: There&#8217;s even an academic paper about it [19] if you&#8217;d like to find out exactly how it works.</li>
<li><b>Global variables/flowbits</b>: Bro support for this sort of thing is far beyond what anything else has inherently because Bro has a complete programming language.</li>
<li><b>GeoIP lookups</b>: I added that myself several years ago. Bro supports IPv6 geoip lookups in addition to IPv4 and ASN lookups using another database for libGeoIP.</li>
<li><b>Advanced HTTP Parsing</b>: Bro has had it for years.</li>
<li><b>HTTP Access Logging</b>: Definitely. My script [20] will be included in the next release too.</li>
<li><b>SMB Access Logging</b>:  This is something that I&#8217;m planning on tackling soon. I don&#8217;t know what the level of support for SMB is currently, but there is a parser already.</li>
<li><b>HTTP Blocklist lookups</b>: Yes, I consider this similar to the IP reputation and it&#8217;s going to be included in the intelligence sources framework. Some usage of URL lists is already included in a script that I distribute separately [21] but which will be in the next release of Bro.</li>
<li><b>Free</b>:  Bro is under the BSD license, so in my opinion it&#8217;s actually more free than Snort or Suricata which are both under the GPL and much more difficult to share code with.</li>
</ul>
</blockquote>
<p>
While Snort and Suricata have been a bit in the public spotlight recently, the developers of Bro have stayed clear of the recent verbal debate.  Bro is the third open source IDS/IPS engine we will be working with.  It is primarily funded by the National Science Foundation&#8217;s Strategic Technologies for the Internet program.  Robin Sommer this week announced [<a href="http://blog.icir.org/2010/08/major-nsf-funding-for-bro-development.html">26</a>] that the International Computer Science Institute (ICSI) and the National Center for Supercomputing Applications (NCSA) have been awarded a grant of almost $3M for extensive Bro development.  To quote Robin:<br />
<blockquote>The funded project aims specifically at addressing much of the feedback that we have received from Bro users over the years. It will enable us to refine many of the rough edges that the system has accumulated over time[*], improve Bro&#8217;s performance significantly, and also make it much easier for the community to contribute to the project.</p></blockquote>
<p>Expect some interesting work from the Bro camp.  Some of Bro&#8217;s current stated features and benefits [<a href="http://www.bro-ids.org/Features.html">15</a>] include:</p>
<ul>
<li><strong>Network Based</strong>: Bro is a network-based IDS.  It collects, filters, and analyzes traffic that passes through a specific network location.  A single Bro monitor, strategically placed at a key network junction, can be used to monitor all incoming and outgoing traffic for the entire site.  Bro does not use or require installation of client software on each individual, networked computer.</li>
<li><strong>Rich Application-Layer Analysis</strong>: A primary feature of Bro is that it includes detailed, parser-driven analysis of many popular application protocols.  The output of these analyzers is a stream of events that describe observed activity in semantically rich, high-level terms.  These events themselves do <em>not</em> constitute security alerts, but rather provide the input for further, stateful processing using Bro&#8217;s custom scripting language.</li>
<li><strong>Custom Scripting Language</strong>: Bro policy scripts are programs written in the Bro language.  They contain the &#8220;rules&#8221; that describe what sorts of activities are deemed troublesome.  They analyze the network activity and initiate actions based on the analysis.  Although the Bro language takes some time and effort to learn, once mastered, the Bro user can write or modify Bro policies to detect and alert on virtually any type of network activity.
</li>
<li><strong>Pre-written Policy Scripts</strong>: Bro comes with a rich set of policy scripts designed to detect the most common Internet attacks while limiting the number of false positives, i.e., alerts that confuse uninteresting activity with the important attack activity.  These supplied policy scripts will run &#8220;out of the box&#8221; and do not require knowledge of the Bro language or policy script mechanics.</li>
<li><strong>Powerful Signature Matching Facility</strong>: Bro policies incorporate a signature matching facility that looks for specific traffic content.  For Bro, these signatures are expressed as regular expressions, rather than fixed strings.  Bro adds a great deal of power to its signature-matching capability because of its rich language.  This allows Bro to not only examine the network content, but to understand the context of the signature, greatly reducing the number of false positives.  Bro comes with a set of high value signatures policies, selected for their high detection and low false positive characteristics.</li>
<li><strong>Network Traffic Analysis</strong>: Bro not only looks for signatures, but can also analyze network protocols, connections, transactions, data amounts, and many other network characteristics.  It has powerful facilities for storing information about past activity and incorporating it into analyses of new activity. </li>
<li><strong>Detection Followed by Action</strong>: Bro policy scripts can generate output files recording the activity seen on the network (including normal, non-attack activity).  They can also generate problem alerts to event logs, including the operating system syslog facility.  In addition, scripts can execute programs, which can, in turn, send e-mail messages, page the on-call staff, automatically terminate existing connections, or, with appropriate additional software, insert access control blocks into a router&#8217;s access control list.  With Bro&#8217;s ability to execute programs at the operating system level, the actions that Bro can initiate are only limited by the computer and network capabilities that support Bro.</li>
</ul>
<p>
In my previous post, &#8220;Snort 3: The Next Generation&#8221; [<a href="http://blog.securitymonks.com/2008/10/20/snort-3-the-next-generation/">4</a>], Marty provided a roadmap of where Snort is heading.  While changes have since been made as Snort develops, the philosophy remains the same.  Sourcefire is moving forward on a solid security framework.  See the recent work on the Sourcefire&#8217;s Razorback framework [<a href="http://iweb.dl.sourceforge.net/project/razorbacktm/Whitepapers/razorback-whitepaper-0.1.pdf">24</a>] and [<a href="https://www.defcon.org/images/defcon-18/dc-18-presentations/Mullen-Pentney/DEFCON-18-Mullen-Pentney-Razorback.pdf">25</a>].  Olney described Razorback in this way [<a href="http://vrt-sourcefire.blogspot.com/2010/07/innovation-you-keep-using-that-word.html">10</a>], &#8220;It isn&#8217;t Snort, it isn&#8217;t ClamAV, and it isn&#8217;t Suricata.  It&#8217;s a new approach to the detection problem, and was built from the ground up in close collaboration with groups that are facing APT-level threats.  It may not be perfect, it may not even be the right answer (but we think it is), but it is truly innovative.&#8221;
</p>
<p>
More immediate, examine the the improved features Snort 2.9.0 Beta  [<a href="https://s3.amazonaws.com/snort.org/snort-beta/20100727/release_notes_290_beta.txt?AWSAccessKeyId=AKIAJJSHU7YNPLE5MKOQ&#038;Expires=1282246315&#038;Signature=jchbdD6d3G0ncaqOkrQAps6ZV5M%3D">16</a>]:</p>
<ul>
<li>Updates to HTTP Inspect to extract and log IP addresses from X-Forward-For and True-Client-IP header fields when Snort generates events on HTTP traffic.</li>
<li>Updates to SMTP preprocessor to support MIME attachment decoding across multiple packets.</li>
<li>Updates to the Snort packet decoders for IPv6 for improvements to anomaly detection.</li>
</ul>
<p>The new features include:</p>
<ul>
<li>Feature rich IPS mode including improvements to Stream for inline deployments.  Additionally a common active response API is used for all packet responses, including those from Stream, Respond, or React.  A new response module, respond3, supports the syntax of both resp &#038; resp2, including strafing for passive deployments.  When Snort is deployed inline, a new preprocessor<br />
has been added to handle packet normalization to allow Snort to interpret a packet the same way as the receiving host.</li>
<li>Use of a Data Acquisition API (DAQ) that supports many different packet access methods including libpcap, netfilterq, IPFW, and afpacket.  For libpcap, version 1.0 or higher is now required.  The DAQ library can be updated independently from Snort and is a separate module that Snort links to.</li>
<li>A new rule option &#8216;byte_extract&#8217; that allows extracted values to be used in subsequent rule options for isdataat, byte_test, byte_jump, and content distance/within/depth/offset.</li>
<li>Two new rule options to support base64 decoding of certain pieces of data and inspection of the base64 data via subsequent rule options.</li>
<li>Added a new pattern matcher that supports Intel&#8217;s Quick Assist  Technology for improved performance on supported hardware platforms.  Visit http://www.intel.com to find out more about Intel Quick Assist.</li>
</ul>
<p>Last, but not least, several characteristics OSIF report Suricata has to handle today&#8217;s threat are [<a href="http://www.businesswire.com/portal/site/home/permalink/?ndmViewId=news_view&#038;newsId=20100719005970&#038;newsLang=en<br />
">12</a>]:</p>
<ul>
<li class="bwlistitemmarginbottom">
     <b>An open source engine.</b> The power of the community works well<br />
     within IT security defenses, as a community is more effective than a<br />
     single organization at capturing characteristics of emerging threats.
    </li>
<li class="bwlistitemmarginbottom">
     <b>Multi-threaded.</b> A multi-threaded architecture allows the engine<br />
     to take advantage of the multiple core and multiple processor<br />
     architectures of today’s systems.
    </li>
<li class="bwlistitemmarginbottom">
     <b>Supports IP reputation.</b> By incorporating reputation <i>and</i><br />
     signatures into its engine, Suricata can flag traffic from known<br />
     nefarious origins.
    </li>
<li class="bwlistitemmarginbottom">
     <b>Automated protocol detection.</b> Preprocessors automatically<br />
     identify the protocol used in a network stream and apply the<br />
     appropriate rules, regardless of numerical port.
    </li>
</ul>
<p>
For additional background information, I have written several past posts on IDS/IPS (see &#8220;Suricata: A Next Generation IDS/IPS Engine&#8221; [<a href="http://blog.securitymonks.com/2010/01/05/suricata-a-next-generation-idsips-engine/">2</a>], &#8220;Installing Bro IDS 1.4&#8243; [<a href="http://blog.securitymonks.com/2008/10/28/installing-bro-ids-14/">3</a>], &#8220;Snort 3: The Next Generation&#8221; [<a href="http://blog.securitymonks.com/2008/10/20/snort-3-the-next-generation/<br />
">4</a>], “Blacklisting with Snort”, [<a href="http://blog.securitymonks.com/2009/07/19/blacklisting-with-snort/">17</a>], &#8220;IDS/IPS: The Mark Twain of the Security World&#8221; [<a href="http://blog.securitymonks.com/2008/08/09/idsips-the-mark-twain-of-the-security-world/">5</a>], and &#8220;IDS&#8221; [<a href="http://blog.securitymonks.com/2007/06/17/ids/">6]). I will not repeat that information in this post.<br />
</a>
</p>
<p><h2><b>Version</b></h2>
</p>
<p>
We will be setting these software packages up to be used on a development machine.  The exchange between the Snort and Suricata was focused on timing and features.  For that reason, I am interested in maximizing features verses stability.  We will be using the latest software, which may mean beta or even CVS versions.
</p>
<p><h2><b>Supporting Software</b></h2>
</p>
<p>
The three IDS/IPS engines share most of the supporting software requirements, depending on configuration options.  Below are a few required libraries and software packages:
</p>
<table border=1 width="90%">
<tr>
<th width=100 align=left>Package</th>
<th width=300 align=left>Description</th>
<th width=20 align=left>Required By</th>
</tr>
<tr>
<td><a href="http://sources.redhat.com/autobook/" onclick="javascript:pageTracker._trackPageview('/outbound/article/sources.redhat.com');">Autotools</a></td>
<td>The &#8220;autotools&#8221; consist of autoconf, automake, and libtool.  These will likely be installed on your system.  You need the autotools if you will be using source from the Bro&#8217;s Subversion repository.  You will need to run autogen.sh after you check out the code.  We will go through the steps below.
</td>
<td>Bro, Suricata</td>
</tr>
<tr>
<td><a href="http://www.isc.org/sw/bind/index.php" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.isc.org');">BIND8</a> headers and libraries</td>
<td>Most OSs will have BIND installed by default.  BIND (Berkeley Internet Name Domain) is an implementation of the Domain Name System (DNS) protocols.</td>
<td>Bro</td>
</tr>
<tr>
<td><a href="http://www.gnu.org/software/bison/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.gnu.org');">Bison </a>or byacc</td>
<td>Most OSs will have bison installed by default.  Bison is a general-purpose parser generator that converts an annotated context-free grammar into an LALR(1) or GLR parser for that grammar.</td>
<td>Bro, Suricata</td>
</tr>
<tr>
<td><a href="http://flex.sourceforge.net/" onclick="javascript:pageTracker._trackPageview('/outbound/article/flex.sourceforge.net');">Flex</a></td>
<td>Most OSs will have flex installed by default. Flex is a tool for generating scanners. A scanner, sometimes called a tokenizer, is a program which recognizes lexical patterns in text.</td>
<td>Bro, Suricata</td>
</tr>
<tr>
<td><a href="http://libdnet.sourceforge.net/" >Libdnet</a></td>
<td>Libdnet provides a simplified, portable interface to several low-level networking routines.</td>
<td>Snort</td>
</tr>
<tr>
<td><a href="http://www.tcpdump.org/#latest" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.tcpdump.org');">Libpcap</a></td>
<td>Most OSs will have libpcap installed by default.  It is the packet capture library.  You may need to install it with support large files (files large than 2G).   If you have a Linux kernnel, you will want to configure libpcap for PF_RING support.</td>
<td>Bro, Snort, Suricata</td>
</tr>
<tr>
<td><a href="http://pyyaml.org/wiki/LibYAML">LibYAML</a></td>
<td>LibYAML is a YAML parser and emitter written in C that is used to parse the configuration file.</td>
<td>Suricata</td>
</tr>
<tr>
<td><a href="http://www.pcre.org/" >PCRE</a></td>
<td>The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5.</td>
<td>Snort</td>
</tr>
</table>
<p>
Below are a few libraries and software packages that are not required, but you should consider installing.  The packages, except GeoIP and Google Perftools, should have binaries available for your OS.  Use these ports to install the packages and save yourself the trouble of having to keep the software updated.  We will go through through the installation of GeoIP and Google Perftools from source code.
</p>
<table border=1 width="90%">
<tr>
<th width=100 align=left>Package</th>
<th width=300 align=left>Description</th>
<th width=20 align=left>Required By</th>
</tr>
<tr>
<td><a href="http://www.gnupg.org" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.gnupg.org');">GnuPG</a></td>
<td>Free implementation of the OpenPGP standard. </td>
<td>Bro, Suricata</td>
</tr>
<tr>
<td><a href="http://people.redhat.com/sgrubb/libcap-ng/">libcap-ng</a></td>
<td> The libcap-ng library is intended to make programming with posix capabilities much easier than the traditional libcap library.</td>
<td>Suricata</td>
</tr>
<tr>
<td><a href="http://www.maxmind.com/app/ip-lo" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.maxmind.com');">LibGeoIP</a></td>
<td>ability to determine the location of IP addresses.</td>
<td>Bro, Suricata (Future)</td>
</tr>
<tr>
<td>Libmagic</td>
<td>Add ability to determine file types, as with the ftp analyzer.</td>
<td>Bro</td>
</tr>
<tr>
<td><a href="http://github.com/sam-github/libnet">libnet</a></td>
<td>Libnet is a generic networking API that provides access to several protocols.</td>
<td>Suricata</td>
</tr>
<tr>
<td><a href="http://www.netfilter.org/projects/libnetfilter_queue/index.html">libnetfilter_queue</a> </td>
<td>libnetfilter_queue is a userspace library providing an API to packets that have been queued by the kernel packet filter. </td>
<td>Suricata</td>
</tr>
<tr>
<td><a href="http://www.netfilter.org/projects/libnfnetlink/index.html">libnfnetlink</a></td>
<td>libnfnetlink is the low-level library for netfilter related kernel/userspace communication. It provides a generic messaging infrastructure for in-kernel netfilter subsystems (such as nfnetlink_log, nfnetlink_queue, nfnetlink_conntrack) and their respective users and/or management tools in userspace. </td>
<td>Suricata</td>
</tr>
<tr>
<td><a href="http://www.openssl.org/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.openssl.org');">OpenSSL</a></td>
<td>Tough to image a system not having OpenSSL installed.  It is needed to analyze ssh certificates by the HTTP analyzer and for encrypted Bro to Bro communication.</td>
<td>Bro</td>
</tr>
<tr>
<td><a href="http://www.ntop.org/PF_RING.html">PF_RING</a></td>
<td>PF_RING is a new type of network socket that dramatically improves the packet capture speed.</td>
<td>Bro, Snort, Suricata</td>
</tr>
<tr>
<td><a href="http://www.zlib.net/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.zlib.net');">zLib</a></td>
<td>Libz is a compression library. It is used for decompressing HTTP bodies by the HTTP analyzer, and for compressed Bro-to-Bro communication.</td>
<td>Bro</td>
</tr>
<tr>
<td>XML Analyzer</td>
<td>The XML analyzer is highly-experimental code written by Tobias Kiesling.  Installation of <a href="http://xerces.apache.org/xerces-c/">Xerces-C++</a> and <a href="http://xqilla.sourceforge.net/HomePage">XQilla</a> are required to use the <a href="http://www.bro-ids.org/wiki/index.php/XML_Analyzer" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.bro-ids.org');">XML analyzer</a>.  The code allows you to be able to easily adjust analysis capabilities to specific XML data formats. Xerces-C++ is a validating XML parser written in a portable subset of C++.  XQilla is an XQuery and XPath 2 library and command line utility written in C++.
</td>
<td>Bro, Suricata (Future)</td>
</tr>
</table>
<h2><b>Installing Supporting Software</b></h2>
<p>Which libraries and supporting software you install will be dependent on which options you use in configuring your IDS/IPS engines.  If you can install packages (and not source), carefully consider this option.  It will make maintenance easier.  We will walk through the source installation for demonstration purposes.
</p>
<p><h4><b>Libcap-ng</b></h4>
</p>
<p>
For Linux users, the libcap-ng will be required for dropping privileges.
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode>
root# cd /usr/local/src
/usr/local/src root# wget http://people.redhat.com/sgrubb/libcap-ng/libcap-ng-0.6.4.tar.gz
/usr/local/src root# tar libcap-ng-0.6.4.tar.gz
/usr/local/src  root# cd libcap-ng-0.6.4
/usr/local/src/libcap-ng-0.6.4 root# ./configure
/usr/local/src/libcap-ng-0.6.4 root# make
/usr/local/src/libcap-ng-0.6.4 root# make install
</pre>
</td>
</tr>
</tbody>
</table>
<p><h4><strong>Libdnet</strong></h4>
</p>
<p>Make sure Libdnet is in your library path:
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode> root# /sbin/ldconfig -p | grep -i libdnet
libdnet32.so.1 (libc6) =&gt; /usr/lib/libdnet32.so.1
libdnet32.so (libc6) =&gt; /usr/lib/libdnet32.so
</pre>
</td>
</tr>
</tbody>
</table>
<p>
If you do not get a path returned, you will need to install libdnet (use &#8211;prefix if it needs to be installed in a special location).  We will pull down it down the CVS version, because we will need the sctp.h file to be installed.
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode>
root# cd /usr/local/src
/usr/local/src root# wget svn checkout http://libdnet.googlecode.com/svn/trunk/ libdnet-cvs
/usr/local/src root# cd libdnet-cvs
/usr/local/src/libdnet-cvs root# ./configure
/usr/local/src/libdnet-cvs root# make
/usr/local/src/libdnet-cvs root# make install
/usr/local/src/libdnet-cvs root# cp include/dnet/sctp.h /usr/local/include/dnet
</pre>
</td>
</tr>
</tbody>
</table>
<p>
If you have installed libdnet in a special location, make sure to include its path in /etc/ld.so.conf.
</p>
<p><h4><b>Libnet</b></h4>
</p>
<p>
The library libnet will be required for packet-injecting.
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode>
root# cd /usr/local/src
/usr/local/src root# wget http://github.com/sam-github/libnet/tarball/libnet-1.1.4 \
-O  libnet-1.1.4.tgz
/usr/local/src root# tar xzf libnet-1.1.4.tgz
/usr/local/src root# cd sam-github-libnet-d2bedb5
/usr/local/src/sam-github-libnet-d2bedb5 root# ./autogen.sh
/usr/local/src/sam-github-libnet-d2bedb5 root# ./configure
/usr/local/src/sam-github-libnet-d2bedb5 root# make
/usr/local/src/sam-github-libnet-d2bedb5 root# make install
</pre>
</td>
</tr>
</tbody>
</table>
<p><h4><b>Libnfnetlink and Libnetfilter</b></h4>
</p>
<p>
If you plan on using the IPS capabilities (inline support), you will need to install libnfnetlink and libnfnetlink-queue.
</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
root# cd /usr/local/src
/usr/local/src root# wget \
ftp://ftp.netfilter.org/pub/libnfnetlink/snapshot/libnfnetlink-20100823.tar.bz2
/usr/local/src root# bunzip2 libnfnetlink-20100823.tar.bz2
/usr/local/src root# tar xf libnfnetlink-20100823.tar
/usr/local/src root# cd libnfnetlink-20100823
/usr/local/src/libnfnetlink-20100823 root# ./autogen.sh
/usr/local/src/libnfnetlink-20100823 root# ./configure
/usr/local/src/libnfnetlink-20100823 root# make
/usr/local/src/libnfnetlink-20100823 root# make check
/usr/local/src/libnfnetlink-20100823 root# make install
/usr/local/src/libnfnetlink-20100823 root# cd /usr/local/src
/usr/local/src root# wget \
ftp://ftp.netfilter.org/pub/libnetfilter_queue/snapshot/libnetfilter_queue-20100824.tar.bz2
/usr/local/src root# md5sum libnetfilter_queue-20100824.tar.bz2
69ce1eb24632bfed050cd936e0fe660c  libnetfilter_queue-20100824.tar.bz2
/usr/local/src root# bunzip2 libnetfilter_queue-20100824.tar.bz2
/usr/local/src root# tar xf libnetfilter_queue-20100824.tar
/usr/local/src root# cd libnetfilter_queue-20100824
/usr/local/src/libnetfilter_queue-20100824 root# ./autogen.sh
/usr/local/src/libnetfilter_queue-20100824 root# PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ ./configure
/usr/local/src/libnetfilter_queue-20100824 root# make
/usr/local/src/libnetfilter_queue-20100824 root# make check
/usr/local/src/libnetfilter_queue-20100824 root# make install
</pre>
</td>
</table>
<p><h4><strong>Libpcap and PF_RING</strong></h4>
</p>
<p>
<a href="http://blog.securitymonks.com/wp-content/uploads/2010/08/PF_RING1.png"><img src="http://blog.securitymonks.com/wp-content/uploads/2010/08/PF_RING1.png" align="right" width=200 /></a>If you are running on a system with a Linux kernels 2.6.x or greater, you will want to install PF_RING on your system.  PF_RING is a network socket that can greatly improve packet capture speed.  PF_RING polls packets from NICs by means of Linux NAPI.  NAPI (&#8220;New API&#8221;) is a modification to the device driver packet processing framework, which is designed to improve the performance of high-speed networking. NAPI copies packets from the NIC to PF_RING circular buffer.  The application then reads packets from the ring.  PF_RING can distribute incoming packets to multiple rings (hence multiple applications) simultaneously. Please see &#8220;Exploiting Commodity Multicore Systems for Network Traffic Analysis&#8221; [<a href =”http://luca.ntop.org/MulticorePacketCapture.pdf”>23</a>] for additional information.
</p>
<p>
We are going to walk through a specific example with certain ethernet card drivers and a particular linux kernel.  Please make sure not to copy the commands blindly.  Adjust to your system.  The below is for demonstration purposes.  These steps are based on Gunjan Bansal blog [<a href="http://gunjan-bansal.blogspot.com/2010/06/installation-guide-for-pfring.html">22</a>].  Please see Gunjan’s blog for additional explanation.
</p>
<p>
First step, provide some basic information on the system.
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode>
root# /sbin/ifconfig -a
<b>eth0</b>      Link encap:Ethernet  HWaddr 00:00:00:00:00:00
root# /sbin/ethtool -i <b>eth0</b>
driver: <b>e1000e</b>
version: 1.0.2-k3.1
firmware-version: 1.3-1
bus-info: 0000:00:19.0
root# /bin/uname -r
<b>2.6.18-194.8.1.el5PAE</b>
</pre>
</td>
</tr>
</tbody>
</table>
<p>
In this example I will be working off the ethernet interface <b>eth0</b> and the ethernet driver <b>e1000e</b>.  The kernel release is <b>2.6.18-194.8.1.el5PAE</b>.
</p>
<p>
Second step is to download the PF_RING software from ntop through the SVN repository, configure, compile, and install.  The “/sbin” directory will need to be in your PATH or you will get a complaint about “ldconfig: Command not found.”
</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
root# cd /usr/local/src
root# PATH=$PATH:/sbin
/usr/local/src root# mkdir pf_ring &#038;&#038; cd pf_ring
/usr/local/src/pf_ring root# svn co https://svn.ntop.org/svn/ntop/trunk/PF_RING/
/usr/local/src/pf_ring root# cd PF_RING/kernel
/usr/local/src/pf_ring/PF_RING/kernel root# make
/usr/local/src/pf_ring/PF_RING/kernel root# make install
/usr/local/src/pf_ring/PF_RING/kernel root# cd ../userland/lib
/usr/local/src/pf_ring/PF_RING/userland/lib root# make
/usr/local/src/pf_ring/PF_RING/userland/lib root# make install
</pre>
</td>
</table>
<p>
Under some OSs, you need to compile <a href="http://www.tcpdump.org/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.tcpdump.org');">libpcap</a> to support large files (files large than 2G). We are going to install the resulting libpcap under /usr/local. Large file support is required if the following kind of error is produced:
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode>
root# ls -lh /data/ids/full2.pcap
-rw-r--r-- 1 root root 12G Oct 26 10:01 /data/ids/full2.pcap
root# /usr/local/snort/bin/snort -o -A none -c \
/usr/local/snort/conf/snort.conf -l /logs/snort/logs \
-r /data/ids/full2.pcap
Error getting stat on pcap file: /data/ids/full2.pcap:
Value too large for defined data type
ERROR: Error getting pcaps
Fatal Error, Quitting..
</pre>
</td>
</tr>
</tbody>
</table>
<p>
To compile large file support into libpcap:
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode>
/usr/local/src/pf_ring/PF_RING/userland/lib root# cd ../libpcap-1.0.0-ring/
/usr/local/src/pf_ring/userland/libpcap-1.0.0-ring root# ./configure --prefix=/usr/local \
CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
-D_FILE_OFFSET_BITS=64"
/usr/local/src/pf_ring/userland/libpcap-1.0.0-ring root# make
/usr/local/src/pf_ring/userland/libpcap-1.0.0-ring root# make shared
/usr/local/src/pf_ring/userland/libpcap-1.0.0-ring root# make install
/usr/local/src/pf_ring/userland/libpcap-1.0.0-ring root# make install-shared
</pre>
</td>
</tr>
</tbody>
</table>
<p>
By configuring tcpdump with support for PF_RING, all applications (tcpdump and our IDS/IPS engines) will be able to access simultaneously the PF_RING circular buffer.
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode>
/usr/local/src/pf_ring/userland/libpcap-1.0.0-ring root# cd ../tcpdump-4.0.0
/usr/local/src/pf_ring/userland/tcpdump-4.0.0 root# CFLAGS="-D_LARGEFILE_SOURCE \
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" LDFLAGS="-lpfring -lpcap" LD_LIBRARY_PATH="/usr/lib:/usr/local/lib" ./configure
/usr/local/src/pf_ring/userland/tcpdump-4.0.0 root# make
/usr/local/src/pf_ring/userland/tcpdump-4.0.0 root# make install
</pre>
</td>
</tr>
</tbody>
</table>
<p>
Replace the ethernet driver.
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode>
/usr/local/src/pf_ring/userland/tcpdump-4.0.0 root# cd ../../drivers/intel/<b>e1000e</b>-1.0.15/src
/usr/local/src/pf_ring/PF_RING/drivers/intel/<b>e1000e</b>-1.0.15/src root# make
/usr/local/src/pf_ring/PF_RING/drivers/intel/<b>e1000e</b>-1.0.15/src root# make install
</pre>
</td>
</tr>
</tbody>
</table>
<p>
The third step is to activate PF_RING if its not already activated.  Use lsmod to check if pf_ring is started or not.
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode>
/usr/local/src/pf_ring/PF_RING/drivers/intel/<b>e1000e</b>-1.0.15/src root# /sbin/lsmod | grep pf_ring
pf_ring                46680  0
/usr/local/src/pf_ring/PF_RING/drivers/intel/<b>e1000e</b>-1.0.15/src root# cd \
/lib/modules/<b>2.6.18-194.8.1.el5PAE</b>/kernel/net/pf_ring
/lib/modules/<b>2.6.18-194.8.1.el5PAE</b>/kernel/net/pf_ring root# /sbin/insmod \
pf_ring.ko transparent_mode=1
/lib/modules/<b>2.6.18-194.8.1.el5PAE</b>/kernel/net/pf_ring root# cd \
../../drivers/net/<b>e1000e</b>
</pre>
</td>
</tr>
</tbody>
</table>
<p>
Step four, you will unload the ethernet card driver (<b>e1000e</b>) and load the new driver.  Keep in mind, unloading the driver means ethernet access will be lost.  It is wise not to issue this command remotely.
</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
/lib/modules/2.6.18-194.8.1.el5PAE/kernel/drivers/net/<b>e1000e</b> root# /sbin/rmmod \
<b>e1000e</b> ; /sbin/insmod <b>e1000e</b>.ko
</pre>
</td>
</table>
<p>
You now are PF_RING enabled.
</p>
<p><h4>LibYAML</h4>
</p>
<p>
The yaml library will be required for parsing Suricata configuration file.
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode>
root# cd /usr/local/src
/usr/local/src root# wget http://pyyaml.org/download/libyaml/yaml-0.1.3.tar.gz
/usr/local/src root# tar xzf yaml-0.1.3.tar.gz
/usr/local/src root# cd yaml-0.1.3
/usr/local/src/yaml-0.1.3 root# ./configure
/usr/local/src/yaml-0.1.3 root# make
/usr/local/src/yaml-0.1.3 root# make check
/usr/local/src/yaml-0.1.3 root# make install
</pre>
</td>
</tr>
</tbody>
</table>
<p><h4><b>GeoIP Installation and Configuration</b></h4>
</p>
<p>
<a href="http://www.maxmind.com/app/ip-lo" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.maxmind.com');">MaxMind GeoIP</a> is a collection of APIs for looking up the location of an IP address.  There is a collection of <a href="http://www.maxmind.com/app/geolitecity" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.maxmind.com');">free GeoLite databases</a>, which are not as accurate as the GeoIP databases, but will do for starting out and testing with Bro.  To setup GeoIP for use with Bro, please follow the commands below.
</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
root# cd /usr/local/src
/usr/local/src root# wget http://www.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
/usr/local/src root# gunzip GeoLiteCity.dat.gz
/usr/local/src root# mkdir -p /usr/local/share/GeoIP
/usr/local/src root# mv GeoLiteCity.dat /usr/local/share/GeoIP/GeoIPCity.dat
/usr/local/src root# wget http://www.maxmind.com/download/geoip/api/c/GeoIP.tar.gz
/usr/local/src root# tar xzf GeoIP.tar.gz
/usr/local/src root# cd  GeoIP-1.4.6
/usr/local/src/GeoIP-1.4.6 root# ./configure
/usr/local/src/GeoIP-1.4.6 root# make
/usr/local/src/GeoIP-1.4.6 root# make check
/usr/local/src/GeoIP-1.4.6 root# make install
</pre>
</td>
</table>
<p>
Make sure <strong>/usr/local/lib</strong> is placed into your library path.
</p>
<p><h4><b>Google Perftools Installation and Configuration</b></h4>
</p>
<p>
Google&#8217;s perftools is a collection of a high-performance multi-threaded malloc() implementation and some performance analysis tools.  Google&#8217;s perftools have replaced mpatrol for leak-checking and heap-profiling.  We will compile Bro with <strong>&#8211;enable-perftools</strong>.  By default, perftools will install under /usr/local directory.  With perftools compiled into Bro, there are two command-line options made available:
</p>
<table border=1 width="90%">
<tr>
<th width=40 align=left>Option</th>
<th width=360 align=left>What the option controls</th>
</tr>
<tr>
<td>-m</td>
<td>turns on leak checking of the main packet loop, with some uninteresting leaks are suppressed.  Currently, with one exception (the RPC analyzer; problem not yet found), it reports no leaks when running the test suite.</td>
</tr>
<tr>
<td>-M</td>
<td>turns on heap profiling: Bro will take a snapshot of the heap before starting the main packet loop and another one when finished.</td>
</tr>
</table>
<p>
To help with the installation of Google&#8217;s perftool, the ICSI Networking Group has written a post &#8220;<a href="http://blog.icir.org/2008/02/making-sure-your-bro-code-does-not-leak.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/blog.icir.org');">Making Sure Your Bro Code Does Not Leak</a>.&#8221;  The post will provide additional information.  The basic steps to install perftools are:
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode>
root# cd /usr/local/src
/usr/local/src root# wget http://google-perftools.googlecode.com/files/google-perftools-1.6.tar.gz
/usr/local/src root# tar xzf google-perftools-1.6.tar.gz
/usr/local/src root# cd google-perftools-1.6
/usr/local/src/google-perftools-1.6 root# ./configure
/usr/local/src/google-perftools-1.6 root# make
/usr/local/src/google-perftools-1.6 root# make check
/usr/local/src/google-perftools-1.6 root# make install
</pre>
</td>
</tr>
</tbody>
</table>
</p>
<p>
<h4><strong>PCRE (pcre-8.10)</strong></h4>
</p>
<p>The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5. If you can install PCRE via a binary specific to your operating system, that is the best way to install in order to avoid having to keep the software up-to-date. Below are the instructions for installing the software from source.
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode>
root# cd /usr/local/src
/usr/local/src root# wget \
<a class=moz-txt-link-freetext href="http://downloads.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.tar.gz">http://downloads.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.tar.gz</a>
/usr/local/src root# wget \
<a class=moz-txt-link-freetext href="http://sourceforge.net/projects/pcre/files/pcre/8.10/pcre-8.10.tar.gz.sig/download">http://sourceforge.net/projects/pcre/files/pcre/8.10/pcre-8.10.tar.gz.sig/download</a>
/usr/local/src root# gpg --verify pcre-8.10.tar.gz.sig pcre-8.10.tar.gz
/usr/local/src root# tar xzf pcre-8.10.tar.gz
/usr/local/src root# cd pcre-8.10
/usr/local/src/pcre-8.10 root# ./configure --prefix=/usr/local/pcre
/usr/local/src/pcre-8.10 root# make
/usr/local/src/pcre-8.10 root# make test
/usr/local/src/pcre-8.10 root# make install
</pre>
</td>
</tr>
</tbody>
</table>
<p><h4><b>XML Analyzer</b></h4>
</p>
<p>
The XML analyzer is highly-experimental code written by Tobias Kiesling.  Installation of Xerces-C++ and XQilla is required to use the <a href="http://www.bro-ids.org/wiki/index.php/XML_Analyzer" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.bro-ids.org');">XML analyzer</a>.  The code allows you to be able to easily adjust analysis capabilities to specific XML data formats. Xerces-C++ is a validating XML parser written in a portable subset of C++.  XQilla is an XQuery and XPath 2 library and command line utility written in C++.
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode>
root# cd /usr/local/src
/usr/local/src root# wget http://downloads.sourceforge.net/xqilla/XQilla-2.2.4.tar.gz
/usr/local/src root# wget http://mirror.its.uidaho.edu/pub/apache/xerces/c/3/sources/xerces-c-3.1.1.tar.gz
/usr/local/src root#  md5sum xerces-c-3.1.1.tar.gz
6a8ec45d83c8cfb1584c5a5345cb51ae  xerces-c-3.1.1.tar.gz
/usr/local/src root# tar xzf xerces-c-3.1.1.tar.gz
/usr/local/src root# tar xzf XQilla-2.2.4.tar.gz
/usr/local/src root# ln -s XQilla-2.2.4 xqilla
/usr/local/src root# cd  xerces-c-3.1.1
/usr/local/src/xerces-c-3.1.1 root# ./configure
/usr/local/src/xerces-c-3.1.1 root# make
/usr/local/src/xerces-c-3.1.1 root# make check
/usr/local/src/xerces-c-3.1.1 root# make install
</pre>
</td>
</tr>
</tbody>
</table>
<p>
With Xerces-C++, configure and install XQilla.
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode>
root# cd /usr/local/src/xqilla/
/usr/local/src/xqilla root# ./configure --with-xerces=/usr/local/src/xerces-c-3.1.1/
/usr/local/src/xqilla root# make
/usr/local/src/xqilla root# make install
</pre>
</td>
</tr>
</tbody>
</table>
<p><h2><b>Bro Setup</b></h2>
</p>
<p>
We will be working off the instructions previously posted in &#8220;Installing Bro IDS 1.4&#8243; [<a href="http://blog.securitymonks.com/2008/10/28/installing-bro-ids-14/">3</a>], just updating the material to reflect the requirements of the current Bro software.  There a few options when installing Bro.  Bro was not developed for the <a href="http://en.wikipedia.org/wiki/Pointy_Haired_Boss" onclick="javascript:pageTracker._trackPageview('/outbound/article/en.wikipedia.org');">PHB</a>.  Advance security software provides the power to the user, with all the options to adapt it to your environment.  To quote the Bro site, &#8220;Bro has been developed primarily as a research platform for intrusion detection and traffic analysis. It is not intended for someone seeking an &#8216;out of the box&#8217; solution. Bro is designed for use by Unix experts who place a premium on the ability to extend an intrusion detection system with new functionality as needed, which can greatly aid with tracking evolving attacker techniques as well as inevitable changes to a site&#8217;s environment and security policy requirements.&#8221;  With the Unix experts in mind, we will go through the steps involved to install both the stable and the development versions of Bro.  </p>
<h4><strong>Current Stable Version</strong></h4>
<p>The current version should be the most stable.  To install, follow these commands:
</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
root# cd /usr/local/src
/usr/local/src root# wget ftp://bro-ids.org/bro-1.5-release.tar.gz
/usr/local/src root# tar xzf bro-1.5-release.tar.gz
/usr/local/src root# cd bro-1.5.1
</pre>
</td>
</table>
<p>
The configuration and installations appears below.
</p>
<p><h4><strong>Subversion Trunk</strong></h4>
</p>
<p>
Reading the posts on the <a href="http://mailman.icsi.berkeley.edu/pipermail/bro/" onclick="javascript:pageTracker._trackPageview('/outbound/article/mailman.icsi.berkeley.edu');">Bro mailing list</a>, reveals that modifications have already been made to the current release.  Fixes are being made continuously.  These changes, while fixing problems, might introduce new problems.  You do have the option of getting the most up-to-date code possible through the subversion repository.  The Bro development team has made available two subparts of the repository: the trunk and development branches.  The trunk is the main development head from which releases are made on a regular basis.  It should be fairly stable with changes passing a regression suite to ensure the code do not break existing functionality.  It is still considered experimental and not suitable for critical deployment.  Below is how to download code from the trunk.
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode>
root# cd /usr/local/src
/usr/local/src root# mkdir bro-cvs
/usr/local/src/bro-cvs root# cd bro-cvs
/usr/local/src/bro-cvs root# svn checkout http://svn.icir.org/bro/trunk/bro
/usr/local/src/bro-cvs root# mv bro bro-1.5.1.cvs
/usr/local/src/bro-cvs root# cd bro-1.5.1.cvs
/usr/local/src/bro-cvs/bro-1.5.1.cvs root# ./autogen.sh
</pre>
</td>
</tr>
</tbody>
</table>
<p><h4><strong>Robin&#8217;s Development Branch</strong></h4>
</p>
<p>
The developers merge their work into the the Bro subversion trunk.  Robin Sommer has a separate branch which contains experimental code for:</p>
<ul>
<li>the Bro Cluster framework</li>
<li>NetFlow support (by Bernhard Ager)</li>
<li>a BitTorrent analyzer (by Nadi Sarrar and Bernhard Ager)</li>
<li>an XML analyzer (by Tobias Kiesling)</li>
<li>Python bindings for Broccoli</li>
<li>restructured logic for taking drop decisions via Bro&#8217;s notice framework (by Brian Tierney and Robin Sommer)</li>
<li>a test-suite for Bro&#8217;s communication &#038; serialization subsystems</li>
<li>various tweaks and bugfixes</li>
</ul>
<p>If you want the latest work done by Robin and others mentioned above, you can get access to the code with the following commands.
</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
root# cd /usr/local/src
/usr/local/src root# mkdir bro-cvs
/usr/local/src root# cd bro-cvs
/usr/local/src/bro-cvs root# svn checkout http://svn.icir.org/bro/branches/robin/work
/usr/local/src/bro-cvs root# mv work bro-1.5.1.robin
/usr/local/src/bro-cvs root# cd bro-1.5.1.robin
/usr/local/src/bro-cvs/bro-1.5.1.robin root# ./autogen.sh
</pre>
</td>
</table>
<p><h4><strong>Configure and Install</strong></h4>
</p>
<p>Because of the various bug fixes and the additional features which add interesting options, we are going to step through installation of Robin&#8217;s branch.  Please use the version of Bro appropriate for your operation.
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode>
root# cd /usr/local/src/bro-cvs/bro-1.5.1.robin
/usr/local/src/bro-cvs/bro-1.5.1.robin root# CFLAGS="-D_LARGEFILE_SOURCE \
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" LDFLAGS="-lpfring -lpcap" \
LD_LIBRARY_PATH="/usr/lib:/usr/local/lib" ./configure --prefix=/usr/local/bro  \
--enable-debug --enable-perftools
/usr/local/src/bro-cvs/bro-1.5.1.robin root# make
/usr/local/src/bro-cvs/bro-1.5.1.robin root# make check
/usr/local/src/bro-cvs/bro-1.5.1.robin root# make install
</pre>
</td>
</tr>
</tbody>
</table>
<p>
If you run into any problems, go to back to the stable version of Bro and see if you can get it to compile.  Then you may want to try the subversion trunk code.
</p>
<p><h2><b>Snort Setup</b></h2>
<p>We will be following the direction posted previously in “Blacklisting with Snort″ [<a href="http://blog.securitymonks.com/2009/07/19/blacklisting-with-snort/">17</a>].  Below we will get the software, verify, configure, and install the software under the <strong>/usr/local/snort</strong> area. Please adjust this to your environment.  Reminder to Mac OS X and FreeBSD users, use the <strong>md5</strong> command instead of md5sum.
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode>
 root# cd /usr/local/src
/usr/local/src root# wget <a href="http://www.snort.org/downloads/116">wget http://www.snort.org/downloads/116 -O snort-2.8.6.1.tar.gz</a>
/usr/local/src root# wget <a class=moz-txt-link-freetext href="http://www.snort.org/downloads/116/show_md5" >http://www.snort.org/downloads/116/show_md5</a>
/usr/local/src root# cat show_md5
“b1119396a32e9df0d80404e4b6c49166”
/usr/local/src root# md5sum snort-2.8.6.1.tar.gz
b1119396a32e9df0d80404e4b6c49166  snort-2.8.6.1.tar.gz
/usr/local/src root# tar xzf snort-2.8.6.1.tar.gz
/usr/local/src root# cd snort-2.8.6.1
</pre>
</td>
</tr>
</tbody>
</table>
</p>
<p>We are going to add in support to place alerts into a MySQL database. If MYSQL is installed on the system, you can use the &#8220;<strong>&#8211;with-mysql</strong>&#8221; configuration option to specify where. In a previous post, “<a href="http://blog.securitymonks.com/2008/04/07/introduction-to-mysql/" >Introduction to MySQL</a>,” we went through the installation of MySQL into the /usr/local/mysql directory. For such an installation, the <strong>&#8211;with-mysql-includes=/usr/local/mysql/include</strong> and <strong>&#8211;with-mysql-libraries=/usr/local/mysql/lib</strong> command options must be used.  In order to use the dynamic plugin libraries, Snort needs to be able to find libmysqlclient.so. On some operating systems, you may <a href="http://www.snort.org/archive-11-3690.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.snort.org');">have problems</a>. Adding <strong>LDFLAGS=&#8221;-L/usr/local/mysql/lib/mysql&#8221;</strong> should work.
</p>
<p>
You may want to consider configuring Snort to allow <a href="http://cvs.snort.org/viewcvs.cgi/*checkout*/snort/doc/README.decoder_preproc_rules" onclick="javascript:pageTracker._trackPageview('/outbound/article/cvs.snort.org');">decoder and preprocessor rule eventing</a>.  This allows you to enable and disable decoder and preprocessor events on a rule by rule bases.  It also allow you to specify the rule type or action of a decoder or preprocessor event on a rule by rule basis.  Enable this configuration option with the configuration option using <strong>&#8211;enable-decoder-preprocessor-rules</strong>.
</p>
<p>
We will also be adding in large file support.  If you had to install libdnet in a special location, you will need to specify that location with the &#8220;<span style="FONT-WEIGHT: bold">&#8211;with-dnet-includes=</span>&#8221; and &#8220;<span style="FONT-WEIGHT: bold">&#8211;with-dnet-libraries=</span>&#8221; configuration options.
</p>
<p>
We will configure Snort with the following command:
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode>
/usr/local/src/snort-2.8.6.1 root# CFLAGS="-D_LARGEFILE_SOURCE \
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" LDFLAGS="-lpfring -lpcap" \
 LD_LIBRARY_PATH="/usr/lib:/usr/local/lib" \
./configure --prefix=/usr/local/snort --with-libpcap-includes=/usr/local/include \
--with-libpcap-libraries=/usr/local/lib \
--with-libpcre-includes=/usr/local/pcre/include \
--with-libpcre-libraries=/usr/local/pcre/lib \
--with-mysql-includes=/usr/local/mysql/include \
--with-mysql-libraries=/usr/local/mysql/lib \
--enable-decoder-preprocessor-rules --enable-zlib
</pre>
</td>
</tr>
</tbody>
</table>
<p>Check config.log if you had any problems or just want to make sure Snort configured everything correctly.  After you configure Snort, you continue to make and install it.
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode>
/usr/local/src/snort-2.8.6.1 root# make
/usr/local/src/snort-2.8.6.1 root# make check
/usr/local/src/snort-2.8.6.1 root# make install
/usr/local/src/snort-2.8.6.1 root# mkdir -p /usr/local/snort/etc
/usr/local/src/snort-2.8.6.1 root# cp etc/* /usr/local/snort/etc
/usr/local/src/snort-2.8.6.1 root# mkdir -p /usr/local/snort/preproc_rules
/usr/local/src/snort-2.8.6.1 root# cp preproc_rules/*.rules /usr/local/snort/preproc_rules
/usr/local/src/snort-2.8.6.1 root# /usr/local/snort/bin/snort -V

,,_ -*&gt; Snort! &lt;*-
o" )~ Version 2.8.6.1 (Build 39)
'''' By Martin Roesch &amp; The Snort Team: <a class=moz-txt-link-freetext href="http://www.snort.org/team.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.snort.org');">http://www.snort.org/team.html</a>
Copyright (C) 1998-2010 Sourcefire, Inc., et al.
Using PCRE version: 8.10 2010-06-25</pre>
</td>
</tr>
</tbody>
</table>
</p>
<p>
<h4><strong>Rules</strong> </h4>
</p>
<p>Now we need some rules. For this example we will get the rules from the <a href="http://www.snort.org/pub-bin/downloads.cgi" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.snort.org');">Snort</a> and the <a href="http://www.emergingthreats.net/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.emergingthreats.net');">Emerging Threats site</a>. You will need to register for the rules at the Snort site. Do consider subscribing for the latest up-to-date rules. Registered users can only access rules 30 days after their release.
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode>
 root# cd /usr/local/snort/rules
/usr/local/snort/rules root# wget http://www.emergingthreats.net/rules/emerging-all.rules
/usr/local/snort/rules root# cd /usr/local/src
/usr/local/src root# wget \
https://www.snort.org/downloads/83 \
-O snortrules-snapshot-CURRENT.tar.gz
/usr/local/src root# md5sum snortrules-snapshot-CURRENT.tar.gz
/usr/local/src root# mv snortrules-snapshot-CURRENT.tar.gz /usr/local/snort/
/usr/local/src root# cd /usr/local/snort/
/usr/local/snort root# tar xzf snortrules-snapshot-CURRENT.tar.gz
/usr/local/snort root# rm snortrules-snapshot-CURRENT.tar.gz
/usr/local/snort root# vi /usr/local/snort/etc/snort.conf</pre>
</td>
</tr>
</tbody>
</table>
<p>Modify /usr/local/snort/etc/snort.conf to your environment. Make sure the <strong>RULE_PATH</strong> is set to /usr/local/snort/rules. If you configured Snort to enable decoder and preprocessor rules, you will need to add a line specifying the location of those files.  Define <strong>PREPROC_RULE_PATH</strong> with the line:
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode> var PREPROC_RULE_PATH ../preproc_rules</pre>
</td>
</tr>
</tbody>
</table>
<p>
Later in the snort.conf file include the lines (before other rule lists are included):
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode> include $PREPROC_RULE_PATH/preprocessor.rules
include $PREPROC_RULE_PATH/decoder.rules</pre>
</td>
</tr>
</tbody>
</table>
<p>
If you wish to use the emerging threat rules, add:
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode>
 include $RULE_PATH/emerging-all.rules</pre>
</td>
</tr>
</tbody>
</table>
<p>
in the /usr/local/snort/etc/snort.conf file. Do not forget to adjust <strong>dynamicpreprocessor file</strong> and <strong>dynamicengine</strong> path. Mac OS X users will need to use the dynamic libraries. Uncomment the Mac OS X lines in the Snort configuration file.
</p>
<p>
<h4><strong>Dumbpig</strong></h4>
</p>
<p>Leon Ward has released a Perl program, <a href="http://leonward.wordpress.com/dumbpig/" onclick="javascript:pageTracker._trackPageview('/outbound/article/leonward.wordpress.com');">Dumbpig</a>, which will check Snort rules for badly formatted entries and incorrect usage.  He has even added blacklist support (see posting &#8220;<a href="http://leonward.wordpress.com/2009/07/20/et-rbn-blacklists-with-snort-and-dumbpig/" onclick="javascript:pageTracker._trackPageview('/outbound/article/leonward.wordpress.com');">ET RBN Blacklists with Snort and DumbPig</a>&#8220;).  To pull down dumbpig.pl, the required Perl modules, and run it against the Emerging Threats rule set:
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode>
 root# cd /home/snort/perl
/home/snort/perl root# wget http://dumbpig.googlecode.com/files/dumbpig-0.9.tgz
/home/snort/perl root# tar xzf dumbpig-0.9.tgz
/home/snort/perl root# chmod u+x ./dumbpig.pl
/home/snort/perl root# cpan -e "Parse::Snort"
/home/snort/perl root# cpan -e "LWP::Simple"
/home/snort/perl root# ./dumbpig.pl -r /usr/local/snort/rules/emerging-all.rules
DumbPig version 0.9 - leon.ward@sourcefire.com
Because I hate looking for the same dumb problems with snort rule-sets

        __,,    ( Dumb-pig says     )
      ~(  oo ---( "ur rulz r not so )
        ''''    ( gud akshuly" *    )

Config
----------------------
* Sensivity level - 3/3
* Blacklist outputi : Disabled
* Processing File - /home/snort/rules//emerging-all.rules
* Check commented out rules : Disabled
* Pause : Disbled
* ForceFail : Disabled
* Censor : Disabled
* Quite mode : Disabled
----------------------
Issue 1
1 Problem(s) found with rule on line 59 of /home/snort/rules//emerging-all.rules

alert tcp $HOME_NET any -> \
[75.126.138.202,72.249.118.38,208.78.69.70,204.13.249.70,208.78.68.70] $HTTP_PORTS  ( \
  msg:"ET CURRENT_EVENTS Possible Downadup/Conficker-A Infection Checking Geographical Location"; \
  flow:to_server; \
  classtype:trojan-activity; \
  reference:url,www.microsoft.com/security/portal/Entry.aspx?Name=Worm%3aWin32%2fConficker.A; \
  reference:url,www.f-secure.com/v-descs/worm_w32_downadup_a.shtml; \
  threshold:type both, count 5, seconds 60, track by_src; \
  reference:url,doc.emergingthreats.net/bin/view/Main/2008803; \
  reference:url,www.emergingthreats.net/cgi-bin/cvsweb.cgi/sigs/CURRENT_EVENTS/CURRENT_Conficker; \
  sid:2008803; \
  rev:3; \
)
- TCP/UDP rule with no deep packet checks? This rule looks more suited to a firewall or blacklist
alert tcp $HOME_NET any ->
[75.126.138.202,72.249.118.38,208.78.69.70,204.13.249.70,208.78.68.70] $HTTP_PORTS (msg:"ET CURRENT_
EVENTS Possible Downadup/Conficker-A Infection Checking Geographical
Location"; flow:to_server; classtype:trojan-activity;
reference:url,www.microsoft.com/security/portal/Entry.aspx?Name=Worm%3aWin32%2fConficker.A;
reference:url,www.f-secure.com/v-descs/worm_w32_downadup_a.shtml;
threshold:type both, count 5, seconds 60, track by_src;
reference:url,doc.emergingthreats.net/bin/view/Main/2008803;
reference:url,www.emergingthreats.net/cgi-bin/cvsweb.cgi/sigs/CURRENT_EVENTS/CURRENT_Conficker;
sid:2008803; rev:3;)
</pre>
</td>
</tr>
</tbody>
</table>
<p><h2><b>Suricata Setup</b></h2>
<p>The Open Information Security Foundation (<a href="http://www.openinfosecfoundation.org/"> OISF</a>) developed Suricata to be on the leading edge in IDS/IPS software.  It is very much still in development.  Is that not what makes it so interesting?  Before you begin, be aware of some <a href="https://redmine.openinfosecfoundation.org/projects/suricata/wiki/Known_issues">known issues</a>.  Check out the development <a href="https://redmine.openinfosecfoundation.org/projects/suricata/roadmap">roadmap</a> for upcoming scheduled releases.  If you run into problems, see if it is a known <a href="https://redmine.openinfosecfoundation.org/projects/suricata/issues">issue</a> and share your experiences with the community of developers.  That is the best way to make sure Suricata improves.
</p>
<p>
With required and options software on the system, installing Suricata is pretty straight forward.  Pull down the source, configure, compile, and install.
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode>
 root# cd /usr/local/src
/usr/local/src root# wget  http://www.openinfosecfoundation.org/download/suricata-1.0.1.tar.gz
/usr/local/src root# wget http://www.openinfosecfoundation.org/download/suricata-1.0.1.tar.gz.sig
/usr/local/src root# wget http://www.openinfosecfoundation.org/download/OISF.asc
/usr/local/src root# gpg --import OISF.asc
/usr/local/src root# gpg --verify suricata-1.0.1.tar.gz.sig suricata-1.0.1.tar.gz
gpg: Signature made Thu 29 Jul 2010 02:34:58 PM EDT using RSA key ID 051CC261
gpg: Good signature from "OISF <releases @openinfosecfoundation.org>"
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 3332 6BF5 5751 35CC 24F5  D2AF A30C 431D 051C C261
/usr/local/src root#  tar xzf suricata-1.0.1.tar.gz
/usr/local/src root# cd suricata-1.0.1
/usr/local/src/suricata-1.0.1 root# mkdir /usr/local/suricata
/usr/local/src/suricata-1.0.1 root#  LD_RUN_PATH="/usr/lib:/usr/local/lib" \
./configure --enable-pfring --with-libpfring-libraries=/usr/local/lib \
--with-libpfring-includes=/usr/local/include --with-libpcap-libraries=/usr/local/lib \
--with-libpcap-includes=/usr/local/include --enable-nfqueue--enable-unittests \
--enable-unified-native-timeval  --enable-profiling  --prefix=/usr/local/suricata
/usr/local/src/suricata-1.0.1 root# make
/usr/local/src/suricata-1.0.1 root# make check
/usr/local/src/suricata-1.0.1 root# make install
/usr/local/src/suricata-1.0.1 root# mkdir /usr/local/suricata/log
/usr/local/src/suricata-1.0.1 root# mkdir /usr/locall/suricata/etc
/usr/local/src/suricata-1.0.1 root# cp classification.config suricata.yaml /usr/local/suricata/etc
/usr/local/src/suricata-1.0.1 root# mkdir /usr/local/suricata/rules
/usr/local/src/suricata-1.0.1 root# cd /usr/local/suricata/rules
/usr/local/suricata/rules root# wget http://www.emergingthreats.net/rules/emerging-attack_response.rules
/usr/local/suricata/rules root# wget http://www.emergingthreats.net/rules/emerging-scan.rules
/usr/local/suricata/rules root# wget http://www.emergingthreats.net/rules/emerging-exploit.rules
/usr/local/suricata/rules root#wget http://www.emergingthreats.net/rules/emerging-current_events.rules
/usr/local/suricata/rules root#wget http://www.emergingthreats.net/rules/emerging-voip.rules
/usr/local/suricata/rules root#wget http://www.emergingthreats.net/rules/emerging-malware.rules
/usr/local/suricata/rules root#wget http://www.emergingthreats.net/rules/emerging-dos.rules
/usr/local/suricata/rules root#wget http://www.emergingthreats.net/rules/emerging-drop.rules
/usr/local/suricata/rules root#wget http://www.emergingthreats.net/rules/emerging-compromised.rules
/usr/local/suricata/rules root#wget http://www.emergingthreats.net/rules/emerging-dshield.rules
/usr/local/suricata/rules root#wget http://www.emergingthreats.net/rules/emerging-botcc.rules
/usr/local/suricata/rules root#wget http://www.emergingthreats.net/rules/emerging-rbn.rules
/usr/local/suricata/rules root# wget http://www.emergingthreats.net/rules/emerging-virus.rules
/usr/local/suricata/rules root# vi /usr/loca/suricata/etc/suricata.yaml
</releases>
</pre>
</td>
</tr>
</tbody>
</table>
<p>
Modify suricata.yaml to reflect your environment.  At this point, you can run Suricata with the command:
</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
root# /usr/local/suricata/bin/suricata -c /usr/local/suricata/etc/suricata.yaml \
-s /usr/local/suricata/etc/classification.config -i eth0
</pre>
</td>
</table>
<p><h2><b>To Be Continued&#8230;</b></h2>
</p>
<p>
Henry J. Kaiser, the father of modern American shipbuilding, once said, &#8220;Live daringly, boldly, fearlessly. Taste the relish to be found in competition &#8211; in having put forth the best within you&#8221; [<a href="http://wapedia.mobi/enwikiquote/Henry_J._Kaiser">9</a>]  Hopefully Jonkman, Julien, Roesch, and Olney Roesch will relish their competition and the community will enjoy the fruits of their efforts.  One powerful benefit of open source is that it allows organizations the flexibility to pull down the source and setup the software in their own environment.  One can easily try the packages out and become familiar with the benefits of the different IDS/IPS engines.  The more you know, the better you will be at defending your organization.
</p>
<p>
Setting up the three IDS/IPS engines is only the first step.  In later posts, we will continue by examining the configuration and output from Bro, Snort, and Suricata.  This should help the reader understand the features each might offer an organization.  Bro, Snort, and Suricata are just tools.  While they will have different features, it is the person who yields the tool that determines its effectiveness. Determine for yourself what works best.  Even if you have a single development box, you can setup and test against small subsets of your own network traffic.  Visit <a href="http://wiki.wireshark.org/SampleCaptures">Wireshark’s Sample capture page</a> for links to pcap files and additional sources.  There is also the <a href="https://www.openpacket.org/capture/list">OpenPacket’s Capture Repository</a>, which provides the security community the capability to comment and vote on submitted pcap files.  Give the IDS/IPS engines a test ride and please feel free to share your experiences.
</p>
<p><h2><b>Links</b></h2>
<p>[1] Marc Ambinder, August 13th 2010, &#8220;Pentagon Wants to Secure Dot-Com Domains of Contractors,&#8221; <a href="http://www.theatlantic.com/politics/archive/2010/08/pentagon-wants-to-secure-dot-com-domains-of-contractors/61456/">http://www.theatlantic.com/politics/archive/2010/08/pentagon-wants-to-secure-dot-com-domains-of-contractors/61456/</a>.<br />
[2] John Gerber, January 5th 2010, &#8220;Suricata: A Next Generation IDS/IPS Engine,&#8221; <a href="http://blog.securitymonks.com/2010/01/05/suricata-a-next-generation-idsips-engine/">http://blog.securitymonks.com/2010/01/05/suricata-a-next-generation-idsips-engine/</a>.<br />
[3] John Gerber, October 29th 2008, &#8220;Installing Bro IDS 1.4,&#8221; <a href="http://blog.securitymonks.com/2008/10/28/installing-bro-ids-14/">http://blog.securitymonks.com/2008/10/28/installing-bro-ids-14/</a>.<br />
[4] John Gerber, October 20th 2008, &#8220;Snort 3: The Next Generation,&#8221; <a href="http://blog.securitymonks.com/2008/10/20/snort-3-the-next-generation/">http://blog.securitymonks.com/2008/10/20/snort-3-the-next-generation/</a>.<br />
[5] John Gerber, August 9th, 2008, &#8220;IDS/IPS: The Mark Twain of the Security World,&#8221; <a href="http://blog.securitymonks.com/2008/08/09/idsips-the-mark-twain-of-the-security-world/">http://blog.securitymonks.com/2008/08/09/idsips-the-mark-twain-of-the-security-world/</a>.<br />
[6] John Gerber, June 17th, 2007, &#8220;IDS,&#8221; <a href="http://blog.securitymonks.com/2007/06/17/ids/">http://blog.securitymonks.com/2007/06/17/ids/</a>.<br />
[7] Jaikumar Vijayan, July 20th 2010, &#8220;DHS, vendors unveil open source intrusion detection engine,&#8221; <a href="http://www.computerworld.com/s/article/9179436/DHS_vendors_unveil_open_source_intrusion_detection_engine">http://www.computerworld.com/s/article/9179436/DHS_vendors_unveil_open_source_intrusion_detection_engine</a>.<br />
[8] Ellen Messmer, July 20th 2010, &#8220;Is open source Snort dead? Depends who you ask ,&#8221; <a href="http://www.networkworld.com/news/2010/072010-is-snort-dead.html?page=1<br />
">http://www.networkworld.com/news/2010/072010-is-snort-dead.html?page=1</a>.<br />
[9] &#8220;Wikiquote: Henry J. Kaiser,&#8221; <a href="http://wapedia.mobi/enwikiquote/Henry_J._Kaiser">http://wapedia.mobi/enwikiquote/Henry_J._Kaiser</a>.<br />
[10] Matt Olney, July 20th 2010, &#8220;Innovation &#8212; You Keep Using That Word&#8230;,&#8221; <a href="http://vrt-sourcefire.blogspot.com/2010/07/innovation-you-keep-using-that-word.html">http://vrt-sourcefire.blogspot.com/2010/07/innovation-you-keep-using-that-word.html</a>.<br />
[11] &#8220;Razorback&#8221;, <a href="http://sourceforge.net/projects/razorbacktm/files/">http://sourceforge.net/projects/razorbacktm/files/</a>.<br />
[12] &#8220;Next Generation Open-Source IDS to Address Issues Facing Network Security Industry,&#8221; July 19th 2010, <a href="http://www.businesswire.com/portal/site/home/permalink/?ndmViewId=news_view&#038;newsId=20100719005970&#038;newsLang=en">http://www.businesswire.com/portal/site/home/permalink/?ndmViewId=news_view&#038;newsId=20100719005970&#038;newsLang=en</a>.<br />
[13] Russ McRee, August 3rd 2010, &#8220;Suricata in toolsmith: meet the meerkat,&#8221; <a href="http://holisticinfosec.blogspot.com/2010/08/suricata-in-toolsmith-meet-meerkat.html">http://holisticinfosec.blogspot.com/2010/08/suricata-in-toolsmith-meet-meerkat.html</a>.<br />
[14] Victor Julien, July 22nd 2010, &#8220;On Suricata performance,&#8221; <a href="http://www.inliniac.net/blog/2010/07/22/on-suricata-performance.html">http://www.inliniac.net/blog/2010/07/22/on-suricata-performance.html</a>.<br />
[15] &#8220;Bro Features and Benefits,&#8221; June 28th 2010, <a href="http://www.bro-ids.org/Features.html">http://www.bro-ids.org/Features.html</a>.<br />
[16] &#8220;Snort 2.9.0 Beta,&#8221; June 6th 2010, <a href="https://s3.amazonaws.com/snort.org/snort-beta/20100727/release_notes_290_beta.txt?AWSAccessKeyId=AKIAJJSHU7YNPLE5MKOQ&#038;Expires=1282246315&#038;Signature=jchbdD6d3G0ncaqOkrQAps6ZV5M%3D">https://s3.amazonaws.com/snort.org/snort-beta/20100727/release_notes_290_beta.txt?AWSAccessKeyId=AKIAJJSHU7YNPLE5MKOQ&#038;Expires=1282246315&#038;Signature=jchbdD6d3G0ncaqOkrQAps6ZV5M%3D</a>.<br />
[17] John Gerber, July 19th 2009, “Blacklisting with Snort,” <a href="http://blog.securitymonks.com/2009/07/19/blacklisting-with-snort/">http://blog.securitymonks.com/2009/07/19/blacklisting-with-snort/</a>.<br />
[18] Russ McRee, August 2010, &#8220;Suricata: An Introduction,&#8221; <a href="http://holisticinfosec.org/toolsmith/pdf/august2010.pdf">http://holisticinfosec.org/toolsmith/pdf/august2010.pdf</a><br />
[19] &#8220;Dynamic Application-Layer Protocol Analysis for Network Intrusion Detection,&#8221; Proceedings of the 15th conference on USENIX Security Symposium &#8211; Volume 15, 2006, <a href="http://www.icir.org/robin/papers/usenix06.pdf ">http://www.icir.org/robin/papers/usenix06.pdf</a>.<br />
[20] Seth Hall, August 6th 2010, Github Social Coding, &#8220;<a href="http://github.com/sethhall/bro_scripts/blob/master/http-ext.bro">http://github.com/sethhall/bro_scripts/blob/master/http-ext.bro</a>.<br />
[21] Seth Hall, August 6th 2010, Github Social Coding,<a href="http://github.com/sethhall/bro_scripts/blob/master/http-ext.bro#L64">http://github.com/sethhall/bro_scripts/blob/master/http-ext.bro#L64</a>.<br />
[22] Gunjan Bansal, June 16th 2010, “Installation Guide for PF_RING,” <a href="http://gunjan-bansal.blogspot.com/2010/06/installation-guide-for-pfring.html">http://gunjan-bansal.blogspot.com/2010/06/installation-guide-for-pfring.html</a>.<br />
[23] Luca Deri and Francesco Fusco, January 30th 2010, “Exploiting Commodity Multi-core Systems for Network Traffic Analysis,” <a href="http://luca.ntop.org/MulticorePacketCapture.pdf">http://luca.ntop.org/MulticorePacketCapture.pdf</a>.</p>
<p>[24] Mathew Olney and Matthew Watchinski, &#8220;Implementing Resource Intensive Detection Techniques With the Razorback Framework,&#8221; <a href="http://iweb.dl.sourceforge.net/project/razorbacktm/Whitepapers/razorback-whitepaper-0.1.pdf">http://iweb.dl.sourceforge.net/project/razorbacktm/Whitepapers/razorback-whitepaper-0.1.pdf</a>.<br />
[25] Patrick Mullen and Ryan Pentney, Defcon Razorback Presentation, &#8220;<a href="https://www.defcon.org/images/defcon-18/dc-18-presentations/Mullen-Pentney/DEFCON-18-Mullen-Pentney-Razorback.pdf">https://www.defcon.org/images/defcon-18/dc-18-presentations/Mullen-Pentney/DEFCON-18-Mullen-Pentney-Razorback.pdf</a>.<br />
[26] Robin Sommer, August 24th 2010, The ICSI Networking Group Blog, &#8220;Major NSF Funding for Bro Development,&#8221; <a href="http://blog.icir.org/2010/08/major-nsf-funding-for-bro-development.html">http://blog.icir.org/2010/08/major-nsf-funding-for-bro-development.html</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.securitymonks.com/2010/08/26/three-little-idsips-engines-build-their-open-source-solutions/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Blacklisting with Snort</title>
		<link>http://blog.securitymonks.com/2009/07/19/blacklisting-with-snort/</link>
		<comments>http://blog.securitymonks.com/2009/07/19/blacklisting-with-snort/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 04:29:30 +0000</pubDate>
		<dc:creator>John Gerber</dc:creator>
				<category><![CDATA[Snort]]></category>
		<category><![CDATA[dumbpig]]></category>

		<guid isPermaLink="false">http://blog.securitymonks.com/?p=1192</guid>
		<description><![CDATA[Managing IDS/IPS signatures can be a difficult task. Even with trained security professionals who are knowledgeable about their organization&#8217;s normal traffic pattern, most organizations configurations are continuously changing. New services and machines are put into place, creating new traffic patterns. While network IDS/IPS serve the function of finding evidence of nefarious activities, at large organization [...]]]></description>
			<content:encoded><![CDATA[<p>Managing IDS/IPS signatures can be a difficult task. Even with trained security professionals who are knowledgeable about their organization&#8217;s normal traffic pattern, most organizations configurations are continuously changing. New services and machines are put into place, creating new traffic patterns. While network IDS/IPS serve the function of finding evidence of nefarious activities, at large organization the volume of alerts can be a bit daunting. Signatures are being updated regularly to deal with changing attack vectors, adding to the number of alerts. Time to analyze is always limited. Organizations will often find themselves with too much information and too many alerts to investigate.</p>
<p>The use of blacklists can help. Ron Gula in his post &#8220;<a href="http://blog.tenablesecurity.com/2008/06/event-analysis.html">Event Analysis Training &#8212; Working with BlackLists</a>&#8221; discussed how in an organization aggregating network IDS/IPs events with 10,000 to 1,000,000 events per day, Tenable has observed on a heavy day of blacklist correlation 10 to 30 hits are often generated. While those blacklist hits require minimal effort to analyze, they provide potentially very useful information. By following the interactions between blacklisted IP addresses with hosts in an organization&#8217;s network, one can find:
</p>
<ul>
<li>systems on the organization&#8217;s network that have been compromised and are being used to send SPAM.  </li>
<li>possible vulnerabilities on systems within the organization&#8217;s network based on targeted ports.</li>
<li>successful phishing attacks, if the organization&#8217;s IP addresses are visiting IPs associated with phishing scams. </li>
<li>systems within the organization that are part of botnet, since blacklists can identify IPs that are part of the botnet command and control. </li>
</ul>
<p>
Blacklists fall into two categories: global worst offender lists  (<span style="FONT-WEIGHT: bold">GWOL</span>) and local worst offender lists (<span style="FONT-WEIGHT: bold">LWOL</span>). LWOL will be built by an organization based on the organization&#8217;s firewalls and network activities.  For GWOL, three invaluable sources providing up-to-date information pulled from various sources that are known to be used to propagate malware and spyware are: </p>
<ul>
<li><a href="http://malwaredomains.com/">DNS-BH Malware Domain Blocklist</a>: provides information maintained as part of the DNS-BH project and represents a list of domains that are known to be used to propagate malware and spyware. </li>
<li><a href="http://watchlist.security.org.my/watchlist">Global Watchlist</a>: <a href="http://www.blogger.com/profile/10778262436985693992">C.S. Lee</a> describes what he and Spoonfork did in his posting “<a href="http://geek00l.blogspot.com/2008/02/harimau-watchlist.html">The Harimau Watchlist</a>.” He describes the list as a &#8220;<em>list of  suspected malicous IPs/Net ranges from different sources such as SANS DShield, Arbor atlas and so forth, then putting all of them in one place</em>.” </li>
<li><a href="http://www.infiltrated.net/blacklisted">Ninja Chimp Strike Force Blacklist</a>: created on an hourly basis from data Arbor Networks, Project Honeypot, Shadowserver, and about 24+ hosts. </li>
</ul>
<p>
Martin Roesch recently posted &#8220;<a href="http://securitysauce.blogspot.com/2009/06/ip-blacklisting-version-2-for-snort.html">IP Blacklisting Version 2 for Snort 2.8.4.1 available</a>&#8221; where he discusses version 2 of a patch created for Snort 2.8.4.1 allowing IP blacklisting.
</p>
<p>
We will walk through the process of installing Snort 2.8.4.1 with the patch in order to allow the use of blacklists. We will follow that up with creating a process that will generated the blacklist file for Snort.  We will go through enough of the setup to allow the user to start using blacklists.</p>
<h2>Required Packages</h2>
<p>The first step is to make sure the system has the required software installed, which includes:
</p>
<ul>
<li>aclocal</li>
<li>automake</li>
<li>autoconf</li>
<li><a href="http://code.google.com/p/libdnet/">Libdnet</a> 1.10 or higher</li>
<li>A recent <a href="http://www.tcpdump.org/">Libpcap</a></li>
</ul>
<p>The aclocal, automake, and autoconf packages should be on your system. I wanted to mention them here because the version installed on your system may end up causing problems. On one system, I had a most difficult time because of the version. Since I could not update the software on the problem system, I ended up creating a local area under the Snort directory and installing the versions I required there.
</p>
<p>
The packages that are needed will be dependent on your installation base.  I will walk through a few package installations.</p>
<h4><strong>Libdnet</strong></h4>
<p>Make sure Libdnet is in your library path:
 </p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode> root# /sbin/ldconfig -p | grep -i libdnet
 libdnet32.so.1 (libc6) =&gt; /usr/lib/libdnet32.so.1
 libdnet32.so (libc6) =&gt; /usr/lib/libdnet32.so</pre>
</td>
</tr>
</tbody>
</table>
<p>If you do not get a path returned, you will need to install libdnet (use &#8211;prefix if it needs to be installed in a special location):
 </p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode> root# cd /usr/local/src
 /usr/local/src root# wget \
<a class=moz-txt-link-freetext href="http://libdnet.googlecode.com/files/libdnet-1.12.tgz">http://libdnet.googlecode.com/files/libdnet-1.12.tgz</a>
 /usr/local/src root# tar xzf libdnet.cvs.tgz
 /usr/local/src root# cd libdnet-1.12
 /usr/local/src root# ./configure
 /usr/local/src root# make
 /usr/local/src root# make install
 /usr/local/src root# cp include/dnet/sctp.h /usr/local/include/dnet</pre>
</td>
</tr>
</tbody>
</table>
<p>If you have installed libdnet in a special location, make sure to include its path in /etc/ld.so.conf. </p>
<p><h4><strong>PCRE (pcre-7.8)</strong></h4>
<p>The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5. If you can install PCRE via a port specific to your operating system, that is the best way to install in order to avoid having to keep the software up-to-date. Below are the instructions for installing the software from source.
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode> root# cd /usr/local/src
 /usr/local/src root# wget \
<a class=moz-txt-link-freetext href="http://downloads.sourceforge.net/sourceforge/pcre/pcre-7.9.tar.gz?use_mirror=internap">http://downloads.sourceforge.net/sourceforge/pcre/\
pcre-7.9.tar.gz?use_mirror=internap</a>
 /usr/local/src root# wget \
<a class=moz-txt-link-freetext href="http://downloads.sourceforge.net/sourceforge/pcre/pcre-7.9.tar.gz.sig?use_mirror=internap">http://downloads.sourceforge.net/sourceforge/pcre/\
pcre-7.9.tar.gz.sig?use_mirror=internap</a>
 /usr/local/src root# gpg --verify pcre-7.9.tar.gz.sig pcre-7.9.tar.gz
gpg: Signature made Sat 11 Apr 2009 10:33:38 AM EDT using RSA key ID FB0F43D8
gpg: Good signature from "Philip Hazel <a class=moz-txt-link-rfc2396E href="mailto:ph10@hermes.cam.ac.uk">&lt;ph10@hermes.cam.ac.uk&gt;</a>"
gpg: aka "Philip Hazel <a class=moz-txt-link-rfc2396E href="mailto:ph10@cam.ac.uk">&lt;ph10@cam.ac.uk&gt;</a>"
gpg: aka "Philip Hazel <a class=moz-txt-link-rfc2396E href="mailto:ph10@cus.cam.ac.uk">&lt;ph10@cus.cam.ac.uk&gt;</a>"
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: 45F6 8D54 BBE2 3FB3 039B 46E5 9766 E084 FB0F 43D8

 /usr/local/src root# tar xzf pcre-7.9.tar.gz
 /usr/local/src root# cd pcre-7.9
 /usr/local/src/pcre-7.8 root# ./configure --prefix=/usr/local/pcre
 /usr/local/src/pcre-7.8 root# make
 /usr/local/src/pcre-7.8 root# make test
 /usr/local/src/pcre-7.8 root# make install</pre>
</td>
</tr>
</tbody>
</table>
<h4><strong>Libpcap and Large Files Support</strong></h4>
<p>Under some OSs, you need to compile <a href="http://www.tcpdump.org/">libpcap</a> and Snort to support large files (files large than 2G). Since the source code of libpcap will be needed for this configuration, we are going to install the resulting libpcap under /usr/local/snort. If the libpcap installed on your system does not produce an error, skip this step. You will want to follow these steps only if you get the following error when running Snort with a large file:
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode> root# ls -lh /data/ids/full2.pcap
-rw-r--r-- 1 root root 12G Oct 26 10:01 /data/ids/full2.pcap
 root# /usr/local/snort/bin/snort -o -A none -c \
/usr/local/snort/conf/snort.conf -l /logs/snort/logs \
-r /data/ids/full2.pcap
Error getting stat on pcap file: /data/ids/full2.pcap:
Value too large for defined data type
ERROR: Error getting pcaps
Fatal Error, Quitting..</pre>
</td>
</tr>
</tbody>
</table>
<p>First, we need to compile large file support into libpcap. As mentioned above, we will install the libraries under /usr/local/snort.
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode> root# cd /usr/local/src
 /usr/local/src root# wget <a class=moz-txt-link-freetext href="http://www.tcpdump.org/release/libpcap-1.0.0.tar.gz">http://www.tcpdump.org/release/\
libpcap-1.0.0.tar.gz</a>
 /usr/local/src root# wget <a class=moz-txt-link-freetext href="http://www.tcpdump.org/release/libpcap-1.0.0.tar.gz.sig">http://www.tcpdump.org/release/\
libpcap-1.0.0.tar.gz.sig</a>
 /usr/local/src root# wget <a class=moz-txt-link-freetext href="http://www.tcpdump.org/tcpdump-workers.asc">http://www.tcpdump.org/tcpdump-workers.asc</a>
 /usr/local/src root# gpg --import tcpdump-workers.asc
gpg: key 89E917F3: "tcpdump.org (SIGNING KEY) <tcpdump -workers@tcpdump.org="">" not changed
gpg: Total number processed: 1
gpg: unchanged: 1
 /usr/local/src root# gpg --verify libpcap-1.0.0.tar.gz.sig libpcap-1.0.0.tar.gz
gpg: Signature made Tue 25 Sep 2007 10:11:56 PM EDT using DSA key ID 89E917F3
gpg: Good signature from "tcpdump.org (SIGNING KEY) </tcpdump><tcpdump -workers@tcpdump.org="">"
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: 0227 54EB 4C30 9185 FD31 33A3 464D 3CEB 89E9 17F3
 /usr/local/src root# tar xzf libpcap-1.0.0.tar.gz
 /usr/local/src root# cd libpcap-1.0.0
 /usr/local/src/libpcap-1.0.0 root# ./configure --prefix=/usr/local/snort \
CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
-D_FILE_OFFSET_BITS=64"
 /usr/local/src/libpcap</tcpdump>-1.0.0<tcpdump -workers@tcpdump.org=""> root# make
 /usr/local/src/libpcap</tcpdump>-1.0.0<tcpdump -workers@tcpdump.org=""> root# make shared
 /usr/local/src/libpcap</tcpdump>-1.0.0<tcpdump -workers@tcpdump.org=""> root# make install
 /usr/local/src/libpcap</tcpdump>-1.0.0<tcpdump -workers@tcpdump.org=""> root# make install-shared
</tcpdump></pre>
</td>
</tr>
</tbody>
</table>
<p>In the next section, we will discuss how to install Snort with blacklist, large file, and MySQL support.</p>
<h2>Snort</h2>
<p>Below we will get the software, verify, configure, and install the software under the <strong>/usr/local/snort</strong> area. Please adjust this to your environment.  Reminder to Mac OS X and FreeBSD users, use the <strong>md5</strong> command instead of md5sum.
 </p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode> root# cd /usr/local/src
 /usr/local/src root# wget <a class=moz-txt-link-freetext href="http://dl.snort.org/snort-current/snort-2.8.4.1.tar.gz">http://dl.snort.org/snort-current/snort-2.8.4.1.tar.gz</a>
 /usr/local/src root# wget <a class=moz-txt-link-freetext href="http://dl.snort.org/snort-current/snort-2.8.4.1.tar.gz.md5">http://dl.snort.org/snort-current/snort-2.8.4.1.tar.gz.md5</a>
 /usr/local/src root# cat snort-2.8.4.1.tar.gz.md5
63f4e76ae96a2d133f4c7b741bad5458 snort-2.8.4.1.tar.gz
 /usr/local/src root# md5sum snort-2.8.4.1.tar.gz
63f4e76ae96a2d133f4c7b741bad5458 snort-2.8.4.1.tar.gz
 /usr/local/src root# tar xzf snort-2.8.4.1.tar.gz
 /usr/local/src root# cd snort-2.8.4.1</pre>
</td>
</tr>
</tbody>
</table>
<p>At this point, we will add the blacklist path and regenerate the configuration and make files. If you do not have prelude installed, the following will occur:
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode> /usr/local/src/snort-2.8.4.1 root# wget <a class=moz-txt-link-freetext href="http://www.snort.org/users/roesch/code/iplist.patch.v2.tgz">http://www.snort.org/users/roesch/code/iplist.patch.v2.tgz</a>
 /usr/local/src/snort-2.8.4.1 root# tar xzf iplist.patch.v2.tgz
 /usr/local/src/snort-2.8.4.1 root# patch -p1 &lt; iplist.patch
 /usr/local/src/snort-2.8.4.1 root# aclocal
aclocal:configure.in:1050: warning: macro `AM_PATH_LIBPRELUDE' not found in library
 /usr/local/src/snort-2.8.4.1 root# autoconf
configure.in:1050: error: possibly undefined macro: AM_PATH_LIBPRELUDE
 If this token and others are legitimate, please use m4_pattern_allow.
 See the Autoconf documentation.
 /usr/local/src/snort-2.8.4.1 root# automake</pre>
</td>
</tr>
</tbody>
</table>
<p>Eoin Miller has been very active and helpful in resolving problems with the patch. In <a href="http://readlist.com/lists/lists.sourceforge.net/snort-users/0/4496.html">a recent post</a>, he resolved the problem of &#8221; <span style="FONT-WEIGHT: bold">warning: macro `AM_PATH_LIBPRELUDE&#8217; not found in library</span>&#8221; by commenting out those lines pertaining to Prelude in the <span style="FONT-WEIGHT: bold">configure</span> file. The exact line number will differ between systems<span class=code>.<br />
</span></p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode> <span class=code>#if test "x$enable_prelude" = "xyes"; then
# AM_PATH_LIBPRELUDE(0.9.6, use_prelude="yes", use_prelude="no")
# if test "$use_prelude" = "yes"; then
# LDFLAGS="${LDFLAGS} ${LIBPRELUDE_LDFLAGS}"
# LIBS="$LIBS ${LIBPRELUDE_LIBS}"
# CFLAGS="$CFLAGS ${LIBPRELUDE_PTHREAD_CFLAGS}"

#cat &gt;&gt;confdefs.h &lt;&lt;\_ACEOF
##define HAVE_LIBPRELUDE
#_ACEOF
#
# fi
#fi</span></pre>
</td>
</tr>
</tbody>
</table>
<p>You may also need to change the definition of <span style="FONT-WEIGHT: bold">LIBDNET</span> and <span style="FONT-WEIGHT: bold">DNETFLAGS</span> in the configuration file. The configure file will have these variables set by calling <span style="FONT-WEIGHT: bold">dumbnet-config</span> without any path. If your system does not know the location of <span style="FONT-WEIGHT: bold">dumbnet-config</span>, this will cause problems. Instead, figure out the values and replace the calls to dumbnet-config with those values. To find the values that should be used, issue the command:
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode> /usr/local/src/snort-2.8.4.1 root# /usr/local/bin/dnet-config --libs
-L/usr/local/lib -ldnet
 /usr/local/src/snort-2.8.4.1 root# /usr/local/bin/dnet-config --cflags
-I/usr/local/include</pre>
</td>
</tr>
</tbody>
</table>
<p>In the above case, you should change all occurrences in the configure file from having: </p>
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode> LIBDNET="`dumbnet-config --libs`"
 DNETFLAGS="`dumbnet-config --cflags`"</pre>
</td>
</tr>
</tbody>
</table>
<p>to (depending on the results of the above dnet-config results): </p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode> LIBDNET="-L/usr/local/lib -ldnet"
 DNETFLAGS="-I/usr/local/include"</pre>
</td>
</tr>
</tbody>
</table>
<p>The <a href="http://archives.neohapsis.com/archives/snort/2009-07/0032.html">post by Martin Roesch</a>, suggest a replacement for the function IpListEval. You may want to replace that in file spp_iplist.c.
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode> /usr/local/src/snort-2.8.4.1 root# vi ./src/preprocessors/spp_iplist.c</pre>
</td>
</tr>
</tbody>
</table>
<p>We are going to add in support to place alerts into a MySQL database. If MYSQL is installed on the system, you can use the &#8220;<strong>&#8211;with-mysql</strong>&#8221; configuration option to specify where. In a previous post, “<a href="http://blog.securitymonks.com/2008/04/07/introduction-to-mysql/">Introduction to MySQL</a>,” we went through the installation of MySQL into the /usr/local/mysql directory. For such an installation, the <strong>&#8211;with-mysql-includes=/usr/local/mysql/include</strong> and <strong>&#8211;with-mysql-libraries=/usr/local/mysql/lib</strong> command options must be used.  In order to use the dynamic plugin libraries, Snort needs to be able to find libmysqlclient.so. On some operating systems, you may <a href="http://www.snort.org/archive-11-3690.html">have problems</a>. Adding <strong>LDFLAGS=&#8221;-L/usr/local/mysql/lib/mysql&#8221;</strong> should work.
</p>
<p>
You may want to consider configuring Snort to allow <a href="http://cvs.snort.org/viewcvs.cgi/*checkout*/snort/doc/README.decoder_preproc_rules">decoder and preprocessor rule eventing</a>.  This allows you to enable and disable decoder and preprocessor events on a rule by rule bases.  It also allow you to specify the rule type or action of a decoder or preprocessor event on a rule by rule basis.  Enable this configuration option with the configuration option using <strong>&#8211;enable-iplist</strong>.
</p>
<p>
We will also be adding in large file support.  To allow enable blacklist files, we must include the configuration option <span style="FONT-WEIGHT: bold">&#8211;enable-iplist</span>. If you had to install libdnet in a special location, you will need to specify that location with the &#8220;<span style="FONT-WEIGHT: bold">&#8211;with-dnet-includes=</span>&#8221; and &#8220;<span style="FONT-WEIGHT: bold">&#8211;with-dnet-libraries=</span>&#8221; configuration options.
</p>
<p>
We will configure Snort with the following command:
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode> /usr/local/src/snort-2.8.4.1 root# CFLAGS="-D_LARGEFILE_SOURCE \
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" \
./configure --prefix=/usr/local/snort --with-libpcap-includes=/usr/local/snort/include \
--with-libpcap-libraries=/usr/local/snort/lib \
--with-libpcre-includes=/usr/local/pcre/include \
--with-libpcre-libraries=/usr/local/pcre/lib \
--with-mysql-includes=/usr/local/mysql/include\
--with-mysql-libraries=/usr/local/mysql/lib \
--enable-iplist \
--enable-decoder-preprocessor-rules</pre>
</td>
</tr>
</tbody>
</table>
<p>After you configure Snort, you continue to make and install it.
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode> /usr/local/src/snort-2.8.4.1 root# make
 /usr/local/src/snort-2.8.4.1 root# make check
 /usr/local/src/snort-2.8.4.1 root# make install
 /usr/local/src/snort-2.8.4.1 root# mkdir -p /usr/local/snort/etc
 /usr/local/src/snort-2.8.4.1 root# cp etc/* /usr/local/snort/etc
 /usr/local/src/snort-2.8.4.1 root# mkdir -p /usr/local/snort/preproc_rules
 /usr/local/src/snort-2.8.4.1 root# cp preproc_rules/*.rules /usr/local/snort/preproc_rules
 /usr/local/src/snort-2.8.4.1 root# /usr/local/snort/bin/snort -V

 ,,_ -*&gt; Snort! &lt;*-
 o" )~ Version 2.8.4.1 (Build 38)
 '''' By Martin Roesch &amp; The Snort Team: <a class=moz-txt-link-freetext href="http://www.snort.org/team.html">http://www.snort.org/team.html</a>
 Copyright (C) 1998-2009 Sourcefire, Inc., et al.
 Using PCRE version: 7.8 2008-09-05</pre>
</td>
</tr>
</tbody>
</table>
<p>You may need to move the <strong>lib_sfdynamic_example_rule.so</strong>, if you receive errors. Just issue the command:
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode> /usr/local/src/snort-2.8.4.1 root# mv /usr/local/snort/lib/snort_dynamicrules/\
lib_sfdynamic_example_rule.so \
/usr/local/snort/lib/snort_dynamicrules/lib_sfdynamic_example_rule.so.broke</pre>
</td>
</tr>
</tbody>
</table>
<p><h4><strong>Rules</strong> </h4>
<p>Now we need some rules. For this example we will get the rules from the <a href="http://www.snort.org/pub-bin/downloads.cgi">Snort</a> and the <a href="http://www.emergingthreats.net/">Emerging Threats site</a>. You will need to register for the rules at the Snort site. Do consider subscribing for the latest up-to-date rules. Registered users can only access rules 30 days after their release.
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode> root# cd /usr/local/snort/rules
 /usr/local/snort/rules root# wget <a class=moz-txt-link-freetext href="http://www.emergingthreats.net/rules/emerging-all.rules">http://www.emergingthreats.net/rules/emerging-all.rules</a>
 /usr/local/snort/rules root# cd /usr/local/src
 /usr/local/src root# wget \
<a class=moz-txt-link-freetext href="http://www.snort.org/pub-bin/downloads.cgi/\">http://www.snort.org/pub-bin/downloads.cgi/\</a>
Download/vrt_os/snortrules-snapshot-CURRENT.tar.gz
 /usr/local/src root# md5sum snortrules-snapshot-CURRENT.tar.gz
184aed405da3f1043b82d81c98122237 snortrules-snapshot-CURRENT.tar.gz
 /usr/local/src root# mv snortrules-snapshot-CURRENT.tar.gz /usr/local/snort/
 /usr/local/src root# cd /usr/local/snort/
 /usr/local/snort root# tar xzf snortrules-snapshot-CURRENT.tar.gz
 /usr/local/snort root# rm snortrules-snapshot-CURRENT.tar.gz
 /usr/local/snort root# vi /usr/local/snort/etc/snort.conf</pre>
</td>
</tr>
</tbody>
</table>
<p>Modify /usr/local/snort/etc/snort.conf to your environment. Make sure the <strong>RULE_PATH</strong> is set to /usr/local/snort/rules. If you configured Snort to enable decoder and preprocessor rules, you will need to add a line specifying the location of those files.  Define <strong>PREPROC_RULE_PATH</strong> with the line:
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode> var PREPROC_RULE_PATH ../preproc_rules</pre>
</td>
</tr>
</tbody>
</table>
<p>
Later in the snort.conf file include the lines (before other rule lists are included):
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode> include $PREPROC_RULE_PATH/preprocessor.rules
 include $PREPROC_RULE_PATH/decoder.rules</pre>
</td>
</tr>
</tbody>
</table>
<p>
If you wish to use the emerging threat rules, add:
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode> include $RULE_PATH/emerging-all.rules</pre>
</td>
</tr>
</tbody>
</table>
<p>
in the /usr/local/snort/etc/snort.conf file. Do not forget to adjust <strong>dynamicpreprocessor file</strong> and <strong>dynamicengine</strong> path. Mac OS X users will need to use the dynamic libraries. Uncomment the Mac OS X lines in the Snort configuration file.
</p>
<p><h4><strong>Dumbpig</strong></h4>
<p>Leon Ward has released a Perl program, <a href="http://leonward.wordpress.com/dumbpig/">Dumbpig</a>, which will check Snort rules for badly formatted entires and incorrect usage.  He has even added blacklist support (see posting &#8220;<a href="http://leonward.wordpress.com/2009/07/20/et-rbn-blacklists-with-snort-and-dumbpig/">ET RBN Blacklists with Snort and DumbPig</a>&#8220;).  To pull down dumbpig.pl, the required Perl modules, and run it against the Emerging Threats rule set:
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode> root# cd /home/snort/perl
 /home/snort/perl root# wget rm-rf.co.uk/downloads/dumbpig.pl
 /home/snort/perl root# chmod u+x ./dumbpig.pl
 /home/snort/perl root# cpan -e "Parse::snort"
 /home/snort/perl root# cpan -e "LWP::Simple"
 /home/snort/perl root# ./dumbpig.pl -r /usr/local/snort/rules/emerging-all.rules
DumbPig version 0.5 - leon.ward@sourcefire.com
Because I hate looking for the same dumb problems with snort rule-sets

          __,,    ( Dumb-pig says     )
        ~(  oo ---( "ur rulz r not so )
          ''''    ( gud akshuly" *    )

Config
----------------------
* Sensivity level - 3/3
* Blacklist outputi : Disabled
* Processing File - /home/snort/rules//emerging-all.rules
* Check commented out rules : Disabled
* Pause : Disbled
* ForceFail : Disabled
* Censor : Disabled
* Quite mode : Disabled
----------------------
Issue 1
1 Problem(s) found with rule on line 59 of /home/snort/rules//emerging-all.rules

alert tcp $HOME_NET any -> \
[75.126.138.202,72.249.118.38,208.78.69.70,204.13.249.70,208.78.68.70] $HTTP_PORTS  ( \
    msg:"ET CURRENT_EVENTS Possible Downadup/Conficker-A Infection Checking Geographical Location"; \
    flow:to_server; \
    classtype:trojan-activity; \
    reference:url,www.microsoft.com/security/portal/Entry.aspx?Name=Worm%3aWin32%2fConficker.A; \
    reference:url,www.f-secure.com/v-descs/worm_w32_downadup_a.shtml; \
    threshold:type both, count 5, seconds 60, track by_src; \
    reference:url,doc.emergingthreats.net/bin/view/Main/2008803; \
    reference:url,www.emergingthreats.net/cgi-bin/cvsweb.cgi/sigs/CURRENT_EVENTS/CURRENT_Conficker; \
    sid:2008803; \
    rev:3; \
)
- TCP/UDP rule with no deep packet checks? This rule looks more suited to a firewall or blacklist
alert tcp $HOME_NET any ->
[75.126.138.202,72.249.118.38,208.78.69.70,204.13.249.70,208.78.68.70] $HTTP_PORTS (msg:"ET CURRENT_
EVENTS Possible Downadup/Conficker-A Infection Checking Geographical
Location"; flow:to_server; classtype:trojan-activity;
reference:url,www.microsoft.com/security/portal/Entry.aspx?Name=Worm%3aWin32%2fConficker.A;
reference:url,www.f-secure.com/v-descs/worm_w32_downadup_a.shtml;
threshold:type both, count 5, seconds 60, track by_src;
reference:url,doc.emergingthreats.net/bin/view/Main/2008803;
reference:url,www.emergingthreats.net/cgi-bin/cvsweb.cgi/sigs/CURRENT_EVENTS/CURRENT_Conficker;
sid:2008803; rev:3;)
</pre>
</td>
</tr>
</tbody>
</table>
<p>
There are many more issues reported.  I included the first issue, because it brings up the point that rules can be rewritten to use blacklists.  In Leon&#8217;s post, he found rewriting the Russian Business Network rules dropped processing time by over 40 percent.  The Dumbpig program, along with the blacklist patch, can help tremendously with performance.
</p>
<p><h4><strong>Configuration File</strong></h4>
</p>
<p>In the /usr/local/snort/etc/snort.conf file, make sure to add <strong>iplist preprocessor</strong> command. For example, if we are going to combine the three separate source for blacklists into one blacklist file, we might want to do:
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode> preprocessor iplist: blacklist watchlist /usr/local/snort/conf/combo.blacklist \
 whitelist /usr/local/snort/conf/default.whitelist</pre>
</td>
</tr>
</tbody>
</table>
<p><h4><strong>Testing Snort Using Attack Data</strong></h4>
</p>
<p>Whenever installing a new version of Snort, it is a good idea to test it. Leon Ward has made available a pcap file containing attacks that occurred back in 2001 against a honeypot. If you have other data that will produce interesting results, please feel free to use that.
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode> root# mkdir -p /data/ids/tcpdump
 root# cd /data/ids/tcpdump
 /data/ids/tcpdump root# wget <a class=moz-txt-link-freetext href="http://rm-rf.co.uk/downloads/Honeynet-RFP-iis.tgz">http://rm-rf.co.uk/downloads/Honeynet-RFP-iis.tgz</a>
 /data/ids/tcpdump root# tar xzf Honeynet-RFP-iis.tgz
 /data/ids/tcpdump root# /usr/local/snort/bin/snort -c /usr/local/snort/etc/snort.conf \
-A fast -l /data/ids/tcpdump -r ./Honeynet-RFP-iis.pcap
 /data/ids/tcpdump root# ls /data/ids/tcpdump/alert /data/ids/tcpdump/snort.log.*</pre>
</td>
</tr>
</tbody>
</table>
</p>
<p>Two results files should get created. The file /data/ids/tcpdump/<strong>alert</strong> will contain the alerts and /data/ids/tcpdump/<strong>snort.log.&lt;date&gt;</strong>, which contains the pcaps of the detected events.</p>
<h2>Blacklists</h2>
<p>We will pull down upates from <a href="http://malwaredomains.com/">DNS-BH Malware Domain Blocklist</a>, the <a href="http://watchlist.security.org.my/watchlist">Global Watchlist</a>, and <a href="http://www.infiltrated.net/blacklisted">Ninja Chimp Strike Force Blacklist</a>. The file format for the DNS-BH blocklist is:</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode># domain type original_reference-why_it_was_listed dateadded seqnum note--pound sign=comment 1
# notice notice duplication is not permitted 2
 00.devoid.us malware <a class=moz-txt-link-abbreviated href="http://www.cyber-ta.org/releases/malware-analysis/public/SOURCES/DNS.Cumulative.Summary">www.cyber-ta.org/releases/malware-analysis/public/SOURCES/DNS.Cumulative.Summary</a> 20090321 3
 032439.com malware <a class=moz-txt-link-abbreviated href="http://www.malwaredomainlist.com">www.malwaredomainlist.com</a> 20080822 9
 0503.pass.as malware <a class=moz-txt-link-abbreviated href="http://www.threatexpert.com/report.aspx?md5=21d60d5e9b8c9353b1b55994dfa1b11e">www.threatexpert.com/report.aspx?md5=21d60d5e9b8c9353b1b55994dfa1b11e</a> 20080503 11</pre>
</td>
</tr>
</tbody>
</table>
<p>The Global Watchlist uses the file format:
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode># watchlist.security.org.my, contact <a class=moz-txt-link-abbreviated href="mailto:mel@hackinthebox.org">mel@hackinthebox.org</a>
# ip/net, source, comment, name, last update (GMT+8)
10.50.50.50, <a class=moz-txt-link-freetext href="http://www.dshield.org/ipsascii.html">http://www.dshield.org/ipsascii.html</a>, Dshield: Top IPs, dshield-top-ips, 2009/07/20 00:00:11
61.184.255.175, <a class=moz-txt-link-freetext href="http://www.dshield.org/ipsascii.html">http://www.dshield.org/ipsascii.html</a>, Dshield: Top IPs, dshield-top-ips, 2009/07/20 00:00:11
222.82.249.235, <a class=moz-txt-link-freetext href="http://www.dshield.org/ipsascii.html">http://www.dshield.org/ipsascii.html</a>, Dshield: Top IPs, dshield-top-ips, 2009/07/20 00:00:11</pre>
</td>
</tr>
</tbody>
</table>
<p>Ninja Chimp uses the file format:
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode># This is a compiled list of dirty hosts associated
# with bruteforcing attempts, spam, botnets, etc.
# The list is comprised of data from Arbor Networks,
# Project Honeypot, Shadowserver, and about 24+ hosts
# I maintain. It is sorted on an hourly basis to keep
# information current and is consistently changing

Sun Jul 19 12:59:03 CDT 2009

99.254.50.139
99.248.26.177</pre>
</td>
</tr>
</tbody>
</table>
<p>In order to track the data and be able to generate various reports, we will take the data and place it into a databases. The database schema can be fairly simple. The &#8220;ip&#8221; feild represents the ip or network address. We will add an &#8220;end_ip&#8221; to reduce calculation time and allow use to search if an IP appears within ip/cidr.
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode>mysql&gt; describe watchlist;
+------------+------------------+------+-----+---------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+------------------+------+-----+---------------------+-------+
| ip | int(10) unsigned | NO | PRI | 0 | |
| cidr | int(2) unsigned | NO | | 0 | |
| source | varchar(100) | YES | | NULL | |
| comment | varchar(50) | YES | | NULL | |
| name | varchar(50) | YES | | NULL | |
| lastupdate | datetime | YES | | 0000-00-00 00:00:00 | |
| domain | varchar(50) | YES | | NULL | |
| reported | datetime | YES | | 0000-00-00 00:00:00 | |
| active | enum('yes','no') | YES | | no | |
| end_ip | int(10) unsigned | YES | MUL | 0 | |
+------------+------------------+------+-----+---------------------+-------+</pre>
</td>
</tr>
</tbody>
</table>
<p>We will create two Perl programs. The first program to pull the data down from the websites and the second program parses the files and load the information into the tables. The different blacklist sites are pulling information from the same sources. Overlap is expected. Each IP and network will get only one entry into the database and be listed once in the Snort blacklist file. The first program to pull data down from the sites might look like:
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode>#!/usr/local/bin/perl -w

use LWP::UserAgent;

sub readpage {
 my($url) = @_;

 my $ua = new LWP::UserAgent;

 # Go out and retrieve page
 my $req = new HTTP::Request('GET', $url);
 my $res = $ua-&gt;request($req);

 # Check if the requested webpage is there and return results
 if ($res-&gt;is_success) { # Request successful
 return(1,$res-&gt;content)
 }
 else {
 return(0,"");
 }
}

sub pulldate {
 my($url,$inputfn) = @_;

 my ($pjstatus,$page) = &amp;readpage($url);
 if ($pjstatus) {
 open(OUTFILE, "&gt;$inputfn") || die "ERROR: Can't open $inputfn: $!\n";
 print OUTFILE $page;
 close(OUTFILE);
 }
 return($pjstatus);
}

# Main

my $base_dir = "/home/snort/projects/blacklists";
my $datadir = $base_dir . "/data/";

chdir $datadir || die "ERROR: Data directory $datadir does not exist: $!\n";
&amp;pulldate(<a class=moz-txt-link-rfc2396E href="http://watchlist.security.org.my/all.txt">"http://watchlist.security.org.my/all.txt"</a>,$datadir . 'watchlist.dat');
&amp;pulldate(<a class=moz-txt-link-rfc2396E href="http://www.malwaredomains.com/files/domains.txt">"http://www.malwaredomains.com/files/domains.txt"</a>,$datadir . 'domains.dat');
&amp;pulldate(<a class=moz-txt-link-rfc2396E href="http://www.infiltrated.net/blacklisted">"http://www.infiltrated.net/blacklisted"</a>,$datadir . 'blacklisted.dat');</pre>
</td>
</tr>
</tbody>
</table>
<p>The second Perl program to parse the blacklists, is a bit longer. Initially I planned in including it, but this post is already quite long. I will leave the program to the reader&#8217;s creative mind. You know the format of the data sources and you know the database. It is not difficult to write a program to parse the files and place the data into the database. Just make sure to check if the IP/network is already in the watchlist table. If there is already an entry, only update the lastupdate feild. You will use that to track IPs and networks that may be dropped from the blacklist files.
</p>
<p> You should note that the various blacklist will report the IPs and domains differently. The DNS-BH blocklist provides the domainname. You may want to convert that into IP/CIDR notation. Ninja Chimp blacklist contains only a list of IPs. The Global watchlist will provide IPs or networks. You may choose to use the Net::DNS and/or the Geo::IP Perl modules, depending on what information you want to store. If you use these modules, you should also be aware that such operations may end up warning the hostel domains that your site is trying to lookup information on those IPs. There is always the option to tunnel the request to an an IP that will not resolve back to your organization.  </p>
</p>
<p>Since I like to gather information on the IPs and networks for use in evaluating the potential threat level, I keep the following information for each IP/network:
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class="fixedfont" bgColor=#f5f5f5 >
<pre class=displaycode>
mysql&gt; describe watchips;
+--------------+------------------+------+-----+---------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+------------------+------+-----+---------------------+-------+
| ip | int(10) unsigned | NO | PRI | 0 | |
| hostname | varchar(50) | YES | | NULL | |
| entered | datetime | YES | | 0000-00-00 00:00:00 | |
| lastseen | datetime | YES | | 0000-00-00 00:00:00 | |
| asn | int(5) unsigned | NO | MUL | 0 | |
| asn_comp | varchar(50) | YES | | NULL | |
| asn_desc | varchar(75) | YES | | NULL | |
| network | int(10) unsigned | NO | | 0 | |
| cidr | int(2) unsigned | YES | | NULL | |
| ccode | varchar(2) | NO | MUL | NULL | |
| rir | varchar(10) | YES | | NULL | |
| rir_moddate | date | YES | | 0000-00-00 | |
| ccode3 | varchar(2) | YES | | NULL | |
| country_name | varchar(50) | YES | | NULL | |
| region | varchar(25) | YES | | NULL | |
| region_name | varchar(50) | YES | | NULL | |
| city | varchar(25) | YES | | NULL | |
| postal_code | varchar(25) | YES | | NULL | |
| latitude | decimal(7,4) | NO | | 0.0000 | |
| longitude | decimal(7,4) | NO | | 0.0000 | |
| time_zone | varchar(25) | YES | | NULL | |
| area_code | varchar(5) | YES | | NULL | |
| continent | varchar(2) | YES | | NULL | |
| metro_code | int(3) unsigned | NO | | 0 | |
+--------------+------------------+------+-----+---------------------+-------+</pre>
</td>
</tr>
</tbody>
</table>
<p><h2>Creating Blacklist Files for Snort</h2>
<p>The files Snort uses for blacklists are specified in the snort.conf file (mentioned above). The format for these files are:
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode># This is a blacklist file, there are many like it but this one is mine
# Comments are supported
#10.1.1.0/24 192.168.0.0/16 # I can do inline comments too and put
 # multiple CIDR blocks on one line
10.50.50.50/32</pre>
</td>
</tr>
</tbody>
</table>
<p>A Perl program to pull the data from the tables and generate the blacklist files in the format Snort expects can be as simple as:
</p>
<table cellSpacing=1 cellPadding=0 width="100%" border=1>
<tbody>
<tr>
<td class=code-outline bgColor=#f5f5f5>
<pre class=displaycode>#!/usr/local/bin/perl -w

use DBI;

my $base_dir = "/usr/local/snort/conf";
my $snortfile = $base_dir . "/combo.blacklist";
my $db = "badips";
my $mysql_user = "secretpig";
my $mysql_passwd = "secretpigpassword";
my $db_host = 'localhost';
my $results = "";

local($dbh) = DBI-&gt;connect("DBI:mysql:$db:$db_host",
$mysql_user, $mysql_passwd) || die "ERROR: Connecting: $DBI::errstr\n";

my $start_time = `/bin/date -d '7 day ago' +"%Y-%m-%d %H:%M:%S"`;
chomp $start_time;
my $sql = qq{ SELECT inet_ntoa(ip), cidr, comment, source
 FROM watchlist WHERE lastupdate &gt;= ? AND active=? };
$sth = $dbh-&gt;prepare( $sql );
$rc = $sth-&gt;execute($start_time,"YES");
if ($rc) {
 while (my($ip,$cidr,$ocomment,$source) = $sth-&gt;fetchrow_array()) {
 my $comment = "$source";
 if ($ocomment ne "") {
 $comment = $ocomment . " ($source)";
 }
 $results .= sprintf "%-20s # $comment\n","$ip/$cidr";
 }
}
open(OUTFILE,"&gt;$snortfile");
print OUTFILE $results;
close(OUTFILE);
exit;</pre>
</td>
</tr>
</tbody>
</table>
<p><h2>Final Thoughts</h2>
<p>The above program will generate a large number of blacklisted IPs and domains. It might be helpful to add a process that helps evaluates the threat a little further. This was the motivation behind the work done by Jian Zhang (SRI), Phillip Porras (SRI), and Johannes Ullrich (<a href="http://www.sans.org/">SANS Institute</a>). They attempted to develop a highly predictive blacklist (<a href="http://www.cyber-ta.org/releases/HPB/hpb.html">HPB</a>). The technology is similar to Google&#8217;s PageRank algorithm using a multiphase approach which uses a relevance ranking and severity assessment to produce blacklists potentially unique for each organization or organization type participating in the HPB process. </p>
<p>
While I do believe in tapping into the collaborative intelligence of the security community, one needs to verify the integrity of the information before it can be trusted.  It is ill advised to automatically block IPs or networks listed in any blacklist unless your organization can accept the consequences.  This holds true for commercial products as well.  For example, image your organization HQ&#8217;s IP, through an accident or hackers, ending up on the blacklist.  That is a large part of the motivation behind the work I have been doing with the Threat Observation, Tracking, and Evaluation Model (<a href="http://blog.securitymonks.com/2009/06/06/totem-threat-observation-tracking-and-evaluation-model/">TOTEM</a>).  While I encourage organizations to take advantage of such options as sharing their organization’s information with <a href="http://www.dshield.org/about.html">DShield</a> and receiving tailored HPBs, always verify before taking actions. Develop some form of an additional assessment method within your organization. Good security solutions involve layers. Blacklists can be a very useful tool in an organization’s security arsenal.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.securitymonks.com/2009/07/19/blacklisting-with-snort/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>TOTEM: Threat Observation, Tracking, and Evaluation Model</title>
		<link>http://blog.securitymonks.com/2009/06/06/totem-threat-observation-tracking-and-evaluation-model/</link>
		<comments>http://blog.securitymonks.com/2009/06/06/totem-threat-observation-tracking-and-evaluation-model/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 01:29:06 +0000</pubDate>
		<dc:creator>John Gerber</dc:creator>
				<category><![CDATA[ANL Federated Model]]></category>
		<category><![CDATA[Bro]]></category>
		<category><![CDATA[CAMNEP]]></category>
		<category><![CDATA[CPP]]></category>
		<category><![CDATA[Defense in Depth]]></category>
		<category><![CDATA[IDS]]></category>
		<category><![CDATA[Reputation]]></category>
		<category><![CDATA[Risk]]></category>
		<category><![CDATA[SlideCasting]]></category>
		<category><![CDATA[SlideShare]]></category>
		<category><![CDATA[Snort]]></category>
		<category><![CDATA[TVA]]></category>
		<category><![CDATA[Trust Management]]></category>
		<category><![CDATA[Visualization]]></category>
		<category><![CDATA[Vulnerability]]></category>

		<guid isPermaLink="false">http://blog.securitymonks.com/?p=1165</guid>
		<description><![CDATA[This week I had the pleasure of presenting two talks at the National Laboratories Information Technology (NLIT) 2009 Summit held in Oak Ridge, TN.  Everyone involved was great and I had a fun time.  Since the presentations have been posted to the NLIT site, I am free to post now.  

The original [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://imagecache2.allposters.com/images/pic/BRGPOD/203201~St-John-Chrystostomos-circa-347-407-Preaching-Before-the-Empress-Eudoxia-circa-404-circa-1880-Posters.jpg"><img src="http://imagecache2.allposters.com/images/pic/BRGPOD/203201~St-John-Chrystostomos-circa-347-407-Preaching-Before-the-Empress-Eudoxia-circa-404-circa-1880-Posters.jpg" alt="" align="left" width=150 /></a>This week I had the pleasure of presenting two talks at the <a href="http://www.fbcinc.com/nlit/default.aspx">National Laboratories Information Technology (NLIT)</a> 2009 Summit held in Oak Ridge, TN.  Everyone involved was great and I had a fun time.  Since the presentations have been <a href="http://info.ornl.gov/events/nlit09/Pages/Home.aspx">posted</a> to the NLIT site, I am free to post now.  </p>
<p>
The original slides made heavy use of the <a href="http://en.wikipedia.org/wiki/PowerPoint_animation">Microsoft PowerPoint animation</a> feature.  Unfortunately, SlideShare does not currently support animation.  You can download the presentation and the animations will work, but I ended up modifying the slides so they are more viewable online.  <a href="http://www.slideboom.com/">SlideBoom</a> will keep the animation, but it does it by creating a video of the presentation.  I decided to stick with SlideShare and spare you the resulting nine minute video.  While I should add audio and make a <a href="http://www.slideshare.net/jboutelle/slidecasting-101">SlideCast</a>, this post might never be completed if I wait until I have time to create a really nice web presentation.
</p>
<p>
<a href="http://www.merriam-webster.com/dictionary/totem">Merriam-Webster</a> defines a <strong>totem</strong> as any supposed entity that watches over or assists a group of people, such as a family, clan, or tribe.  In this presentation I focused on how TOTEM assists in watching over and evaluating the threat an IP represents.  The idea behind TOTEM is simple: compare threat information from sources such as watchlists (DShield, Emerging Threats, SenderBase, etc.) to activities with the organization (IDS/IPS, flow logs, etc.) and other locations (SANS ISC, DOE federated model, etc.).  As new threat information and activity sources are added, a better evaluation can be rendered.
</p>
<p><div style="width:425px;text-align:left" id="__ss_1543517"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/johngerber/totem-threat-observation-tracking-and-evaluation-model-1543517?type=powerpoint" title="TOTEM: Threat Observation, Tracking, and Evaluation Model">TOTEM: Threat Observation, Tracking, and Evaluation Model</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=totem-090606185822-phpapp02&#038;rel=0&#038;stripped_title=totem-threat-observation-tracking-and-evaluation-model-1543517" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=totem-090606185822-phpapp02&#038;rel=0&#038;stripped_title=totem-threat-observation-tracking-and-evaluation-model-1543517" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View more presentations by <a style="text-decoration:underline;" href="http://www.slideshare.net/johngerber">John Gerber</a>.</div>
</div>
<p>
The purpose of this presentation has been to share the basic ideas behind TOTEM with the hope that others may provide helpful insight.  So far I have not disappointed.  I wanted to thank everyone for I have received some very intriguing ideas.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.securitymonks.com/2009/06/06/totem-threat-observation-tracking-and-evaluation-model/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Snort 3: The Next Generation</title>
		<link>http://blog.securitymonks.com/2008/10/20/snort-3-the-next-generation/</link>
		<comments>http://blog.securitymonks.com/2008/10/20/snort-3-the-next-generation/#comments</comments>
		<pubDate>Tue, 21 Oct 2008 02:12:54 +0000</pubDate>
		<dc:creator>John Gerber</dc:creator>
				<category><![CDATA[IDS]]></category>
		<category><![CDATA[Snort]]></category>

		<guid isPermaLink="false">http://blog.securitymonks.com/?p=610</guid>
		<description><![CDATA[The folks at Sourcefire have been working hard at creating the next generation of Snort.  Martin Roesch, captain of the brave development team, is boldly taking Snort where no pig has gone before.  Cyberspace, the final frontier.  Seriously, the core framework for Snort is being rewritten from the ground up.  With [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.snort.org/"><img src="http://images4.wikia.nocookie.net/muppet/images/thumb/e/e5/PIS.jpg/300px-PIS.jpg" align="left" width=150 /></a>The folks at <a href="http://www.sourcefire.com">Sourcefire</a> have been working hard at creating the next generation of Snort.  <a href="http://securitysauce.blogspot.com/">Martin Roesch</a>, captain of the brave development team, is boldly taking Snort where no pig has gone before.  Cyberspace, the final frontier.  Seriously, the core framework for Snort is being rewritten from the ground up.  With Snort turning ten in November, the development effort is about adding capabilities to Snort while allowing the current functionality, along with all the rules that have been developed over the years, to continue to work.  Need more power from the engines?  The Sourcefire development team is working on it.  In a world where network throughput is ever increasing, the new architecture is compartmentalizing Snort&#8217;s subsystems.  Snort will be <a href="http://en.wikipedia.org/wiki/Multithreading">multithreaded</a> to take advantage of <a href="http://en.wikipedia.org/wiki/Multi-core">multi-core</a> platforms.  Marty predicts, &#8220;You’ll be running Snort on bigger and faster networks, so in version 3 we made it easier to add hardware acceleration to it.” </p>
<h3>The Three Wise Men Speak</h3>
<p>As readers of this blog know, I have been looking at the <a href="http://bro-ids.org">Bro IDS</a>.  I hope to shortly release a post on setting up <a href="http://bro-ids.org/download.html">Bro 1.4</a>, which was released this Friday.  It will be interesting to watch these two IDS/IPS progress in the upcoming year.  With two such development efforts, it was somewhat surprising to read the news release from the Open Information Security Foundation (OIS) that &#8220;<a href="http://www.openinfosecfoundation.org/">OISF Receives Grant Funding for Open Source Next Generation IDS/IPS</a>.&#8221;  Good to see that innovation is occurring in an area of security previously given up for dead (see post, &#8220;<a href="http://blog.securitymonks.com/2008/08/09/idsips-the-mark-twain-of-the-security-world/">IDS/IPS: The Mark Twain of the Security World</a>&#8220;).</p>
<p>
For cutting edge knowledge on Snort 3 development, Martin Roesch, Leon Ward, and Richard Bejtlich are three wise men who can provide greater insight.  Fortunately, they have all written posts on Snort 3:</p>
<ul>
<li><a href="http://securitysauce.blogspot.com/2007/11/snort-30-architecture-series-part-1.html">Snort 3 Architecture Series Part 1: Overview</a>  by Martin Roesch</li>
<li><a href="http://securitysauce.blogspot.com/2008/08/snort-30-architecture-series-part-2.html">Snort 3.0 Architecture Series Part 2: Changes and Betas</a> by Martin Roesch</li>
<li><a href="http://securitysauce.blogspot.com/2008/08/snort-30-architecture-series-part-3.html">Snort 3.0 Architecture Series Part 3: The command shell</a> by Martin Roesch</li>
<li><a href="http://rm-rf.co.uk/2008/07/snort-3-beta-on-ubuntu-debian-installation/">Snort 3 Beta on Ubuntu / Debian Installation</a> by Leon Ward</li>
<li><a href="http://searchsecuritychannel.techtarget.com/tip/0,289483,sid97_gci1328485,00.html">Using SnortSP and Snort 2.8.2</a> by Richard Bejtlich</li>
<li><a href="http://searchsecuritychannel.techtarget.com/tip/0,289483,sid97_gci1323897,00.html">The power of Snort 3.0</a> by Richard Bejtlich</li>
</ul>
<h3>Overview</h3>
<p>In this post, we will be installing Snort 2.8.3.1, the Snort Security Platform (SnortSP), and the Snort 3 analytical engine. Please see Martin Roesch&#8217;s, Leon Ward&#8217;s, and Richard Bejtlich&#8217;s posts for more in-depth discussion.  I am going to discuss a few basic concepts of the Snort 3 architecture, go through installation, and discuss some configuration and operation of the software.  I plan on following this post with a another concerning the setup and installation of Bro 1.4.  I will follow that post with an analysis of results from the two systems.  At some point, we will discuss integration of results into <a href="http://blog.securitymonks.com/2008/08/07/rtir-adding-incident-response-capabilities-to-rt/">RTIR</a>.
</p>
<p>
The Snort 3 architecture consists of the software framework, called the Snort Security Platform (<strong>SnortSP</strong>) and <strong>engines</strong>.  Sometimes SnortSP will be referred to as &#8220;the framework&#8221; or just &#8220;framework.&#8221;  SnortSP is designed to perform basically as an &#8220;operating system&#8221; for packet-based network security applications, providing common functionality that all programs need.  For example, it operates on the data source performing such functions as acquiring the data (DAQ), decoding, flow normalization, IP defragmentation, and stream reassembly.  SnortSP is composed of the action system, attribute management system (AMS), and the dispatcher.  It allows you the ability to interact with the system through the command shell and snortd.  From a developer&#8217;s point of view, SnortSP is what gathers data and handles any evasive techniques or other conditions that occur in suspicious and malicious traffic.  SnortSP normalizes the data and then provides this cleaned up data to the engines for inspection.  The engines are analysis modules that plug into SnortSP.  Sometimes the engines will be referred to as &#8220;engine modules,&#8221; &#8220;analytics modules,&#8221; or simply the &#8220;analytics.&#8221; Multiple engines can run simultaneously.  Here is a reference diagram.<br />
<img src="http://lh6.ggpht.com/mroesch0/SJtd4NoOa3I/AAAAAAAAAE8/KqeDocK3nGE/SnortSP%20engine%20block%20diagram.jpg?imgmax=800" alt="" /><br />
Some of the major features of Snort 3 include:
<ul>
<li>Shell-based user interface with embedded scripting language</li>
<li>Native IPv6, MPLS and GRE support</li>
<li>Native support for inline operation</li>
<li>More subsystem plugin types such as data acquisition modules, decoders and traffic analyzers</li>
<li>Multithreaded execution model &#8211; multiple analysis engines may operate simultaneously on the same traffic</li>
<li>Performance increases</li>
</ul>
<p>SnortSP comes with a Snort 2.8.2 detection engine implemented as a SnortSP engine module.  Annother engine that is being developed is an network contextually aware engine that will allow Snort to understand what it is defending.  Marty describes network context as, &#8220;essentially data about the environment that is being defended by Snort, the composition of the hosts in the network as well as the local network composition.&#8221;  The idea is that no longer will you have to manually teach Snort rules.  Marty reports &#8220;You teach Snort what the network looks like so it can defend itself accordingly. It tunes itself. My end goal is to have a self-tuning protection engine.”  Richard provides insight into another upcoming engine, &#8220;SnortSP is expected to support a new engine called <strong>Policy Enforcement Point (PEP)</strong>, a stateless (yes, not stateful) firewall that integrates with Sourcefire&#8217;s other products. Any engine running on the SnortSP will be able to call PEP to enforce access control decisions, assuming the sensor/IPS is in a place to take such actions.&#8221;   It will be very interesting to see what engines are developed.  This is the power of the design, giving Snort 3 the ability to grow to meet the needs of the security community.</p>
<h3>Installation and Configuration</h3>
<p>Generally, it is smart to start with what you know and determine expected results.  We will begin with setting up and installing the latest stable version of Snort (Snort 2.8.3.1).  Once it is configure and running, we will use some test data consisting of actual attacks that occurred in 2001.  This allows us to develop a baseline of expected results.  After that, we will move on to installing SnortSP, which comes with a implemented version of Snort 2.8.2 detection engine.  First, you will need to have libpcre version 6.0 or greater installed.</p>
<h4><strong>PCRE (pcre-7.8)</strong></h4>
<p>The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5.  If you can install PCRE via a port specific to your operating system, that is the best way to install in order to avoid having to keep the software up-to-date.  Below are the instructions for installing the software from source.</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 root# cd /usr/local/src
 /usr/local/src root# wget \

http://downloads.sourceforge.net/pcre/pcre-7.8.tar.gz?modtime=1220617433&#038;big_mirror=0

 /usr/local/src root# tar xzf pcre-7.8.tar.gz
 /usr/local/src root# cd pcre-7.8
 /usr/local/src/pcre-7.8 root# ./configure --prefix=/usr/local/pcre
 /usr/local/src/pcre-7.8 root# make
 /usr/local/src/pcre-7.8 root# make test
 /usr/local/src/pcre-7.8 root# make install
</pre>
</td>
</table>
<p></p>
<h4><strong>Libpcap and Large Files Support</strong></h4>
<p>Under some OSs, you need to compile <a href="http://www.tcpdump.org/">libpcap</a> and Snort to support large files (files large than 2G).  Since the source code of libpcap will be needed for this configuration, we are going to install the resulting libpcap under /usr/local/snort.  If the libpcap installed on your system does not produce an error, skip this step.  You will want to follow these steps only if you get the following error when running Snort with a large file:    </p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 root# ls -lh /data/ids/full2.pcap
-rw-r--r-- 1 root root 12G Oct 26 10:01 /data/ids/full2.pcap
 root# /usr/local/snort/bin/snort -o -A none -c /usr/local/snort/conf/snort.conf -l /logs/snort/logs \
-r /data/ids/full2.pcap
Error getting stat on pcap file: /data/ids/full2.pcap: Value too large for defined data type
RROR: Error getting pcaps
Fatal Error, Quitting..
</pre>
</td>
</table>
<p>
First, we need to compile large file support into libpcap.  As mentioned above, we will install the libraries under /usr/local/snort.</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 root# cd /usr/local/src
 /usr/local/src root# wget http://www.tcpdump.org/release/libpcap-0.9.8.tar.gz
 /usr/local/src root# wget http://www.tcpdump.org/release/libpcap-0.9.8.tar.gz.sig
 /usr/local/src root# wget http://www.tcpdump.org/tcpdump-workers.asc
 /usr/local/src root# gpg --import tcpdump-workers.asc
gpg: key 89E917F3: "tcpdump.org (SIGNING KEY) <tcpdump -workers@tcpdump.org>" not changed
gpg: Total number processed: 1
gpg:              unchanged: 1
 /usr/local/src root# gpg --verify libpcap-0.9.8.tar.gz.sig libpcap-0.9.8.tar.gz
gpg: Signature made Tue 25 Sep 2007 10:11:56 PM EDT using DSA key ID 89E917F3
gpg: Good signature from "tcpdump.org (SIGNING KEY) </tcpdump><tcpdump -workers@tcpdump.org>"
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 0227 54EB 4C30 9185 FD31  33A3 464D 3CEB 89E9 17F3
 /usr/local/src root# tar xzf libpcap-0.9.8.tar.gz
 /usr/local/src root# cd libpcap-0.9.8
 /usr/local/src/libpcap-0.9.8 root# ./configure --prefix=/usr/local/snort \
CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
-D_FILE_OFFSET_BITS=64"
 /usr/local/src/libpcap-0.9.8 root# make
 /usr/local/src/libpcap-0.9.8 root# make shared
 /usr/local/src/libpcap-0.9.8 root# make install
 /usr/local/src/libpcap-0.9.8 root# make install-shared
</tcpdump></pre>
</td>
</table>
<p>
In the next section, we will discuss how to install Snort with and without large file support.</p>
<h4><strong>Snort (snort-2.8.3.1)</strong></h4>
<p>The latest release of Snort, as of this writing, is Snort 2.8.3.1.  Below we will get the software, verify, configure, and install the software under the <strong>/usr/local/snort</strong> area.  Please adjust this to your environment.  Reminder to Mac OS X and FreeBSD users, use the <strong>md5</strong> command instead of md5sum.  </p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 root# cd /usr/local/src
 /usr/local/src root# wget http://www.snort.org/dl/snort-2.8.3.1.tar.gz
 /usr/local/src root# wget http://www.snort.org/dl/snort-2.8.3.1.tar.gz.md5
 /usr/local/src root# cat snort-2.8.3.1.tar.gz.md5
f7c03b322dae31dafc45756630f2946c  snort-2.8.3.1.tar.gz
 /usr/local/src root# md5sum snort-2.8.3.1.tar.gz
f7c03b322dae31dafc45756630f2946c  snort-2.8.3.1.tar.gz
 /usr/local/src root# tar xzf snort-2.8.3.1.tar.gz
 /usr/local/src root# cd  snort-2.8.3.1
</pre>
</td>
</table>
<p>
We are going to add in support to place alerts into a MySQL database.  If MYSQL installed by the system, you can use the &#8220;<strong>&#8211;with-mysql</strong>&#8221; configuration option.  In a previous post, &#8220;<a href="http://blog.securitymonks.com/2008/04/07/introduction-to-mysql/">Introduction to MySQL</a>,&#8221; we went through the installation of MySQL into the /usr/local/mysql directory.  For such an installation, the <strong>&#8211;with-mysql-includes=/usr/local/mysql/include</strong> and <strong>&#8211;with-mysql-libraries=/usr/local/mysql/lib</strong> command options must be used.  In order to use the dynamic plugin libraries, Snort needs to be able to find libmysqlclient.so.  On some operating systems, you may <a href="http://www.snort.org/archive-11-3690.html">have problems</a>.  Adding <strong>LDFLAGS=&#8221;-L/usr/local/mysql/lib/mysql&#8221;</strong> should work.  If you do not need to compile in large file support, you can do the compilation simply with the command: </p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 /usr/local/src/snort-2.8.3.1 root# ./configure --prefix=/usr/local/snort \
--with-libpcre-includes=/usr/local/pcre/include \
--with-libpcre-libraries=/usr/local/pcre/lib \
--with-mysql-includes=/usr/local/mysql/include\
--with-mysql-libraries=/usr/local/mysql/lib
</pre>
</td>
</table>
<p>
For adding in large file support, and having Snort use the libpcap installed under /usr/local/snort, do that with the following command:</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 /usr/local/src/snort-2.8.3.1 root# CFLAGS="-D_LARGEFILE_SOURCE \
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"  \
./configure --prefix=/usr/local/snort --with-libpcap-includes=/usr/localsnort/include \
--with-libpcap-libraries=/usr/local/snort/lib \
--with-libpcre-includes=/usr/local/pcre/include \
--with-libpcre-libraries=/usr/local/pcre/lib \
--with-mysql-includes=/usr/local/mysql/include\
--with-mysql-libraries=/usr/local/mysql/lib
</pre>
</td>
</table>
<p>
After you configure Snort (with or without large file support), you continue to make and install it.</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 /usr/local/src/snort-2.8.3.1 root# make
 /usr/local/src/snort-2.8.3.1 root# make check
 /usr/local/src/snort-2.8.3.1 root# make install
 /usr/local/src/snort-2.8.3.1 root# mkdir -p /usr/local/snort/etc
 /usr/local/src/snort-2.8.3.1 root# cp etc/* /usr/local/snort/etc
 /usr/local/src/snort-2.8.3.1 root# /usr/local/snort/bin/snort -V

   ,,_     -*> Snort! < *-
  o"  )~   Version 2.8.3.1 (Build 17)
   ''''    By Martin Roesch &#038; The Snort Team: http://www.snort.org/team.html
           (C) Copyright 1998-2008 Sourcefire Inc., et al.
           Using PCRE version: 7.8 2008-09-05
</releases></pre>
</td>
</table>
<p></p>
<h4><strong>Rules</strong></h4>
<p>Now we need some rules.  For this example we will get the rules from the <a href="http://www.snort.org/pub-bin/downloads.cgi">Snort</a> and the <a href="http://www.emergingthreats.net">Emerging Threats site</a>.  You will need to register for the rules at the Snort site.  Do consider subscribing for the latest up-to-date rules.  Registered users can only access rules 30 days after their release.  </p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 root# cd /usr/local/src
 /usr/local/src root# wget http://www.emergingthreats.net/rules/emerging.rules.tar.gz
 /usr/local/src root# tar xzf emerging.rules.tar.gz

 /usr/local/src root# mkdir -p /usr/local/snort/rules
 /usr/local/src root# mv rules/* /usr/local/snort/rules
 /usr/local/src root# rmdir rules
 /usr/local/src root# wget \

http://www.snort.org/pub-bin/downloads.cgi/\

Download/vrt_os/snortrules-snapshot-CURRENT.tar.gz
 /usr/local/src root# md5sum snortrules-snapshot-CURRENT.tar.gz
184aed405da3f1043b82d81c98122237  snortrules-snapshot-CURRENT.tar.gz
 /usr/local/src root# mv  snortrules-snapshot-CURRENT.tar.gz /usr/local/snort/
 /usr/local/src root# cd /usr/local/snort/
 /usr/local/snort root# tar xzf snortrules-snapshot-CURRENT.tar.gz
 /usr/local/snort root# rm snortrules-snapshot-CURRENT.tar.gz
 /usr/local/snort root# vi /usr/local/snort/etc/snort.conf
</pre>
</td>
</table>
<p>
Modify /usr/local/snort/etc/snort.conf to your environment.  Make sure the <strong>RULE_PATH</strong> is set to /usr/local/snort/rules.  If you wish to use the emerging threat rules, add:
</p>
<p>
 include $RULE_PATH/emerging.conf
</p>
<p>
in the /usr/local/snort/etc/snort.conf file.  Do not forget to adjust <strong>dynamicpreprocessor file</strong> and <strong>dynamicengine</strong> path.  Mac OS X users will need to use the dynamic libraries.  Uncomment the Mac OS X lines in the Snort configuration file.</p>
<h4><strong>Keeping Rules Current</strong></h4>
<p>If you want to setup a process to keep your rules as up-to-date as possible from the snort site, you will want to use the program Oinkmaster.  </p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 root# cd /usr/local/src
 /usr/local/src root# wget http://prdownloads.sourceforge.net/oinkmaster/oinkmaster-2.0.tar.gz?download
 /usr/local/src root# md5sum oinkmaster-2.0.tar.gz
d2a1b56f51cf40e919c63206ca4ec8f8  oinkmaster-2.0.tar.gz
 /usr/local/src root# tar xzf oinkmaster-2.0.tar.gz
 /usr/local/src root# cd oinkmaster-2.0
 /usr/local/src/oinkmaster-2.0 root# cp oinkmaster.pl /usr/local/snort/bin
 /usr/local/src/oinkmaster-2.0 root# cp oinkmaster.conf /usr/local/snort/etc
</pre>
</td>
</table>
<p>
Modify /usr/local/snort/etc/oinkmaster.conf changing &#8220;<strong>url=</strong>&#8221; to the location where you want rules to be archived.  The URL will also require a <a href="https://www.snort.org/reg-bin/userprefs.cgi">Oink Code</a>, which is available once you register with Snort and log into your account.  Multiple URLs can be specified for multiple files.  You can have Oinkmaster pull down rules from Snort and Emerging Threats.  I use oinkmaster to pull down the latest rules, place them in new rules directory (ex: /usr/local/snort/new-rules), backup the previously rules, and send email about what is new.  Some rules may have negative impact on Snort&#8217;s operation.  It is unwise to automatically update the rules without review.  Below, the backup/archive area is the directory /usr/local/snort/archive.  Modify /usr/local/snort/bin/oinkmaster.pl to know where oinkmaster.conf is located.  At that point you are ready to use oinkmaster to update your rules.</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 /usr/local/src/oinkmaster-2.0 root# mkdir /usr/local/snort/archive
 /usr/local/src/oinkmaster-2.0 root# vi /usr/local/snort/bin/oinkmaster.pl
 /usr/local/src/oinkmaster-2.0 root# vi /usr/local/snort/etc/oinkmaster.conf
 /usr/local/src/oinkmaster-2.0 root# /usr/local/snort/bin/oinkmaster.pl \
-o /usr/local/snortr/new-rules -b /usr/local/snort/archive
 /usr/local/src/oinkmaster-2.0 root# crontab -l
10 6 * * * /usr/local/snort/bin/oinkmaster.pl -o /usr/local/snort/new-rules -b /usr/local/snort/archive \
| Mail -s "Snort Rule Updates" abbot@securitymonks.com 2>&amp;1
</pre>
</td>
</table>
<p>
For automatic updates, set up a cron job that runs the above command and email the results.</p>
<h4><strong>Testing Snort Using Attack Data</strong></h4>
<p>Leon Ward has made available a pcap file containing attacks that occurred back in 2001 against a honeypot.  If you have other data that will produce interesting results, please feel free to use that.  </p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 root# mkdir -p /data/ids/tcpdump
 root# cd /data/ids/tcpdump
 /data/ids/tcpdump root# wget rm-rf.co.uk/downloads/Honeynet-RFP-iis.tgz
 /data/ids/tcpdump root# tar xzf Honeynet-RFP-iis.tgz
 /data/ids/tcpdump root# /usr/local/snort/bin/snort -c /usr/local/snort/etc/snort.conf \
-A fast -l /data/ids/tcpdump -r ./Honeynet-RFP-iis.pcap
 /data/ids/tcpdump root# ls /data/ids/tcpdump/alert /data/ids/tcpdump/snort.log.*
</pre>
</td>
</table>
<p>
</p>
<p>
Two results files should get created.  The file /data/ids/tcpdump/<strong>alert</strong> will contain the alerts and /data/ids/tcpdump/<strong>snort.log.&lt;date&gt;</strong>, which contains the pcaps of the detected events.</p>
<h4><strong>SnortSP</strong></h4>
<p>At this point we are ready to install SnortSP.  The first step is to make sure the system has the required software installed, which includes:
<ul>
<li><a href="http://libdnet.sf.net">Libdnet</a> 1.10 or higher</li>
<li>A recent <a href="http://www.tcpdump.org">Libpcap</a></li>
<li><a href="http://www.lua.org">Lua</a> 5.1.1 or better</li>
<li>Depending o the OS, a <a href="http://e2fsprogs.sf.net">UUID library</a></li>
</ul>
<p>The second step involves getting the software, verifying, configuring, and installing the security platform.  The engine will be built in the next section.</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 root# cd /usr/local/src
 /usr/local/src root# wget http://www.snort.org/dl/prerelease/3.0.0-b2/\
snortsp-3.0.0b2.tar.gz
 /usr/local/src root# wget http://www.snort.org/dl/prerelease/3.0.0-b2/\
snortsp-3.0.0b2.tar.gz.md5
 /usr/local/src root# wget http://www.snort.org/dl/prerelease/3.0.0-b2/\
snortsp-3.0.0b2.tar.gz.sig
 /usr/local/src root# cat snortsp-3.0.0b2.tar.gz.md5
4b2259c08ebe66cf63d91359996c93d9  snortsp-3.0.0b2.tar.gz
 /usr/local/src root# md5sum snortsp-3.0.0b2.tar.gz
4b2259c08ebe66cf63d91359996c93d9  snortsp-3.0.0b2.tar.gz
 /usr/local/src root# gpg --verify snortsp-3.0.0b2.tar.gz.sig snortsp-3.0.0b2.tar.gz
gpg: Signature made Fri 18 Jul 2008 11:09:25 AM EDT using DSA key ID B10683B0
 /usr/local/src root# gpg --keyserver pgpkeys.mit.edu --recv-key B10683B0
gpg: requesting key B10683B0 from hkp server pgpkeys.mit.edu
gpg: key B10683B0: "Snort Release Team (Snort Release Team signing key) <releases @snort.org>" not changed
gpg: Total number processed: 1
gpg:              unchanged: 1
 /usr/local/src root# gpg --verify snortsp-3.0.0b2.tar.gz.sig snortsp-3.0.0b2.tar.gz
gpg: Signature made Fri 18 Jul 2008 11:09:25 AM EDT using DSA key ID B10683B0
gpg: Good signature from "Snort Release Team (Snort Release Team signing key) </releases><releases @snort.org>"
gpg: Note: This key has expired!

Primary key fingerprint: 0A0A BD0C 8FAA BDDC E7A2  A8C3 E6FA 8BA1 B106 83B0
</releases></pre>
</td>
</table>
<p>
The next step is to configure, install, and test SnortSP installation.  We will be using the /usr/local/snort area as the installation directory.  Please adjust to your environment.</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 /usr/local/src root# tar xzf snortsp-3.0.0b2.tar.gz
 /usr/local/src root# cd  snortsp-3.0.0b2
 /usr/local/src/snortsp-3.0.0b2 root# ./configure --prefix=/usr/local/snort
 /usr/local/src/snortsp-3.0.0b2 root# make
 /usr/local/src/snortsp-3.0.0b2 root# make check
 /usr/local/src/snortsp-3.0.0b2 root# make install
 /usr/local/src/snortsp-3.0.0b2 root# mkdir -p /usr/local/snort/etc/SnortSP
 /usr/local/src/snortsp-3.0.0b2 root# cp etc/* /usr/local/snort/etc/SnortSP
 /usr/local/src/snortsp-3.0.0b2 root# /usr/local/snort/bin/snortsp -V
SnortSP Version 3.0.0b2
</pre>
</td>
</table>
<p></p>
<h4><strong>Snort 2.8.2 Detection Engine</strong></h4>
<p>The next step is to install the Snort 2.8.2 detection engine.  We will immediately shut it down with the <strong>ssp.shutdown()</strong> command.  Please see previous sections &#8220;Libpcap and Large Files Support&#8221; and &#8220;PCRE (pcre-7.8).&#8221;  I am going to include the configuration options for libpcap, pcre, and MySQL.  Please adjust the configuration if necessary in the same way snort-2.8.3.1 was modified.  </p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 /usr/local/src/snortsp-3.0.0b2 root# cd src/analysis/snort
 /usr/local/src/snortsp-3.0.0b2/src/analysis/snort root# ./configure --prefix=/usr/local/snort \
 --with-platform-libraries=/usr/local/snort/lib/snortsp \
 --with-platform-includes=/usr/local/snort/include \
 --with-libpcap-includes=/usr/localsnort/include \
 --with-libpcap-libraries=/usr/local/snort/lib \
 --with-libpcre-includes=/usr/local/pcre/include \
 --with-libpcre-libraries=/usr/local/pcre/lib \
 --with-mysql-includes=/usr/local/mysql/include\
 --with-mysql-libraries=/usr/local/mysql/lib
 /usr/local/src/snortsp-3.0.0b2/src/analysis/snort root# make
 /usr/local/src/snortsp-3.0.0b2/src/analysis/snort root# make check
 /usr/local/src/snortsp-3.0.0b2/src/analysis/snort root# make install
 /usr/local/src/snortsp-3.0.0b2 root# /usr/local/snort/bin/snortsp \
-L /usr/local/snort/etc/SnortSP/snort.lua
   ,,_     -*> SnortSP! < *-
  o"  )~   Version 3.0.0b2 (Build 9) [BETA]
   ''''    By Martin Roesch &#038; The Snort Team: http://www.snort.org/team.html
           (C) Copyright 2008 Sourcefire Inc.
> Control thread running - 3086609296 (9501)
> ssp.shutdown()
 /usr/local/src/snortsp-3.0.0b2 root#
</pre>
</td>
</table>
<p>
The command &#8220;<strong>snortsp -L /usr/local/snort/etc/SnortSP/snort.lua</strong>&#8221; is telling snortsp to use the file <strong>&#8220;snort.lua</strong>&#8220;.  Examine the file for definitions of functions.  Below are a few example functions calls that may be of interest:</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 root# /usr/local/snort/bin/snortsp -L /usr/local/snort/etc/SnortSP/snort.lua
snort> <strong>ssp.help()</strong>
[*] SnortSP Commands:
    help()
    set_log_level( [debug|info|notice|warn|error|critical] )
    shutdown()
  Available subsystems within SnortSP have their own help() methods:
    dsrc        - Data Source
    eng         - Dispatcher/Engine
    analyzer    - Analytics Modules
    output      - Output Modules
  For example: dsrc.help() will call the Data Source help function
snort> <strong>dsrc.help()</strong>
[*]  Data Source Config Structure
<config_table> = {name        = <source name>,
                  type        = <type name>,
                  intf        = <interface name>,
                  flags       = [1|2|8],
                  command     = <filter>,
                  snaplen     = <snaplen>,
                  maxflows    = <flow count>,
                  maxidle     = <max flow idle>,
                  flow_memcap = <memory limit>,
                  filename    = <file name>,
                  max_count   = <count>,
                  display     = <display mode>,
                  gtp_support = [enable]
                  defrag      = {
                                 policy = <>,
                                 max_trackers = <>,
                                 timeout = <>,
                                 memcap = <>
                                }
}

    name: User string used to refernce the instantiated data
          source object.  If no name is provided a UUID is
          generated.
    type: Name of the DAQ module to use.  The list of available
          DAQ modules can be obtained using the
          dsrc.list_daq_modules() command.
    intf: Name of the interface to use for traffic acquisition.
    flags: Bitwise OR of available mode flags for a given DAQ.
           Some modes may not be available on all DAQs.
           Generally you will want to use either mode 1, 2
           or 8.  Default is 0.  To enable inline mode use a
           value of 10.
           Available modes are:
                1 = FILE READ MODE
                2 = PROMISC MODE
                8 = INLINE MODE
    command: BPF filter or other filter command for DAQs that
             support them.  Default is no filtering.
    snaplen: Max bytes to capture per packet.  Default is 0.
    maxflows: Max number of flows to keep in the flow manager
              at one time.  If this number is exceeded the least
              recently used flow is purged.  Default is 8192.
    maxidle: Number of seconds a flow can be idle before being
             timed-out and removed from the flow table.  Default is
             60.
    flow_memcap: Max number of bytes to allow to be used by the
                 flow table.  Default is 16MB.
    filename: In file playback mode, specifies the name of the
              file to run through the SnortSP instance.
    max_count: Number of packets to process before stopping this
               thread.  Default is 0, which is unlimited.
    display: Name of the display mode for printing packets as they
             are processed.  Available modes are:
                none    = Don't print packets at runtime.
                basic   = Display basic packet info on one line.
                classic = Display packets using the classic tcpdump
                          format.
                plus    = Classic mode + MAC header printout.
                max     = Full printout of every packet header
                          field, one field per line.
             Default is none.
    gtp_support: Activate support for the GTP protocol.  Default is
                 disabled.
    defrag: Specifies the IP/IPv6 defragmentation paramters.
                policy: Reassmebly policy for overlapping fragments.
                    Avaliable modes are:
                        <bsd , bsd-right, linux, first, windows,

                         solaris, or last>
                    Default is bsd.
                max_trackers: The maximum number of unique packets
                              in the process of being reassembled at a
                              at any given time.  Default is 8192.
                timeout: The maximum time in seconds for a fragmented
                         packet to receive all fragments.  Default is 60.
                memcap: Maximum number of bytes to allow to be used for
                        fragment reassembly.  Default is 32MB.
[*] Data Source Commands
    new( <config_table> ) - Instantiate a new data source object
    delete( <source_name> ) - Delete a data source object
    list() - List all of the instantiated data source objects
    list_daq_modules() - List all of the available DAQ modules
    show( source_name ) - Show the config of the named
                          object
    help() - Print this message

  For example, the following commands will create a data source
  using the afpacket DAQ in inline mode bridging the eth2 and
  eth3 interfaces allowing 262144 flows to occupy 10 MBs of
  memory while timing out flows after 5 minutes of idle time:
      dsrc1 = {name="src",
               type="afpacket",
               intf="eth2:eth3",
               flags=10,
               snaplen=0,
               maxflows=262144,
               maxidle=300,
               flow_memcap=10000000}
      dsrc.new(dsrc1)

snort> <strong>dsrc.list()</strong>
[*] 0 data sources configured
snort> <strong>sniff("eth0")</strong>
Creating new data source
Flow manager created with 16384 flow capacity
Engine "e1" created
Linking engine "e1" to data source "src1"
Calling engine_start()

init_pcap: Initializing network interface eth0
[*] Data Source Config:
        Name: src1
        Type: pcap
        Interface: eth0
        Filename:
        Snaplen: 1514
        Flags: 0x00000002
        Display: None (0)
        Filter command:
        DAQ: 0x8078b00
        User Context: 0x9378170
        Max flows: 16384
        Max idle: 60
        Memcap: 10000000
[*] Flow Manager Config:
        Max flows: 16384
        Max idle: 60
        Memcap: 10000000
[*] DAQ config:
   Interface: eth0
   Snaplen: 1514
   Datalink: 1
   Count: 0
   Packet Count: 0
   Promisc flag: 1
   File flag: 0
   pcap ptr: 0x9396488
   analysis context ptr: 0xb71ce008
[*] Spawning engine thread!
snort> e1 thread running - 3072121744 (24685)

snort> <strong>dsrc.list()</strong>
[*] 1 data sources configured
Name: src1    DAQ: pcap    interface: eth0    Running
snort> dsrc.show("src1")
[*] Data Source Config:
        Name: src1
        Type: pcap
        Interface: eth0
        Filename:
        Snaplen: 1514
        Flags: 0x00000002
        Display: None (0)
        Filter command:
        DAQ: 0x8078b00
        User Context: 0x9378170
        Max flows: 16384
        Max idle: 60
        Memcap: 10000000
[*] Flow Manager Config:
        Max flows: 16384
        Max idle: 60
        Memcap: 10000000
[*] DAQ config:
   Interface: eth0
   Snaplen: 1514
   Datalink: 1
   Count: 0
   Packet Count: 117
   Promisc flag: 1
   File flag: 0
   pcap ptr: 0x9396488
   analysis context ptr: 0xb71ce008
snort> fsniff ("eth0", "port 21")
snort> dsrc.list()
[*] 2 data sources configured
Name: src2    DAQ: pcap    interface: eth0    Running
Name: src1    DAQ: pcap    interface: eth0    Running
snort> ssp.shutdown()
 root#
</source_name></config_table></bsd></display></count></file></memory></max></flow></snaplen></filter></interface></type></source></config_table></pre>
</td>
</table>
<p></p>
<h4><strong>Lua</strong></h4>
<p><a href="http://www.lua.org">Lua</a> is a lightweight scripting language embedded in SnortSP.  The Snort Detection Engine is configured via a conf file, but SnortSP is configured by a Lua file.  The Snort conf file location is specified in the Lua file.  In this section, we are going to be running the shell script <strong>sspiffy.sh</strong>.  The program comes with the SnortSP package and it will convert Snort 2.8.x files into a Lua scripts and a new configuration file for SnortSP.
</p>
<p>
Previously, we ran snort 2.8.3.1 against the Honeynet-RFP-iis.pcap data with the command:</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 root# cd /data/ids/tcpdump
 /data/ids/tcpdump root# /usr/local/snort/bin/snort -c /usr/local/snort/etc/snort.conf \
-A fast -l /data/ids/tcpdump -r ./Honeynet-RFP-iis.pcap
</pre>
</td>
</table>
<p>
We are going to create and use <strong>/data/ids/logs</strong> where result log files will be kept.  First, backup the snort configuration file and result files previously created with snort 2.3.8.1.</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 root# cd /usr/local/snort/etc
 /usr/local/snort/etc root# cp snort.conf snort.conf.orig
 /usr/local/snort/etc root# mkdir -p /data/ids/logs
 /usr/local/snort/etc root# mv /data/ids/tcpdump/alert /data/ids/logs/alert.orig
 /usr/local/snort/etc root# mv /data/ids/tcpdump/snort.log.* /data/ids/logs/
</pre>
</td>
</table>
<p>
We defined <strong>dynamicpreprocessor</strong> and <strong>dynamicengine</strong> in snort configuration file (/usr/local/snort/etc/snort.conf) file, so we do not need to specify their location via command line with <strong>&#8211;dynamic-preprocessor-lib-dir</strong> and and <strong>&#8211;dynamic-engine-lib</strong>.  We will use the /usr/local/snort/etc as our configuration directory.  The script sspiffy.sh will create a new snort.conf file.  To generate a Lua file to run SnortSP with snort, we would use sspiffy.sh as follows:</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 root# cd /usr/local/snort/etc
 /usr/local/snort/etc root#  /usr/local/src/snortsp-3.0.0b2/sspiffy.sh \
/usr/local/snort -c /usr/local/snort/etc/snort.conf.orig \
-r /data/ids/tcpdump/Honeynet-RFP-iis.pcap -l /data/ids/logs -A fast 

Checking command line arguments ...

snort.conf is a copy of /usr/local/snort/etc/snort.conf.orig.2 with the following changes:
#SSP - set in lua: dynamicpreprocessor directory /usr/local/snort/lib/snort_dynamicpreprocessor/
#SSP - set in lua: dynamicengine /usr/local/snort/lib/snort_dynamicengine/libsf_engine.so
#SSP - deleted: preprocessor frag3_global: max_frags 65536
#SSP - changed: preprocessor frag3_engine: policy first detect_anomalies

snort.lua is the script that configures and executes SSP.

To run SSP as configured:
/usr/local/snort/bin/snortsp -L snort.lua -P
<pid -file> -S <sock -file> 

 /usr/local/snort/etc root#  ls snort.lua snort.conf
 /usr/local/snort/etc root#  vi snort.lua snort.conf
</sock></pid></pre>
</td>
</table>
<p>
The two files that were created in your current directory are <strong>snort.lua</strong> and <strong>snort.conf</strong>.  Take a look at the files and modify them where appropriate.  Make sure the full path to snort.conf is specified in snort.lua (conf=&#8221;/usr/local/snort/etc/snort.conf&#8221;).  To run snortsp with the generated files, use the command:</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 /usr/local/snort/etc root#  /usr/local/snort/bin/snortsp -L /usr/local/snort/etc/snort.lua
</pre>
</td>
</table>
<p>
Now go to the /data/ids/logs area and compare the <strong>alert</strong> file just generated with the <strong>alert.orig</strong> file generated by snort 2.8.3.1.  The results do match.  The differences between the files comes down to SnortSP alert file not including log entries for http_inspect. </p>
<h3>Final Thoughts</h3>
<p>The new Snort architecture is a very exciting design change that will help future versions of Snort respond quickly to an every changing security battleground.  Besides the potential speed performance, along with the ability to take advantage of the multicore systems being developed, what I find particularly interesting is that the new architecture provides a framework where developers can build their applications.  There is real potential here for intriguing development and flexibility.  Different environments have different requirements and needs.  Soon organizations will have the ability to choose from different engines resulting in custom configurations that best address each organization&#8217;s risks.
</p>
<p>
Everyone is looking for a turn key solution.  People need to accept the fact that security is hard.  By the time you find a solution, the problem has changed.  With an ever changing attack vector, there are no turn key solutions that can do anything more than provide help.  This is an important concept, because once accepting this fact, it changes a person&#8217;s view on viable solutions.  That is what I like about the Snort 3 architecture.  It is designed to be capable of being adjusted rapidly, which is a really cool concept.  All security tools should be designed in such a manner.  Our adversaries adjust quickly.  We need to be able to also.  On the eve of Snort turning ten, it is good to see that the Sourcefire team has been building such a promising IDS that will serve us well far into the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.securitymonks.com/2008/10/20/snort-3-the-next-generation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>IDS/IPS: The Mark Twain of the Security World</title>
		<link>http://blog.securitymonks.com/2008/08/09/idsips-the-mark-twain-of-the-security-world/</link>
		<comments>http://blog.securitymonks.com/2008/08/09/idsips-the-mark-twain-of-the-security-world/#comments</comments>
		<pubDate>Sat, 09 Aug 2008 19:37:37 +0000</pubDate>
		<dc:creator>John Gerber</dc:creator>
				<category><![CDATA[Bro]]></category>
		<category><![CDATA[IDS]]></category>
		<category><![CDATA[Snort]]></category>

		<guid isPermaLink="false">http://blog.securitymonks.com/?p=293</guid>
		<description><![CDATA[Recently I was talking with a fellow security professional, and I was surprised when he said, &#8220;It has been my experience that intrusion detection and prevention system (IDS/IPS) use is declining.&#8221; Now I know back in 2003, Gartner analyst Richard Stiennon stated, &#8220;IDSs have failed to provide value relative to its costs and will be [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://phoenix.lpl.arizona.edu"><img src="/images/auth_32.jpg" align="left" HSPACE=5 VSPACE=5 /></a>Recently I was talking with a fellow security professional, and I was surprised when he said, &#8220;<em>It has been my experience that intrusion detection and prevention system (IDS/IPS) use is declining</em>.&#8221; Now I know back in 2003, Gartner analyst <a href="http://blogs.zdnet.com/threatchaos/">Richard Stiennon</a> stated, &#8220;<a href="http://www.gartner.com/5_about/press_releases/pr11june2003c.jsp"><em>IDSs have failed to provide value relative to its costs and will be obsolete by 2005</em></a>.&#8221;  Stiennon went on to say, &#8220;<em>Intrusion detection systems are a market failure, and vendors are now hyping intrusion prevention systems, which have also stalled</em>.&#8221; It is three years after Gartner predicted IDSs would be obsolete. Are they?</p>
<p>
Samuel Langhorne Clemens, better known as Mark Twain, once wrote, “<em>Rumors of my death have been greatly exaggerated!</em>”  It seems worldwide IDS/IPS <a href="http://security.tekrati.com/research/8615/">revenue grew 19% in 2006</a>.  In 2007, the IDS/IPS marked was a $932 million industry.  <a href="http://www.frost.com/">Frost &#038; Sullivan</a> expects the market to <a href="http://www.reuters.com/article/pressRelease/idUS222358+22-Jan-2008+MW20080122">grow to $2.1 billion in the next five years</a>, citing &#8220;<em>complex attacks, ongoing vulnerability discoveries, and the need for companies to comply with new legislation</em>&#8221; as major contributing drivers.  Of course these numbers are focused on the commercial side of IDS/IPS.
</p>
<p>
“<em>Computers are like Old Testament gods; lots of rules and no mercy</em>,&#8221; wrote <a href="http://en.wikipedia.org/wiki/Joseph_Campbell">Joseph Campbell</a>, an American mythology professor, writer, and lecturer.  I often think of this quote when it comes to the use of signature based solutions in security.  As I <a href="http://blog.securitymonks.com/2007/06/17/ids/">previously posted</a>, IDS/IPS technology is moving aware from being solely signature based, to a blend of signature based, anomaly detection, and activity based methodologies.  The <a href="http://www.racetozero.net/">Race to Zero</a> contest is being held right now  (August  8-10th) during <a href="https://www.defcon.org/">Defcon 16</a>.  It is a hacking competition where  known viruses will be tweaked in an attempt to foil signature-based blacklists of several major antivirus engine.  The point is to demonstrate how easy it is to get around signature based solutions.
</p>
<p>
<a href="http://www.cnetnetworks.com.au/zdnetau/bios.htm">Liam Tung</a>, over on ZDnet has written a very good article titled, &#8220;<a href="http://www.zdnet.com.au/news/security/soa/Signature-based-antivirus-is-dead-get-over-it/0,130061744,339288527,00.htm">Signature-based antivirus is dead: Get over it</a>&#8220;.  In the article, <a href="http://www.linkedin.com/in/simonclause">Simon Clausen</a>, founder &#038; CEO at <a href="http://www.pctools.com">PC Tools</a>, reports that the security industry has been looking beyond blacklists.  &#8220;<em>I would very much disagree that AV is dead. Really, traditional signature-based AV is going to be dead in a few years, but what every antivirus company is evolving towards, like us, is behavioural AV technology, so AV will be alive</em>.&#8221;
</p>
<p>
<a href="http://securitysauce.blogspot.com/">Martin Roesch</a>, CTO and Founder of <a href="http://www.sourcefire.com/">Sourcefire</a>, has posted concerning the upcoming <a href="http://securitysauce.blogspot.com/2007/11/snort-30-architecture-series-part-1.html">Snort 3 architecture</a> that has as a key component a <strong>contextually aware engine</strong>.  This will add to Snort the ability to understand what it is defending.  Snort 3 architecture is built around the concept of <strong>network context</strong>, which is essentially data about the environment and the composition of the hosts in the network as well as the local network composition.  The software framework is called <a href="http://securitysauce.blogspot.com/2008/08/snort-30-architecture-series-part-2.html">SnortSP (the Snort Security Platform)</a> and the <a href="http://www.snort.org/dl/snortsp">initial beta</a> has been released.  By leveraging network context, Roesch hopes to reduce/simplify/eliminate tuning as much as possible, be able to generate event priorities, and address network and transport layer evasion.
</p>
<p>
<a href="http://www.peterjudge.com/">Peter Judge</a>, in his ZDnet article &#8220;<a href="http://resources.zdnet.co.uk/articles/features/0,1000002000,39438394,00.htm">Sourcefire: Don&#8217;t Snort at open-source security</a>,&#8221; quotes Roesch talking on the future of the security market:<br />
<blockquote>Threat management has three phases.  Before the threat, the firewall and patch management should prevent threats; during the attack, the IPS should block them; and, afterwards, network-behaviour analysis [NBA] should reveal damage and remedy it.  These tend to be stove-piped technologies, where nobody talks to anyone.  There are not enough people. You have got to get people out of the equation. You have to automate.</p></blockquote>
<p>The US government, through the <a href="http://www.cyber.st.dhs.gov/">Department of Homeland Security</a>, has issued a Request for Information (RFI) which highlights the analytical skills that DHS is seeking from a staffing perspective.  Through this RFI, one can determine the technological focus DHS has for the administration&#8217;s requested $294 million fiscal cybersecurity budget.  The 2009 cybersecurity budget is a significant increase over the 2008 enacted budget of $210 million.  <a href="http://www.fcw.com/cgi-bin/udt/fdc.collector?client_id=fcw&#038;form_id=maileditform&#038;link_id=8&#038;title=DHS%20reveals%20some%20plans%20on%20cybersecurity%20effort&#038;author=Ben%20Bain&#038;address=http%3A//www.fcw.com/online/news/153366%2D1.html&#038;summary=The%20Homeland%20Security%20Department%20recently%20provided%20more%20information%20about%20its%20role%20in%20the%20Bush%20administration%27s%20highly%20classified%20governmentwide%20cybersecurity%20initiative.">Ben Bain</a>, in his article &#8220;<a href="http://www.fcw.com/online/news/153190-1.html">DHS seeks cybersecurity capability info</a>&#8221; quotes <a href="http://www.sans.org/press/">Alan Paller</a>, research director at the SANS Institute, as saying that most DHS department employees don’t know how to do complex intrusion detections, log analysis or reverse engineering malware.  DHS is looking for folks with experience with EINSTEIN data analysis, tools, techniques and network flow analysis capabilities, the TIC deployment environment, and compliance metrics.  Ben Bain <a href="http://www.fcw.com/online/news/153366-1.html">reports</a> on the highly classified <a href="http://news.cnet.com/8301-13578_3-10004266-38.htm">Comprehensive National Cybersecurity Initiative (CNCI)</a> that DHS is &#8220;<em>planning on implementing a new version of the intrusion detection and alert system — <a href="http://www.dhs.gov/xlibrary/assets/privacy/privacy_pia_einstein2.pdf">EINSTEIN 2</a> — designed monitor agencies’ Internet access points for malicious activity and capture intrusion data along with data transmitted in proximity to an alert</em>.&#8221;  It sounds like the government believes there is still life in some form of intrusion detection technology.
</p>
<p>
While I have mentioned Snort, it is not the only IDS/IPS.  Keeping to the world of open source, most of my IDS/IPS time is split between Snort and <a href="http://www.bro-ids.org/">Bro</a>.  I am very interested in Roesch&#8217;s work on the contextually aware engine.  It will make Snort a more powerful tool.  Now Bro has advance features giving it the ability to discern network anomalies that are caused by hostile activity.  Bro also has some ability to detect violations of expected traffic rules to defend against previously-unknown attack techniques.  For additional information on Bro, there are three blogs particularly helpful.  Seth Hall of The Ohio State University has started the &#8220;<a href="http://a-bro-blog.blogspot.com/">A Bro Blog</a>.&#8221;   The <a href="http://blog.icir.org/">ICSI Networking Group has a blog</a> with contributions from the big names in Bro: <a href="http://www.icir.org/mallman">Mark Allman</a>, <a href="http://www.icir.org/floyd">Sally Floyd</a>, <a href="http://www.icir.org/christian">Christian Kreibich</a>, <a href="http://www.icir.org/vern">Vern Paxson</a>, <a href="http://www.icir.org/robin">Robin Sommer</a>, and <a href="http://www.icsi.berkeley.edu/~nweaver/">Nicholas Weaver</a>.  C.S.Lee (geek00L) on his site &#8220;<a href="http://geek00l.blogspot.com/">When {Puffy} Meets ^RedDevil^</a>&#8221; will frequently do postings involving Bro.
</p>
<p>
I started this post asking if Gartner was correct and are IDS/IPS a dying technology?  By looking at both the IDS/IPS market and the government&#8217;s cyber security focus, we see the technology is very much alive.  Not so much much because Gartner was wrong about IDS/IPS producing false positives and negatives, that monitoring puts a burden on the organization, that incident response can be a taxing process, nor that being able to monitor an increasingly higher bandwidth is challenging.  Those problems still exist.  Because of that, there is much work being done to help the IDS/IPS industry handle data more flexibly, efficiently, or accurately.  Gartner was wrong with the assumption that the technology would remain stagnant and if something is difficult, it will not be implemented.  IDS/IPS exist because organizations need the detection and prevention capabilities.  Companies face an ever increasing reliance on information technology for competitive advantage while dealing with increasingly complex attacks, ongoing vulnerability discoveries, and the need for companies to comply with new legislation.  IDS/IPS solutions continue to be part of organizations&#8217; security programs because the technology continues to evolve while integrating new solutions.  In the world of evolution, adaptability will trump better design if the better design is incomplete and inflexible in an ever changing environment.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.securitymonks.com/2008/08/09/idsips-the-mark-twain-of-the-security-world/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Bro on FreeBSD 7: Should You Care?</title>
		<link>http://blog.securitymonks.com/2008/02/05/bro-on-freebsd-7-should-you-care/</link>
		<comments>http://blog.securitymonks.com/2008/02/05/bro-on-freebsd-7-should-you-care/#comments</comments>
		<pubDate>Wed, 06 Feb 2008 03:45:33 +0000</pubDate>
		<dc:creator>John Gerber</dc:creator>
				<category><![CDATA[Bro]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Snort]]></category>

		<guid isPermaLink="false">http://blog.securitymonks.com/2008/02/05/bro-on-freebsd-7-should-you-care/</guid>
		<description><![CDATA[“Don&#8217;t lower your expectations to meet your performance. Raise your level of performance to meet your expectations. Expect the best of yourself, and then do what is necessary to make it a reality.” &#8212; Ralph Marston

While one should not rush to be an early adapter,  it is good to keep in mind what is [...]]]></description>
			<content:encoded><![CDATA[<p>“<em>Don&#8217;t lower your expectations to meet your performance. Raise your level of performance to meet your expectations. Expect the best of yourself, and then do what is necessary to make it a reality</em>.” &#8212; <strong><a href="http://greatday.com/ralph/personal.html">Ralph Marston</a></strong></p>
<p>
<a href="http://www.bro-ids.org"><img src="http://www.bro-ids.org/images/bro.png" alt="Change" width=50 align="left" /></a>While one should not rush to be an early adapter,  it is good to keep in mind what is coming down the pike.  If you are doing work with an network intrusion detection system, such as <a href="http://www.bro-ids.org/">Bro</a>, FreeBSD 7 looks to have some key performance improvements that makes it a solid choice.  The post titled, &#8220;<a href="http://pinderkent.blogsavy.com/archives/149">FreeBSD 7 will be revolutionary</a>&#8221; made this observation:<br />
<blockquote>Also of importance are the improvements to the networking stack. With gigabit (or faster) network cards being the norm these days, FreeBSD&#8217;s support for TCP/IP Segmentation Offload (TSO) and Large Receive Offload (LRO) will no doubt prove to be very useful. Along with the new sendfile() implementation, and the improved sosend() functionality, we will likely see some large networking performance boosts.</p></blockquote>
<p>The latest developments in FreeBSD can be found at the &#8220;<a href="http://ivoras.sharanet.org/freebsd/freebsd7.html">What&#8217;s cooking for FreeBSD 7</a>?&#8221; page.  Several performance improvements are outlined by <a href="http://kerneltrap.org/blogs">Kris Kennaway</a> of the FreeBSD Project in his presentation titled, &#8220;<a href=""http://people.freebsd.org/~kris/scaling/7.0%20Preview.pdf >Introducing FreeBSD 7.0</a>.&#8217;  The presentation compares performance increases shown by PostgreSQL and MySQL.  These database packages utilize some complex operations that demonstrate the improvements under FreeBSD 7.
</p>
<p>
How does that help Bro?  That requires some examination and explanation.  From the &#8220;Hardware and Software Requirements&#8221; section of the <a href="http://www.bro-ids.org/wiki/index.php/User_Manual:_Requirements">Bro Wiki</a>, it states:<br />
<blockquote>Operating System Recommended: FreeBSD.  Bro works with many Unix systems, including Linux and Solaris, but has been primarily tuned for FreeBSD. We currently recommend using FreeBSD version 4.10 for Bro. If your site has a large number of packets or connections per second you shouldlook at the section on Hardware and OS Tuning. FreeBSD 5.x should work, but is not quite as fast as 4.10.</p></blockquote>
<p>Before you start looking for version of FreeBSD 4.10 on ebay, there have been significant improvements made in later versions of FreeBSD.  Note that there is no date associated with this Wiki entry.  The lack of mention of FreeBSD 6.x indicates the entry was made prior to 6.x being released.  This appears to be an outdated post.  To provide a better sense of performance between the various FreeBSD versions, <a href="http://buechler.blogspot.com/">Chris Buechler</a> wrote the blog entry titled “<a href="http://security.gloriad.org/blog/wp-admin/%20Network%20performance%20update">Network Performance Update</a>.” Chris describe, in relation to the pfSense firewall/server platform:<br />
<blockquote>m0n0wall 1.2 still makes us look silly (1.5 times as fast), but that’s to be expected with its FreeBSD 4.x base. FreeBSD 6.2 has closed that gap considerably from the disaster that was FreeBSD 5.x, and FreeBSD 7 looks to draw nearer to 4.x performance. Note that I’m strictly talking about <strong>single processor</strong> machines, SMP systems are a much different story, but I won’t comment on those until I get a chance to do some testing.</p></blockquote>
<p>Holding the comparisons to a single processor machine is an important point.  There have been discussions on the Bro mailing list concerning whether multiple processors are helpful.  How FreeBSD performs with multiple processors depend on what version is being used.  We will examine that a little later.  <a href="http://www.icir.org/robin/">Robin Sommer</a>, one of the <a href="http://mailman.icsi.berkeley.edu/pipermail/bro/2007-February/002884.html">Bro developers stated</a>, &#8220;All of the main analysis is done in a single process and not able to make use of multiple CPUs.&#8221;  It was reported that top-of-the-line dual Xeon CPUs (>$4,000 of CPU) performed ~5% better than a single PentiumD at under $500.
</p>
<p>
What version and hardware setup are the Bro developers using and what recommendation would they make on tuning the operating system?  The article titled, &#8220;<a href="http://www.icir.org/robin/papers/ccs04.pdf">Operational Experiences with High Volume Network Intrusion Detection</a>&#8221; by Holger Dreger, Anja Feldmann, Vern Paxson, and Robin Sommer stated that the system they were using for high volume network intrusion detection was &#8220;the primary NIDS monitor is a Dual Athlon MP 1800+ with 2 GB Memory, currently running FreeBSD 5.2.1. It is connected via a Gigabit Ethernet.&#8221;  They tested it against, &#8220;The others are separate Athlon XP 2600+ based systems with 1 GB of RAM running Linux 2.4.&#8221;  Their goal was to compare tuning parameters.  In Robbin&#8217;s <a href="http://www.icir.org/robin/papers/thesis.pdf ">thesis</a>, he states in order to get the performance they desired they, &#8220;<em>patched the kernel to increase the NIC driver’s internal receive buﬀers. Moreover, we patched the packet-capture sub-system to increase its buﬀers by three orders of magnitude</em>.&#8221;
</p>
<p>
<a href="http://www.nabble.com/user/UserProfile.jtp?user=128141">Kris Kennaway</a> did a very interesting presentation comparing FreeBSD 4.x, 5.x, and 6.x titled “<a href="http://www.bsdcan.org/2006/papers/FilesystemPerformance.pdf">Filesystem Performance on FreeBSD</a>.”  Kris tested on a 4 CPU AMD64 system, so he could only test 5.4 vs 6.0 (the latest release at that time).  The results will depend on what is being tested.  For full details, please view the presentation.  An interesting result was that FreeBSD 6.0 performed 30% faster than 4.11 for concurrent writes.  6.0 was 15% faster than 5.4 for concurrent reads.  Kris has also done some performance test involving BIND and found FreeBSD 7 had a <a href="http://www.nabble.com/BIND-9.4.1-performance-on-FreeBSD-6.2-vs.-7.0-t3920483.html">60% higher peak performance</a> over version 6.1.  The point is, it would appear that later version of FreeBSD made significant performance improvements over FreeBSD 5.2.1 (the version used by the Bro development team in their paper).  FreeBSD 5.x and FreeBSD 6.x where to some degree transitional operating systems moving 4.x to 7.x.
</p>
<p>
To help make all these performance reports make sense, let&#8217;s begin with an overview/history of the versions pulling liberally from Kris&#8217;s presentation, &#8220;<a href="http://people.freebsd.org/~kris/scaling/7.0%20Preview.pdf">Introducing FreeBSD 7.0 </a>&#8220;:</p>
<blockquote><p>FreeBSD 4.x is a single-threaded kernel with limited multiprocessor support.</p>
<ul>
<li>Able to run user code on multiple processors</li>
<li>Only one process at a time can execute in the kernel (&#8220;Giant lock&#8221; around entire kernel)</li>
<li>Device interrupts may be processed in parallel, subject to some constraints</li>
</ul>
<p>The historical BSD kernel architecture worked very well for single-processor systems. It fundamentally does not scale to multi-processor systems, which are now becoming universal.</p></blockquote>
<p>In the Bro discussion list, performance is often discussed.  The FreeBSD group started working on multiprocessor support with the <a href="http://www.freebsd.org/smp/">SMPng project</a>.  Bascially, we see the development in FreeBSD 5.x and 6.x:</p>
<blockquote><p>FreeBSD 5.0-5.2.1 (2003-01-17 &#8211; 2004-02-22)</p>
<p>        Debut of the new architectural model for symmetric multiprocessor support in FreeBSD.</p>
<p>FreeBSD 5.3 (2004-11-06), 5.4 (2005-05-09)</p>
<ul>
<li>The fundamental architectural changes were largely in place</li>
<li>Some initial progress with kernel parallelism by 5.3 and 5.4 (network stack, virtual memory, &#8230;)&#8221;</li>
</ul>
</blockquote>
<p>SMPng was improved in 6.x:</p>
<blockquote><p>
FreeBSD 6.0 (2005-11-01), 6.1 (2006-05-08), 6.2 (2007-01-15)</p>
<ul>
<li>Stabilized the work of the 5.x branch</li>
<li>Performance benefits from subsequent development work<br />
          e.g. Virtual File System (VFS) and Unix File System (UFS) now allow parallel access</li>
<li>Large parts of the kernel may now operate in parallel, with significant performance gains on many common workloads</li>
</ul>
</blockquote>
<p>With FreeBSD 7.x, the kernel will be a fully parallel system.  The &#8220;Giant lock&#8221; is no longer present on almost all possible workloads.  Major shift of focus from correctness to optimization.  The above mentioned document will demonstrate impressive results.  The document lists the following improvements:</p>
<blockquote><p>
<strong>New filesystems</strong></p>
<ul>
<li>ZFS</li>
<li>Sun&#8217;s amazing new filesystem moves the goalposts. Stay tuned for more in the presentation from Pawel.</li>
<li>unionfs: overlay multiple filesystem hierarchies into one. Broken for many years but now usable again.</li>
<li>XFS support (read-only)</li>
<li>CODA distributed filesystem support fixed</li>
<li>UFS quotas are now parallelized</li>
<li>NFS client and server parallelized</li>
<li>Performance improvements for NFS client</li>
<li>SCSI layer (CAM) is now parallelized, including many drivers.  Performance benefits for SCSI device access.</li>
<li>iSCSI initiator (in base system) and target (in ports), allowing remote exporting and local mounting of SCSI devices over TCP/IP</li>
</ul>
<p><strong>New GEOM (pluggable storage layer) modules</strong></p>
<ul>
<li>gjournal; block level journalling provider (can be used with UFS for journalling support)</li>
<li>gvirstor; virtualized storage provider (create a huge disk image sparsely populated with disks, add more later)</li>
<li>gcache; read cache for storage layers with small request sizes</li>
<li>gmultipath; support for multiple paths to the same storage provider (fiber channel, etc)</li>
<li>gpart; virtualized partitioning support (GPT, APM, &#8230;)</li>
</ul>
<p><strong>Network Stack Changes</strong></p>
<ul>
<li>Complete elimination of giant lock from network stack</li>
<li>On-going cleanup and development work</li>
<li>Socket buffer automatic sizing; dynamically responds to network conditions for improved throughput</li>
<li>SCTP (Stream Control Transmission Protocol)</li>
<li>Migration from KAME IPSec to Fast IPSec
<ul>
<li>Improved performance</li>
<li>Hardware acceleration with cryptographic accelerators</li>
<li>Both IPv4 and IPv6</li>
</ul>
</li>
<li>Direct dispatch of inbound network traffic
<ul>
<li>Avoids context switching, improves CPU cache locality, allows concurrency</li>
<li>Significant performance benefits on many workloads</li>
</ul>
</li>
<li>Optional in-kernel Just-In-Time compiler for Berkeley Packet Filter (BPF) programs (tcpdump, etc)</li>
<li>In-kernel Network Address Translation (NAT) modules for natd(8)</li>
<li>Link aggregation (create virtual interfaces for fault tolerance and higher capacity)</li>
<li>Rapid spanning tree protocol support</li>
</ul>
<p><strong>Network Drivers</strong></p>
<ul>
<li>Support for commonly encountered 10 gigabit ethernet drivers: Chelsio (cxgb), Intel (ixgbe), Myricom (mxge), Neterion (nxge)</li>
<li>Transmit Segmentation Off-load (TSO)/Large Receive Off-load (LRO); off-load send/receive into the ethernet driver</li>
<li>New devices supported</li>
</ul>
<p><strong>Wireless<br />
</strong>
<ul>
<li>Wireless 802.11 layer is stable
<ul>
<li>high power ath cards (Senao, Ubiquiti, Wistron)</li>
<li>900MHz ath cards (Ubiquiti, Zcomax)</li>
<li>ath (Atheros), iwi, ral (Ralink), ural (RT2500USB) drivers are high quality</li>
</ul>
</li>
<li>New drivers
<ul>
<li>rum (Ralink RT2500USB, RT2601USB)</li>
<li>Intel wireless drivers: ipw (Intel PRO/Wireless 2100), iwi (2200BG/2225BG/2915ABG) works out of the box</li>
<li>ZyDAS ZD1211/ZD1211B</li>
</ul>
<ul></ul>
</li>
<li>WPA (Wifi Protected Access) support stable</li>
<li>New scanning support (background scanning, roaming)</li>
<li>Atheros protocol extensions 802.11n support (forthcoming standard)
<ul>
<li>higher performance: up to 135 Mb/sec, channel bonding, improved range, etc</li>
<li>drivers not yet committed</li>
</ul>
</li>
<li>Preparation for future changes (virtual access points, etc)</li>
</ul>
<p><strong>New CPU Architectures</strong></p>
<ul>
<li>Improved support for ARM architecture
<ul>
<li>Improved AT91RM9200 (Atmel) support</li>
<li>support for Avila Gateworks Xscale boards was added, including a rewrite of the Intel code</li>
<li>permission from Intel to bundle u-code</li>
<li>Boot loader can load from Secure Digital (SD) flash cards</li>
<li>FreeBSD/ARM used as the basis for growing number of embedded devices</li>
<li></li>
</ul>
</li>
<li>Sun Ultrasparc T1 (preliminary)
<ul>
<li>8 cores, 4 threads per core = 32 logical CPUs per package</li>
<li>A very interesting new CPU architecture, and one to watch in the future</li>
<li>T2: 8 threads * 8 cores = 64 logical CPUs per package!</li>
</ul>
</li>
<li>X-box!</li>
</ul>
<p><strong>Security Subsystems: Audit subsystem</strong></p>
<ul>
<li>Fine-grained, configurable logging of security-relevant events: System calls, application and user space activities</li>
<li>Now available by default in GENERIC kernel</li>
<li>Originally developed for Mac OS X, ported and enhanced. A nice example of code-sharing in the Apple ! FreeBSD direction</li>
<li>Builds on the other advanced security features developed by the TrustedBSD project for FreeBSD priv(9) API</li>
<li>common interface for kernel privilege checking</li>
<li>Privilege model can be modified by Mandatory Access Control (MAC) modules</li>
</ul>
<p><strong>User-level Changes</strong></p>
<ul>
<li>Many updates to system applications and utilities</li>
<li>cached: caches queries to nsswitch (\name service switch&#8221;: user/group/host lookups) for improved performance</li>
<li>Ports collection
<ul>
<li>Currently contains 17692 ported third-party applications (1774 more than 6.2)</li>
<li>Major changes since 6.2:
<ul>
<li>X.org 7.3 (many improvements, e.g. working composite support for improved visual effects)</li>
<li>KDE 3.5.7</li>
<li>GNOME 2.18.3</li>
<li>More than 24000 other changes and updates</li>
</ul>
</li>
</ul>
</li>
</ul>
<p><strong>Performance</strong></p>
<ul>
<li>Performance optimizations throughout the system</li>
<li>The ULE scheduler is now recommended instead of the historical 4BSD scheduler
<ul>
<li>Better interactive performance on desktop systems</li>
<li>Significantly better performance on SMP systems</li>
<li>4BSD will remain the default scheduler in 7.0 to be conservative, but likely to switch for 7.1</li>
</ul>
</li>
<li>If you find a workload that FreeBSD 7.0 performs poorly on, we want to hear about it!</li>
</ul>
<p><strong>Other Kernel Changes</strong></p>
<ul>
<li>Partial linux 2.6.16 emulation support (not enabled by<br />
        default)</li>
<li>Support for Message Signaled Interrupts (MSI) and Extended Message Signaled Interrupts (MSI-X)</li>
<li>IPMI (Intelligent Platform Management Interface); monitoring system hardware.</li>
<li>Improved support for legacy-free hardware (e.g. MacBook pro)</li>
<li>FireWire support for the boot loader</li>
<li>Asynchronous I/O (AIO) support is parallelized: used by e.g. qemu</li>
<li>New pseudo-tty system, allocates on demand without built in limits, and without requiring root privilege</li>
</ul>
<p><strong>Development Tools Internal</strong></p>
<ul>
<li>GCC 4.2.1</li>
<li>Improvements to hwpmc (CPU performance counters)</li>
<li>symbol versioning added to several libraries</li>
<li>New scalable malloc(3) (jemalloc)</li>
<li>Optimized kernel locking primitives (sx, rwlocks)</li>
<li>POSIX message queues</li>
<li>contigmalloc(9) with buddy allocator</li>
<li>kernel malloc(9) red zone debugging support</li>
<li>Improved kernel lock profiling infrastructure</li>
<li>mini-dumps</li>
</ul>
</blockquote>
<p>It looks like FreeBSD has some nice changes that should be released shorty.  The changes will position FreeBSD well to deal with the high network demand that a Bro box may encounter.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.securitymonks.com/2008/02/05/bro-on-freebsd-7-should-you-care/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IDS</title>
		<link>http://blog.securitymonks.com/2007/06/17/ids/</link>
		<comments>http://blog.securitymonks.com/2007/06/17/ids/#comments</comments>
		<pubDate>Mon, 18 Jun 2007 03:26:50 +0000</pubDate>
		<dc:creator>John Gerber</dc:creator>
				<category><![CDATA[Bro]]></category>
		<category><![CDATA[IDS]]></category>
		<category><![CDATA[Law]]></category>
		<category><![CDATA[SANS]]></category>
		<category><![CDATA[Snort]]></category>

		<guid isPermaLink="false">http://blog.securitymonks.com/?p=38</guid>
		<description><![CDATA[&#8220;Computers are like Old Testament gods; lots of rules and no mercy.&#8221;
&#8211; Joseph Campbell

Last week I spent Monday driving through a few states.  It was an eight hour drive.  When possible, I prefer driving over flying.  While it may take longer, I use the time to listen to podcasts.  Since I [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;<a href="http://en.thinkexist.com/quotation/computers_are_like_old_testament_gods-lots_of/152696.html"><em>Computers are like Old Testament gods; lots of rules and no mercy.</em></a>&#8221;<br />
&#8211; <strong><a href="http://en.wikipedia.org/wiki/Joseph_Campbell">Joseph Campbell</a></strong></p>
<p>
<a href="http://www.banksy.co.uk/indoors/02.html"><img src="/images/ids.jpg" alt="IDS" width=200 align="left"/></a>Last week I spent Monday driving through a few states.  It was an eight hour drive.  When possible, I prefer driving over flying.  While it may take longer, I use the time to listen to podcasts.  Since I had taken the <a href="http://www.sans.org/training/description.php?mid=98&#038;portal=d9278027b4d697dd3c444d97c8124682">SANS System Forensics, Investigation &#038; Response course (SEC 508)</a>, I had access to their lectures in MP3 format.  The lecture on <a href="http://www.sans.org/training/description.php?cid=3497&#038;portal=3b282e0dc9be9aa724654f2ac03b9431">Computer Investigative Law for Forensic Analysts</a> was prepared and taught by <a href="http://www.sans.org/tysonscorner07/faculty.php">Richard P. Salgado</a>.   I had taken the course at a <a href="http://www.sans.org/community_sans/?portal=4e7bdb1ee7e5c07f88b14f1e7fb36d80">Community SANS</a> event, close to where my brother lives.  Yes, I was trying to keep my expenses down, and my brother and his family were kind enough to put me up for the week.  While the course was well taught, knowledge of the legal issues of forensics was not the instructors strong point.  This was reflected by the fact that the students hated that day.  If only they had Richard P. Salgado.  He did an amazing job.
</p>
<p>
Why am I mentioning this on a blog posting on <a href="http://en.wikipedia.org/wiki/Intrusion_Detection_System">intrusion detection systems (IDS)</a>?  The law has an ever increasing role in IT.  This is especially true in the area of forensics, incident response, and intrusion detection/prevention.  Before you setup any IDS system, make sure you are authorized and legally clear to do so.
</p>
<p>
With that disclaimer out of the way, I spent the weekend beginning to develop a network monitoring system.  Sure, for years I have worked with <a href="http://www.snort.org/">Snort</a>, but I am doing something different.  For those unfamiliar with Snort, to quote their site:</p>
<blockquote><p>
Snort® is an open source network intrusion prevention and detection system utilizing a rule-driven language, which combines the benefits of signature, protocol and anomaly based inspection methods. With millions of downloads to date, Snort is the most widely deployed intrusion detection and prevention technology worldwide and has become the de facto standard for the industry.
</p></blockquote>
<p>It is a great product.  Along with Snort, I have used the <a href="http://sourceforge.net/projects/secureideas">Basic Analysis and Security Engine (BASE)</a>, which is based on the Analysis Console for Intrusion Databases (ACID) project.  BASE provides a web front-end to query and analyze the alerts coming from a SNORT IDS system.   If you are pulling down software, I also suggest checking out <a href="http://sguil.sourceforge.net/index.html">Sguil</a>.
</p>
<p>
Richard Bejtlich recently posted on his blog, <a href="http://taosecurity.blogspot.com">TaoSecurity</a>, an entry titled &#8220;<a href="http://taosecurity.blogspot.com/2007/06/dhs-einstein-demonstrates-value-o">DHS Einstein Demonstrates Value of Session Data</a>.&#8221;  Richard makes the statement, in relation to collecting session data:</p>
<blockquote><p>This is just the sort of project I&#8217;d like to roll out at my new job, possibly combining <a href="http://www.qosient.com/argus/">Argus</a> with <a href="http://www.datenspionage.de/arguseye/">ArgusEye</a>, or maybe just Sguil without Snort. </p></blockquote>
<p>
An intriguing project.  This weekend was about setting up an IDS system using <a href="http://www.bro-ids.org/">Bro</a>.  To understand the importance of Bro, you need to first review the different styles of intrusion detection.
<ul>
<li><strong>Signature Based</strong> &#8211; looks for specific, known attacks.
<ul>
<li>Pros: good attack libraries, easy to understand results.</li>
<li>Cons: unable to detect new attacks or even just variants.</li>
</ul>
</li>
<li><strong>Anomaly Detection</strong> &#8211; build/infer a profile of &#8220;normal use&#8221; and flag deviations.
<ul>
<li>Pros: potentially detects wide rand of attacks, including previously unknown types of attacks.</li>
<li>Cons: can be &#8220;trained&#8221; to accept attacks as normal, and potentially misses a wide rand of attacks including known attacks.</li>
</ul>
</li>
<li><strong>Activity Based</strong> &#8211; inspect traffic and construct &#8220;events,&#8221; look for patterns of activity that deviate from a site policy.
<ul>
<li>Pros: potentially detects wide range of attacks (including novel), framework can accommodate signatures and anomalies.</li>
<li>  Cons: policies/specification require significant development and maintenance and harder to construct attack libraries</li>
</ul>
</li>
</ul>
<p>Snort is a signature based IDS.  Bro is an activity based IDS, though it does include a signature engine for matching specific patterns in packet streams.  Bro is compatible with Snort. somewhat.  With Bro analysis, signature matches generate events which are amenable to high level policy script processing rather than direct alerts.  Other difference include that Snort is user friendly and Bro is a beast to learn.   Worse still, there are no good guides for Bro.  Sure, you can subscribe to the <a href="http://mailman.icsi.berkeley.edu/mailman/listinfo/bro">mailing list</a> and there is a <a href="http://bro-ids.org/wiki/index.php/Main_Page">Bro Wiki</a>.  <a href="http://geek00l.blogspot.com/">Geek00l</a> has done some very good postings:</p>
<ul>
<li><a href="http://geek00l.blogspot.com/2006/12/regex-magic-for-netsexcanalyst.html">Regex &#8211; Magic for NetSe[x|c]Anal(yst)?</a></li>
<li><a href="http://geek00l.blogspot.com/2006/12/bro-ids-enable-full-content-data.html">Bro-IDS: Enable Full Content Data Logging</a></li>
<li><a href="http://geek00l.blogspot.com/search?q=bro&#038;x=0&#038;y=0">Time Machine &#8211; Payload Centric</a></li>
<li><a href="http://geek00l.blogspot.com/2006/10/bro-ids-v12.html">Bro-IDS v1.2</a></li>
<li><a href="http://geek00l.blogspot.com/2006/06/bro-ids-signature-matching.html">Bro-IDS &#8211; Signature Matching</a></li>
<li><a href="http://geek00l.blogspot.com/2006/06/freebsd-ids-sensor-tweaking.html">FreeBSD &#8211; IDS Sensor Tweaking</a></li>
<li><a href="http://geek00l.blogspot.com/2006/06/bro-ids-learning-process.html">Bro-IDS &#8211; The learning process</a></li>
<li><a href="http://geek00l.blogspot.com/2006/06/multipurposes-post_06.html">Multipurposes post :]</a></li>
<li><a href="http://geek00l.blogspot.com/2006/05/bro-ids-be-loved.html">Bro-IDS &#8211; Be Loved</a></li>
<li><a href="http://geek00l.blogspot.com/2006/01/bro-ids-installation-experience.html">Bro-IDS &#8211; Installation Experience</a></li>
</ul>
<p>Geek00l convinced Richard Bejtlich take a second look at Bro, and Richard posted:</p>
<ul>
<li><a href="http://taosecurity.blogspot.com/2007/04/bro-basics-follow-up.html">Bro Basics Follow-Up</a></li>
<li><a href="http://taosecurity.blogspot.com/2007/04/bro-basics.html">Bro Basics</a></li>
</ul>
<p>That will get you started.
</p>
<p>
My interest in Bro comes from the fact that a design goal of Bro was to handle high speed, large volume monitoring.  Snort, on a security appliance, can handle such traffic.  Force10 released such a box, <a href="http://www.networkworld.com/news/2006/041706-force10-ips.html">the P10</a>, which can handle up to 1000 signatures.  I have worked with the open source version of Snort on high volume networks, and it has not been pleasant.  While the P10 might work well, I am interested in different capabilities.
</p>
<p>
Bro offers an interesting solution to handling monitoring on 10G traffic.  If you are working with <a href="http://www.net.t-labs.tu-berlin.de/research/bpcs/">FreeBSD</a>, there are ways to tune the kernel.  While I have previously run into problems with Bro, my past problems were more likely due to trying to work under the Apple environment.  Supported 10G Ethernet cards drivers had not yet been developed.  Fortunately, that appears to have changed.  I&#8217;ll post more as I make progress.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.securitymonks.com/2007/06/17/ids/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

