<?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>Random thoughts of an overloaded mind &#187; capture</title>
	<atom:link href="http://blog.amarkulo.com/tag/capture/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.amarkulo.com</link>
	<description>Yet another technical blog about iOS, Windows, Linux, Arduino and everything else</description>
	<lastBuildDate>Tue, 13 Dec 2011 16:56:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>How to install Snort Intrusion Detection System on Windows</title>
		<link>http://blog.amarkulo.com/how-to-install-snort-ids-on-windows</link>
		<comments>http://blog.amarkulo.com/how-to-install-snort-ids-on-windows#comments</comments>
		<pubDate>Tue, 22 Dec 2009 15:05:20 +0000</pubDate>
		<dc:creator>amar</dc:creator>
				<category><![CDATA[Tips and tricks]]></category>
		<category><![CDATA[capture]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[freeware]]></category>
		<category><![CDATA[ids]]></category>
		<category><![CDATA[packet]]></category>
		<category><![CDATA[pcap]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[sniff]]></category>
		<category><![CDATA[sniffer]]></category>
		<category><![CDATA[snort]]></category>
		<category><![CDATA[win]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[winpcap]]></category>

		<guid isPermaLink="false">http://blog.amarkulo.com/?p=267</guid>
		<description><![CDATA[First short explanation what is Snort from Snort official website: Snort® is an open source network intrusion prevention and detection system (IDS/IPS) developed by Sourcefire. Combining the benefits of signature, protocol and anomaly-based inspection, Snort is the most widely deployed &#8230; <a href="http://blog.amarkulo.com/how-to-install-snort-ids-on-windows">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>First short explanation what is Snort from Snort official website:</p>
<blockquote><p><em>Snort® is an open source network intrusion prevention and detection system (IDS/IPS) developed by Sourcefire. Combining the benefits of signature, protocol and anomaly-based inspection, Snort is the most widely deployed IDS/IPS technology worldwide.</em></p></blockquote>
<p>Installation of Snort on Windows is pretty simple.</p>
<p>First, you need to download and install few things. For Snort to be able to act as sniffer and IDS it needs Windows Packet Capture Library which is WinPcap. The stable latest version on the site is 4.1.1 and you can download it <a title="WinPcap download" href="http://www.winpcap.org/install/default.htm">here</a>.</p>
<p>Now when we have WinPcap installed the next step will be to download Snort. The latest version for Windows is 2.8.5.1 and you can download it <a title="Snort downloads" href="http://www.snort.org/snort-downloads?">here</a>. Installation shouldn&#8217;t be a problem, if you need IPv6 support and logging to Microsoft SQL or Oracle database then you need to select proper radio and check boxes and if don&#8217;t then just go next and next to the end and that&#8217;s it. Default installation directory is <strong>C:\Snort </strong>so remember it because it will be our working dir all the time.</p>
<p>So we have installed WinPcap and Snort but we are not finished with installation yet. We have one more thing to download and install. The Snort rules. These rules are those small files that tells Snort what it should search for in captured packages and how to identify them, as a threat, information disclosure or something else. For us to be able to download Snort rules we have to be registered on Snort site. Registration is free and rules are one month old for free users, for those who need the latest threats detected at the same moment when they are published to the community I suggest to buy VRT subscription so you will have the latest rules directly as they are announced. So now we will download <strong>snortrules-snapshot-2.8.tar.gz</strong> rules archive file.  When you open archive file you will get following structure:</p>
<div class="mceTemp mceIEcenter">
<dl id="attachment_271" class="wp-caption aligncenter" style="width: 148px;">
<dt class="wp-caption-dt"><a href="http://blog.amarkulo.com/new/wp-content/uploads/2009/12/rules.jpg"><img class="size-full wp-image-271" title="Structure of rules " src="http://blog.amarkulo.com/new/wp-content/uploads/2009/12/rules.jpg" alt="" width="138" height="84" /></a></dt>
</dl>
</div>
<p style="text-align: left;">Snort rules</p>
<p style="text-align: left;">Copy all four directories over those in C:\Snort replacing contents that already exists on the hard drive.</p>
<p style="text-align: left;">Now when we are done with easy part we need to configure Snort to run. Because these rules are written for unixoid systems we need to change some things in the main config file C:\Snort\etc\snort.conf so that Snort can start at all.</p>
<p style="text-align: left;">Here are the things that you need to edit to be able to run snort:</p>
<p style="text-align: left;">Find lines 269 and 270. These lines will not allow Snort to start, at least not on Windows because Snort detects the second one as double config detection line so we need to change this.</p>
<p style="text-align: left;">Change from this:</p>
<blockquote>
<p style="text-align: left;">config detection: search-method ac-bnfa<br />
config detection: max_queue_events 5</p>
</blockquote>
<p style="text-align: left;">To this:</p>
<blockquote>
<p style="text-align: left;">config detection: search-method ac-bnfa max_queue_events 5</p>
</blockquote>
<p style="text-align: left;">Now, the next thing that we need to change is lines where we say to Snort where to find dynamic preprocessor files. On lines from 298 to 303 change this:</p>
<blockquote>
<p style="text-align: left;">dynamicpreprocessor file /usr/local/lib/snort_dynamicpreprocessor/libsf_dce2_preproc.so<br />
dynamicpreprocessor file /usr/local/lib/snort_dynamicpreprocessor/libsf_dns_preproc.so<br />
dynamicpreprocessor file /usr/local/lib/snort_dynamicpreprocessor/libsf_ftptelnet_preproc.so<br />
dynamicpreprocessor file /usr/local/lib/snort_dynamicpreprocessor/libsf_smtp_preproc.so<br />
dynamicpreprocessor file /usr/local/lib/snort_dynamicpreprocessor/libsf_ssh_preproc.so<br />
dynamicpreprocessor file /usr/local/lib/snort_dynamicpreprocessor/libsf_ssl_preproc.so</p>
</blockquote>
<p style="text-align: left;">To this:</p>
<blockquote>
<p style="text-align: left;">dynamicpreprocessor file C:\Snort\lib\snort_dynamicpreprocessor\sf_dce2.dll<br />
dynamicpreprocessor file C:\Snort\lib\snort_dynamicpreprocessor\sf_dcerpc.dll<br />
dynamicpreprocessor file C:\Snort\lib\snort_dynamicpreprocessor\sf_dns.dll<br />
dynamicpreprocessor file C:\Snort\lib\snort_dynamicpreprocessor\sf_ftptelnet.dll<br />
dynamicpreprocessor file C:\Snort\lib\snort_dynamicpreprocessor\sf_smtp.dll<br />
dynamicpreprocessor file C:\Snort\lib\snort_dynamicpreprocessor\sf_ssh.dll<br />
dynamicpreprocessor file C:\Snort\lib\snort_dynamicpreprocessor\sf_ssl.dll</p>
</blockquote>
<p style="text-align: left;">Next thing to change is line 324 on which we have dynamic engine path, so change it from this:</p>
<blockquote>
<p style="text-align: left;">dynamicengine /usr/local/lib/snort_dynamicengine/libsf_engine.so</p>
</blockquote>
<p style="text-align: left;">To this:</p>
<blockquote>
<p style="text-align: left;">dynamicengine C:\Snort\lib\snort_dynamicengine\sf_engine.dll</p>
</blockquote>
<p style="text-align: left;">I don&#8217;t know why, maybe some mistake, but lines bellow should be commented out by default, but they were not so we have to comment them out. Because we are not VRT subscriber and don&#8217;t have any dynamic detection files we need to coment lines from 339 to 354, so change this:</p>
<blockquote>
<p style="text-align: left;">dynamicdetection file /usr/local/lib/snort_dynamicrules/bad-traffic.so<br />
dynamicdetection file /usr/local/lib/snort_dynamicrules/chat.so<br />
dynamicdetection file /usr/local/lib/snort_dynamicrules/dos.so<br />
dynamicdetection file /usr/local/lib/snort_dynamicrules/exploit.so<br />
dynamicdetection file /usr/local/lib/snort_dynamicrules/imap.so<br />
dynamicdetection file /usr/local/lib/snort_dynamicrules/misc.so<br />
dynamicdetection file /usr/local/lib/snort_dynamicrules/multimedia.so<br />
dynamicdetection file /usr/local/lib/snort_dynamicrules/netbios.so<br />
dynamicdetection file /usr/local/lib/snort_dynamicrules/nntp.so<br />
dynamicdetection file /usr/local/lib/snort_dynamicrules/p2p.so<br />
dynamicdetection file /usr/local/lib/snort_dynamicrules/smtp.so<br />
dynamicdetection file /usr/local/lib/snort_dynamicrules/sql.so<br />
dynamicdetection file /usr/local/lib/snort_dynamicrules/web-client.so<br />
dynamicdetection file /usr/local/lib/snort_dynamicrules/web-misc.so</p>
</blockquote>
<p style="text-align: left;">To this:</p>
<blockquote>
<p style="text-align: left;">#dynamicdetection file /usr/local/lib/snort_dynamicrules/bad-traffic.so<br />
#dynamicdetection file /usr/local/lib/snort_dynamicrules/chat.so<br />
#dynamicdetection file /usr/local/lib/snort_dynamicrules/dos.so<br />
#dynamicdetection file /usr/local/lib/snort_dynamicrules/exploit.so<br />
#dynamicdetection file /usr/local/lib/snort_dynamicrules/imap.so<br />
#dynamicdetection file /usr/local/lib/snort_dynamicrules/misc.so<br />
#dynamicdetection file /usr/local/lib/snort_dynamicrules/multimedia.so<br />
#dynamicdetection file /usr/local/lib/snort_dynamicrules/netbios.so<br />
#dynamicdetection file /usr/local/lib/snort_dynamicrules/nntp.so<br />
#dynamicdetection file /usr/local/lib/snort_dynamicrules/p2p.so<br />
#dynamicdetection file /usr/local/lib/snort_dynamicrules/smtp.so<br />
#dynamicdetection file /usr/local/lib/snort_dynamicrules/sql.so<br />
#dynamicdetection file /usr/local/lib/snort_dynamicrules/web-client.so<br />
#dynamicdetection file /usr/local/lib/snort_dynamicrules/web-misc.so</p>
</blockquote>
<p style="text-align: left;">Now we need to trim a bit SSH preprocessor to work on Windows as it is different from Linux one, so find line 753 and change this:</p>
<blockquote>
<p style="text-align: left;">preprocessor ssh: server_ports { 22 } \<br />
max_client_bytes 19600 \<br />
max_encrypted_packets 20 \<br />
disable_srvoverflow \<br />
disable_protomismatch \<br />
disable_badmsgdir</p>
</blockquote>
<p style="text-align: left;">To this:</p>
<blockquote>
<p style="text-align: left;">preprocessor ssh: server_ports { 22 } \<br />
max_client_bytes 19600 \<br />
max_encrypted_packets 20</p>
</blockquote>
<p style="text-align: left;">Now we are good to go. We can test snort easily from the command line. So now go on <strong>Start-&gt;Run </strong>and type <strong>cmd</strong> following by enter key. Now in command prompt type following commands:</p>
<blockquote>
<p style="text-align: left;">c: and then enter key</p>
<p style="text-align: left;">cd c:\snort\bin and then enter key</p>
<p style="text-align: left;">snort -v -c C:\snort\etc\snort.conf -l C:\snort\log -K ascii and then enter key</p>
</blockquote>
<p style="text-align: left;">So now we have entered Snort directory and started Snort on command line. You will first see Snort starting and parsing config file snort.conf and then you will see lot of output when Snort start sniffing and controlling packages on the network. If it finds any package that is not regular network traffic it will save info about it in c:\Snort\Log\alert.ids file. Simple output of one captured packet looks like this:</p>
<blockquote>
<p style="text-align: left;">[**] [1:254:7] DNS SPOOF query response with TTL of 1 min. and no authority [**]<br />
[Classification: Potentially Bad Traffic] [Priority: 2]<br />
12/22-12:19:12.577553 192.168.137.206:53 -&gt; 192.168.137.10:55153<br />
UDP TTL:128 TOS:0&#215;0 ID:5399 IpLen:20 DgmLen:79<br />
Len: 51</p>
</blockquote>
<p style="text-align: left;">Now to explain what we have here. The first line says what type of attack is it, the second line says what classification is it and what priority does it have, and the last three lines are data about the attack, attacker IP, your IP, destination and source ports and so on.</p>
<div style="text-align: left;">Important part of this log is<strong> [Priority: 2]</strong> because that&#8217;s how you can identify the real threat from false one. The threats are divided in three groups, group 3 or <strong>[Priority: 3] </strong>is the lowest one and it usually means that someone is scanning your network. The second one is a bit serious. It&#8217;s information disclosure and it has <strong>[Priority: 2]</strong>. This means that someone has got some info about services that you are running which is usually the first part of any attack, gaining of information. The most critical one is the one with <strong>[Priority: 1] </strong>which usually means that right now someone is trying to exploit some of services that you are running. This could mean that you have older version of some service on your server, like IIS that is not updated or Exchange server or something else and that snort has detected some patterns in packages sent to server that could be exploits which can do harm.</div>
<div style="text-align: left;">Now we can stop Snort with <strong>Ctrl+C</strong> and Snort will display some statistics. The only thing that we have to do now is to install Snort as a Windows service. To do so we will write following command on command prompt:</div>
<blockquote>
<div style="text-align: left;">snort /service /install -c C:\Snort\etc\snort.conf -l C:\Snort\log -K ascii</div>
</blockquote>
<div style="text-align: left;">After this command service is installed and you can start it from service manager or simply type <strong>sc start snortsvc.</strong></div>
<div style="text-align: left;">So with this Snort is installed on your machine and is logging everything. Now you just need some program to parse alerts and do actions based on the alert priority. There are lot of those available on the Internet.</div>
<div style="text-align: left;"></div>
<div style="text-align: left;"><strong>Note 1:</strong> If you have more than one network interface on your machine you need to tell Snort on which one should it listen. First type snort -W command to list all interfaces on your machine (works only on Windows) and then when you find which interface is the one that you will listen on then you need to add <strong>-i n</strong> where n is number of interface from the list that you got. You need to add that to all Snort commands that you are executing from command prompt and when creating Windows service.</div>
<div style="text-align: left;"><strong>Note 2:</strong> If you want Snort to log alerts to Eventlog as well as to log files than add -E (only on Windows) to the command line parameters.</div>
<div style="text-align: left;"><strong>Update</strong>:  Here is my <a class="downloadlink" href="http://blog.amarkulo.com/wp-content/plugins/download-monitor/download.php?id=4" title=" downloaded 517 times" >snort.conf (517)</a> file which is working on my machine without any problems. It could be something with updated rules that can cause problems with starting of Snort.</div>
<div style="text-align: left;"><strong>Update2</strong>:  One trailing / on ssh preprocesor line was left by mistake, now it&#8217;s removed.</div>
<hr>
<p><div class="entry-utility">If you don't already have a <a href="http://db.tt/aqrG0tY">Dropbox</a> account then you can create it by clicking on my <a href="http://db.tt/aqrG0tY">affiliate link</a>. You will receive 2GB free account + 250 MB extra and I will receive 250 MB as well. Win-Win :-)</div></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.amarkulo.com/how-to-install-snort-ids-on-windows/feed</wfw:commentRss>
		<slash:comments>56</slash:comments>
		</item>
	</channel>
</rss>

