<?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>Christian Schenk&#187; referrer</title>
	<atom:link href="http://www.christianschenk.org/blog/tag/referrer/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.christianschenk.org</link>
	<description>Writing about my experiences with technology and all different kinds of projects and experiments</description>
	<lastBuildDate>Sun, 04 Dec 2011 23:43:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Two nasty ways to promote your blog</title>
		<link>http://www.christianschenk.org/blog/two-nasty-ways-to-promote-your-blog/</link>
		<comments>http://www.christianschenk.org/blog/two-nasty-ways-to-promote-your-blog/#comments</comments>
		<pubDate>Wed, 30 Jan 2008 09:54:48 +0000</pubDate>
		<dc:creator>Christian Schenk</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[forgery]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[referrer]]></category>
		<category><![CDATA[spam]]></category>
		<category><![CDATA[spoofing]]></category>

		<guid isPermaLink="false">http://www.christianschenk.org/blog/two-nasty-ways-to-promote-your-blog/</guid>
		<description><![CDATA[This post shows you how (not) to promote your blog: referrer and search keyword spamming]]></description>
			<content:encoded><![CDATA[<div class="info_box">This post shows you how <em>not</em> to promote your blog. It&#8217;s a satire.</div>
<p>My website statistics are filled with false <a title="HTTP Referer" href="http://en.wikipedia.org/wiki/HTTP_referer">referrers</a> and dubious keyphrases from various search engines due to <a title="Referrer Spoofing" href="http://en.wikipedia.org/wiki/Referrer_spoofing">referrer spoofing</a>. Some people use this technique to promote their sites. Although I don&#8217;t want you to encourage to do this too, this post describes an easy way to spam other people&#8217;s website statistics. I wrote a small tool that&#8217;ll generate the requests for you: have a look at it <a title="WebStatsSpammer" href="http://www.christianschenk.org/projects/webstats-spammer/">here</a>.</p>
<p><span id="more-56"></span></p>
<h2>Spamming statistics</h2>
<p>The small <a title="WebStatsSpammer" href="http://www.christianschenk.org/projects/webstats-spammer/">tool</a> I wrote lets you easily send custom referrers. It sends an HTTP request to a specified site and sets the referrer to:</p>
<ul>
<li>a custom address or</li>
<li>the <a title="Google" href="http://www.google.com/">Google</a> website with a specified search string</li>
</ul>
<p>This way the request will generate an entry in the referrer or keyphrase listing of the statistics tool running on the target site. This are the two nasty ways to promote your website: send requests with the referrer set to the address of your website or to some Google search that <em>led</em> you to the target site.</p>
<p>You could also use <a title="Privoxy" href="http://www.privoxy.org/">Privoxy</a> or <a title="Proxomitron" href="http://proxomitron.info/">Proxomitron</a> for this purpose.</p>
<h2>Counter measures</h2>
<p>Three things come to my mind if we&#8217;d like to get rid of referrer spoofing:</p>
<ol>
<li>block requests based on the referrer with your webserver</li>
<li>skip certain IPs or requests with certain referrers in your statistics software</li>
<li>use a tool that&#8217;s not affected by HTTP header referrer spoofing</li>
</ol>
<p>I&#8217;ll discuss these options in more detail in the following sections.</p>
<h3>Block certain requests with your webserver</h3>
<p>If you&#8217;re running the <a title="Apache HTTP Server" href="http://httpd.apache.org/">Apache</a> webserver you can use <code>mod_rewrite</code> to investigate the HTTP header and send the client a redirect to another page if he&#8217;s connecting with a dubious referrer. All you have to do is to add something like the following to your virtual host or <code>.htaccess</code> file:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;IfModule</span> mod_rewrite.c<span style="color: #000000; font-weight: bold;">&gt;</span></span>
  RewriteEngine on
  RewriteCond %{HTTP_REFERER} ^(.*)example.com(.*)$ [OR]
  RewriteCond %{HTTP_REFERER} ^(.*)some-evil-site.net(.*)$ [OR]
  RewriteRule .* http://some-other-site.com/ [F,R,L]
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/IfModule<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Where <code>example.com</code> and <code>some-evil-site.net</code> are sites that send requests with forged referrers and <code>some-other-site.com</code> is a site that all this traffic will be redirected to.</p>
<p>Since there&#8217;s some performance hit I recommend to manually add more lines with hosts that send dubious referrers to you. If you don&#8217;t want to maintain this list of evil hosts manually but want to automate this step you should have a look at <a title="Get Rid of Referer Spammers with aStatSpam" href="http://www.thetopsites.net/referer_spam/">aStatSpam</a>.</p>
<h3>Configure your statistics software</h3>
<p>Whatever website log file analyzer you&#8217;re using it should have a feature to ignore requests that came from a specific IP or with a certain referrer. If you&#8217;re using <a href="http://awstats.sourceforge.net/">AWStats</a> you want to have a look at <code>SkipHosts</code> or <code>SkipReferrersBlackList</code>.</p>
<p>On a Debian box it boils down to this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Skip records with these IPs</span>
<span style="color: #007800;">SkipHosts</span>=<span style="color: #ff0000;">&quot;127.0.0.1 1.2.3.4 [...]&quot;</span> 
<span style="color: #666666; font-style: italic;"># Skip records with these referrers</span>
<span style="color: #007800;">SkipReferrersBlackList</span>=<span style="color: #ff0000;">&quot;/usr/share/awstats/lib/blacklist.txt&quot;</span></pre></div></div>

<p>Records from the logs that match the configured criteria will be skipped.</p>
<h3>Use another tool</h3>
<p>Using a tool that isn&#8217;t vulnerable to referrer spoofing seems to be a good idea. Solutions like <a title="Google Analytics" href="http://www.google.com/analytics/">Google Analytics</a> or <a title="103bees Search traffic analysis" href="http://103bees.com/">10<sup>3</sup>bees</a> come to my mind. With these tools you might miss all the visitors who haven&#8217;t JavaScript enabled but at least you&#8217;ll have reliable information about the traffic generated from visitors with JavaScript enabled.</p>
<p>Of course these tools aren&#8217;t completely immune to referrer spoofing: the browser can fake the referrer as well. Although there&#8217;re several tools to do this, this doesn&#8217;t seem to be common practice.</p>
<h2>Conclusion</h2>
<p>There are some technical solutions that help you to eradicate referrer spoofing. You&#8217;ll have to implement one or the other to get reliable analysis of your website traffic. I think that a combination of the presented solutions might be a good idea. I recommend using a classic tool that analyzes the log files from your webserver as well as a tool that&#8217;s based on JavaScript. This way you should get fairly reliable information about your visitors.</p>
<p>If people are really spamming your site you should think about blocking their IPs or their requests based on the referrers with your webserver altogether. This should help you to minimize the traffic from spammers to your site.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.christianschenk.org/blog/two-nasty-ways-to-promote-your-blog/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

