<?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>[blog.rayfoo] &#187; log collection</title>
	<atom:link href="http://blog.rayfoo.info/tag/log-collection/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.rayfoo.info</link>
	<description>Infosec, DFIR, tech geekery, thoughts and whatnot</description>
	<lastBuildDate>Wed, 25 Jan 2012 00:36:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Profiling of persistent SSHD brute force attack</title>
		<link>http://blog.rayfoo.info/2011/04/profiling-of-persistent-sshd-brute-force-attack</link>
		<comments>http://blog.rayfoo.info/2011/04/profiling-of-persistent-sshd-brute-force-attack#comments</comments>
		<pubDate>Sun, 03 Apr 2011 19:04:19 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Everything]]></category>
		<category><![CDATA[brute forcing]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[log analysis]]></category>
		<category><![CDATA[log collection]]></category>
		<category><![CDATA[profiling]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[Splunk]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://blog.rayfoo.info/?p=823</guid>
		<description><![CDATA[Proper setting up and regular monitoring of logs gives you the avenue to know what's really happening with your box sitting out there in the internets, and to anticipate when bad things are about to happen.  One of the warning signs would be that someone has been poking around your box, looking for an (easy?) [...]]]></description>
			<content:encoded><![CDATA[<p><strong><img class="alignright size-full wp-image-824" title="Brute Force" src="http://blog.rayfoo.info/wp-content/uploads/2011/04/BruteForce.jpg" alt="" width="300" height="240" /></strong></p>
<p>Proper setting up and regular monitoring of logs gives you the avenue to know what's really happening with your box sitting out there in the internets, and to anticipate when <em>bad things</em> are about to happen.  One of the warning signs would be that <em>someone</em> has been poking around your box, looking for an (easy?) way in.</p>
<p>The natural thing that would jump out at you then, is that this <em>someone</em> has been accessing your box in far higher volumes/durations, especially on services that should not be accessed by others.</p>
<p>This is one example of such accesses on a linux box: <em>SSHD brute forcing over long periods of time.</em></p>
<p><span id="more-823"></span>Note: This post is more to talk about the process of digging/profiling, rather than the actual setup processes/log sources involved.  Feel free to ping me/comment below if you wish to discuss though.</p>
<p>The first thing you may ask is: what is "persistent"?  This would be the opposite of the run-of-the-mill opportunistic attackers.  These guys tend to bang your machine for a bit, then leave you alone immediately after failing:</p>
<div id="attachment_826" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.rayfoo.info/wp-content/uploads/2011/04/01-opportunistic.png"><img class="size-medium wp-image-826" title="Opportunistic" src="http://blog.rayfoo.info/wp-content/uploads/2011/04/01-opportunistic-300x81.png" alt="" width="300" height="81" /></a><p class="wp-caption-text">Opportunistic attack: Tries and gives up.</p></div>
<p>This contrasts greatly with the persistent buggers:</p>
<div id="attachment_827" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.rayfoo.info/wp-content/uploads/2011/04/02-persistent.png"><img class="size-medium wp-image-827" title="Persistent" src="http://blog.rayfoo.info/wp-content/uploads/2011/04/02-persistent-300x83.png" alt="Persistent Bugger" width="300" height="83" /></a><p class="wp-caption-text">Whoa!</p></div>
<p>After digging around first on the IP and supposed country of origin, we want to find out what did the attacker try to do?  One of the logs (*cough*... p0f... *cough*...) feeds info on the ports that were attempted to connect to, this could be a starting point:</p>
<p style="text-align: left;">
<div id="attachment_828" class="wp-caption aligncenter" style="width: 508px"><a href="http://blog.rayfoo.info/wp-content/uploads/2011/04/03-ports-accessed.png"><img class="size-full wp-image-828 " title="Ports Accessed" src="http://blog.rayfoo.info/wp-content/uploads/2011/04/03-ports-accessed.png" alt="" width="498" height="272" /></a><p class="wp-caption-text">Mostly port 22 (SSH), only 1 for port 80 (HTTP)?</p></div>
<p style="text-align: left;">Searching for and viewing the port 80 access attempt, by itself and in relation to the other activities shows the following:</p>
<p style="text-align: center;">
<div id="attachment_832" class="wp-caption aligncenter" style="width: 492px"><a href="http://blog.rayfoo.info/wp-content/uploads/2011/04/04-port-80-access.png"><img class="size-full wp-image-832  " title="04-port-80-access" src="http://blog.rayfoo.info/wp-content/uploads/2011/04/04-port-80-access.png" alt="" width="482" height="205" /></a><p class="wp-caption-text">Pinpointing the port 80 connection</p></div>
<p style="text-align: center;">
<div id="attachment_833" class="wp-caption aligncenter" style="width: 491px"><a href="http://blog.rayfoo.info/wp-content/uploads/2011/04/05-confirming-access-profile.png"><img class="size-full wp-image-833  " title="05-confirming-access-profile" src="http://blog.rayfoo.info/wp-content/uploads/2011/04/05-confirming-access-profile.png" alt="" width="481" height="208" /></a><p class="wp-caption-text">Viewing the logs in chronological order (Splunk defaults to reverse chronological)</p></div>
<p style="text-align: left;">Viewing the logs in chronological order (Splunk defaults to reverse chronological) shows that the port 80 connection preceeded the many many many port 22 connections by 2 minutes.  What's going on here?  If <em>somebody</em> wanted to get at the SSH accounts, why not go for them straight, rather than accessing the web service only once?  Checking the web access logs might give the answer we're looking for:</p>
<p style="text-align: center;">
<div id="attachment_834" class="wp-caption aligncenter" style="width: 524px"><a href="http://blog.rayfoo.info/wp-content/uploads/2011/04/06-accessed-http-page.png"><img class="size-full wp-image-834 " title="06-accessed-http-page" src="http://blog.rayfoo.info/wp-content/uploads/2011/04/06-accessed-http-page.png" alt="" width="514" height="157" /></a><p class="wp-caption-text">So in that TCP/80 connection....NOTHING was retrieved</p></div>
<p style="text-align: left;">Accessing <em>nothing </em>in that (only) one connection makes this look like a ping of sorts, but we can't be certain.</p>
<p style="text-align: left;">The next thing is to look at what this <em>somebody</em> was doing over the past two weeks!  First we get an idea of the kinds of things that were happening:</p>
<p style="text-align: center;">
<div id="attachment_835" class="wp-caption aligncenter" style="width: 545px"><a href="http://blog.rayfoo.info/wp-content/uploads/2011/04/07a-sshd-invalid-user.png"><img class="size-full wp-image-835 " title="07a-sshd-invalid-user" src="http://blog.rayfoo.info/wp-content/uploads/2011/04/07a-sshd-invalid-user.png" alt="" width="535" height="301" /></a><p class="wp-caption-text">Mostly &quot;Attempts to login using a non-existent user&quot;, ala our dear Mr Force, Brute Force</p></div>
<div id="attachment_836" class="wp-caption aligncenter" style="width: 523px"><a href="http://blog.rayfoo.info/wp-content/uploads/2011/04/07b-ssh-scan.png"><img class="size-full wp-image-836" title="07b-ssh-scan" src="http://blog.rayfoo.info/wp-content/uploads/2011/04/07b-ssh-scan.png" alt="" width="513" height="205" /></a><p class="wp-caption-text">...and &quot;SSH scan&quot;</p></div>
<p style="text-align: left;">What do these SSH scans mean?</p>
<p style="text-align: center;">
<div id="attachment_837" class="wp-caption aligncenter" style="width: 491px"><a href="http://blog.rayfoo.info/wp-content/uploads/2011/04/08-ssh-scan-no-ident-str-received.png"><img class="size-full wp-image-837  " title="08-ssh-scan-no-ident-str-received" src="http://blog.rayfoo.info/wp-content/uploads/2011/04/08-ssh-scan-no-ident-str-received.png" alt="" width="481" height="217" /></a><p class="wp-caption-text">Just means that the SSH handshake was not properly done/completed.</p></div>
<p style="text-align: left;">Since we already know that this is a brute force attempt, judging by the frequency of the failed SSH handshakes per day we can assume for now that they're just resulting from either the connections being blocked, or just "normal" failures in the midst of thousands of attempts.  More can be done to confirm this by zooming into the times where these errors occur, but let's say we're not interested in confirming this fact for now.</p>
<p style="text-align: left;">Looking at the nature of the attack provides some clues on the tools being used too.  For that we extract some stats concerning the tool's attack:</p>
<p style="text-align: center;">
<div id="attachment_838" class="wp-caption aligncenter" style="width: 548px"><a href="http://blog.rayfoo.info/wp-content/uploads/2011/04/09-targeted-ssh-user-counts.png"><img class="size-full wp-image-838 " title="09-targeted-ssh-user-counts" src="http://blog.rayfoo.info/wp-content/uploads/2011/04/09-targeted-ssh-user-counts.png" alt="" width="538" height="313" /></a><p class="wp-caption-text">Extracting and counting targeted SSH userids show that 473 userids are attempted in a range from 1 to 21 times each</p></div>
<p style="text-align: center;">
<div id="attachment_839" class="wp-caption aligncenter" style="width: 491px"><a href="http://blog.rayfoo.info/wp-content/uploads/2011/04/11-distribution-first-occurrences-targeted-users.png"><img class="size-full wp-image-839  " title="11-distribution-first-occurrences-targeted-users" src="http://blog.rayfoo.info/wp-content/uploads/2011/04/11-distribution-first-occurrences-targeted-users.png" alt="" width="481" height="132" /></a><p class="wp-caption-text">First occurrence of each targeted userid is spread out fairly evenly throughout the time period...</p></div>
<div id="attachment_840" class="wp-caption aligncenter" style="width: 491px"><a href="http://blog.rayfoo.info/wp-content/uploads/2011/04/12-distribution-last-occurrences-targeted-users.png"><img class="size-full wp-image-840  " title="12-distribution-last-occurrences-targeted-users" src="http://blog.rayfoo.info/wp-content/uploads/2011/04/12-distribution-last-occurrences-targeted-users.png" alt="" width="481" height="126" /></a><p class="wp-caption-text">...and last occurrences of each userid being fairly even throughout too.</p></div>
<p style="text-align: left;">More stats would be needed depending on the theory you're trying to prove/disprove, but you get the picture.</p>
<p style="text-align: left;">One of the things I usually would want to see is the list of userids used to brute force.  In this case, it looks like a predominantly Japanese/Chinese wordlist/namelist being used.  Interesting.</p>
<p style="text-align: center;">
<div id="attachment_841" class="wp-caption aligncenter" style="width: 624px"><a href="http://blog.rayfoo.info/wp-content/uploads/2011/04/14-targeted-usernames.png"><img class="size-full wp-image-841 " title="14-targeted-usernames" src="http://blog.rayfoo.info/wp-content/uploads/2011/04/14-targeted-usernames.png" alt="" width="614" height="360" /></a><p class="wp-caption-text">Am I Japanese?  Am I Chinese? <img src='http://blog.rayfoo.info/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p></div>
<p>Maybe I should start blogging in other languages to see what kind of brute force wordlists turn up <img src='http://blog.rayfoo.info/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>For now, in any case, <span style="color: #ff0000;"><strong>122.166.127.116 (abts-kk-static-116.127.166.122.airtelbroadband.in), I AM WATCHING YOU</strong></span>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rayfoo.info/2011/04/profiling-of-persistent-sshd-brute-force-attack/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Troubleshooting Splunk</title>
		<link>http://blog.rayfoo.info/2010/03/troubleshooting-splunk</link>
		<comments>http://blog.rayfoo.info/2010/03/troubleshooting-splunk#comments</comments>
		<pubDate>Mon, 08 Mar 2010 14:27:51 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Everything]]></category>
		<category><![CDATA[data mining]]></category>
		<category><![CDATA[log analysis]]></category>
		<category><![CDATA[log collection]]></category>
		<category><![CDATA[logs]]></category>
		<category><![CDATA[Splunk]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[troubleshooting]]></category>

		<guid isPermaLink="false">http://blog.rayfoo.info/?p=478</guid>
		<description><![CDATA[Have been fiddling around with Splunk lately.  Splunk's a really good tool to use for log collection and analysis (and that's oversimplifying it, I believe it can even do event correlation...), which really made my love for data mining go crazy of late:P  Best part is that it has a perpetual free license, nice! One [...]]]></description>
			<content:encoded><![CDATA[<p>Have been fiddling around with <a href="http://www.splunk.com/">Splunk</a> lately.  Splunk's a really good tool to use for log collection and analysis (and that's oversimplifying it, I believe it can even do event correlation...), which really made my love for data mining go crazy of late:P  Best part is that it has a perpetual free license, nice!</p>
<p>One of the things I encountered when using Splunk was that it didn't seem to be indexing all the log files that it was set to monitor.  After some reading up and experimenting the reason became clear: Splunk will not work properly if you set it to monitor too many files.</p>
<p>How many is too many?  For example, setting it to monitor a logfile directory which only has one active log and 100+++ rotated logs, is too many.  What should be done instead is to set it to monitor the active logfile only, and use oneshot adding of the other logfiles to the index you want.</p>
<p>Gonna do some more sharing/writeups about this crazily great tool.  There's really a lot that this thing can do man.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rayfoo.info/2010/03/troubleshooting-splunk/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

