<?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>leinadium &#187; php</title>
	<atom:link href="http://www.leinadium.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.leinadium.com</link>
	<description>Techhead. Codewarrior. Legalnerd.</description>
	<lastBuildDate>Fri, 02 Sep 2011 20:09:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>php header() not working in opera on mac</title>
		<link>http://www.leinadium.com/code/php-header-not-working-in-opera-on-mac/</link>
		<comments>http://www.leinadium.com/code/php-header-not-working-in-opera-on-mac/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 16:29:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[opera]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[redirect]]></category>

		<guid isPermaLink="false">http://www.leinadium.com/misc/php-header-not-working-in-opera-on-mac/</guid>
		<description><![CDATA[Came across this strange behaviour in Opera on Mac. The php header command was simply ignored and the rest of the page executed normally. Finally found a solution that calls a javascript redirect if nothing else works. //==== Redirect&#8230; Try PHP header redirect, then Java redirect, then try http redirect.: function redir($url) { if (!headers_sent()) [...]]]></description>
			<content:encoded><![CDATA[<p>Came across this strange behaviour in Opera on Mac.<br />
The php header command was simply ignored and the rest of the page executed normally.<br />
Finally found a solution that calls a javascript redirect if nothing else works.</p>
<p>//==== Redirect&#8230; Try PHP header redirect, then Java redirect, then try http redirect.:<br />
function redir($url) {<br />
if (!headers_sent()) {    //If headers not sent yet&#8230; then do php redirect<br />
header(&#8216;Location: &#8216;.$url);</p>
<p>exit;<br />
} else {<br />
//If headers are sent&#8230; do java redirect&#8230; if java disabled, do html redirect.<br />
echo &#8216;&lt;script type=&#8221;text/javascript&#8221;&gt;&#8217;;<br />
echo &#8216;window.location.href=&#8221;&#8216;.$url.&#8217;&#8221;;&#8217;;<br />
echo &#8216;&lt;/script&gt;&#8217;;<br />
echo &#8216;&lt;noscript&gt;&#8217;;<br />
echo &#8216;&lt;meta http-equiv=&#8221;refresh&#8221; content=&#8221;0;url=&#8217;.$url.&#8217;&#8221; /&gt;&#8217;;<br />
echo &#8216;&lt;/noscript&gt;&#8217;;<br />
exit;<br />
}<br />
return 1;<br />
}</p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" src="http://img.zemanta.com/pixy.gif?x-id=dd7be906-a839-8e38-98cb-91e4b8f86ef4" alt="" /></div>
]]></content:encoded>
			<wfw:commentRss>http://www.leinadium.com/code/php-header-not-working-in-opera-on-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>consuming a .net web service with php problem</title>
		<link>http://www.leinadium.com/code/consuming-a-net-web-service-with-php-problem/</link>
		<comments>http://www.leinadium.com/code/consuming-a-net-web-service-with-php-problem/#comments</comments>
		<pubDate>Fri, 23 Jan 2009 11:18:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[service]]></category>
		<category><![CDATA[soap]]></category>

		<guid isPermaLink="false">http://217.11.59.22/leinadium/?p=40</guid>
		<description><![CDATA[The trouble I had with consuming a .Net Web service with a php script was that the parameters I passed were not &#8220;seen&#8221; by the .Net Application. I used the php_soap.dll (php5 running on windows) with the simple call: $testRequest = $client-&#62;IsAliveNachnameEmail(&#8220;Smith&#8221;,&#8221;smith@smith.com&#8221;); However, the .Net Soap Service did not receive the parameters Smith and smith@smith.com [...]]]></description>
			<content:encoded><![CDATA[<p>The trouble I had with consuming a .Net Web service with a php script was that the parameters I passed were not &#8220;seen&#8221; by the .Net Application.<br />
I used the php_soap.dll (php5 running on windows) with the simple call:</p>
<p>$testRequest = $client-&gt;IsAliveNachnameEmail(&#8220;Smith&#8221;,&#8221;smith@smith.com&#8221;);</p>
<p>However, the .Net Soap Service did not receive the parameters Smith and smith@smith.com</p>
<p>Do not pass in the parameters directly, but use the following method:</p>
<p>$strNachname = &#8220;smith&#8221;;<br />
$strEmail = &#8220;smith@smith.com&#8221;;<br />
$params = array(&#8216;Nachname&#8217;=&gt;$strNachname, &#8216;Email&#8217;=&gt;$strEmail);<br />
$testRequest = $client-&gt;IsAliveNachnameEmail($params);<br />
echo $test2Request-&gt;IsAliveNachnameEmailResult;</p>
<p>and it works! Voila.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.leinadium.com/code/consuming-a-net-web-service-with-php-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php joomla exploit</title>
		<link>http://www.leinadium.com/security/php-joomla-exploit/</link>
		<comments>http://www.leinadium.com/security/php-joomla-exploit/#comments</comments>
		<pubDate>Fri, 23 Jan 2009 10:50:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[security]]></category>
		<category><![CDATA[com_article]]></category>
		<category><![CDATA[exploit]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[joomla]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://217.11.59.22/leinadium/?p=17</guid>
		<description><![CDATA[Here&#8217;s the forensic story of one of our joomlaboxes getting hacked, courtesy of Alex: It seems the &#8220;attack&#8221; was coordinated from a single ip, 195.5.117.252. The reverse dns for this IP points to c31.esthost.eu, and there are a lot of services open on that system. I&#8217;ve done a short scan of the host and the [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s the forensic story of one of our joomlaboxes getting hacked, courtesy of Alex:</p>
<p>It seems the &#8220;attack&#8221; was coordinated from a single ip, 195.5.117.252. The<br />
reverse dns for this IP points to c31.esthost.eu, and there are a lot of<br />
services open on that system. I&#8217;ve done a short scan of the host and the<br />
results are attached in &#8220;scan.txt&#8221;. It seems the host runs openvpn on most of<br />
the ports, which means it is used to disguise the true identity of the<br />
attacker (fx, if the attacker connects himself to the vpn, the external ip of<br />
the site he will visit will be the vpn servers&#8217; ip).</p>
<p>There was one question that bothered me &#8211; HOW did the remote attacker get that<br />
shell on our server? The answer is dead simple and it&#8217;s the awful truth:<br />
SIMPLE PASSWORDS. The &#8220;admin&#8221; user on the joomla install seems to have had the<br />
password &#8220;adminpass&#8221;. I can&#8217;t say wether the password was set remotely, or if<br />
the password was always adminpass, but it is now adminpass. Of course, i<br />
disabled the account, so it can&#8217;t be used anymore.</p>
<p>The password wasn&#8217;t just random trial and error, it was a sure-shot. The<br />
joomla bibtex plugin has a little problem handling some POST-vars, aka it<br />
doesn&#8217;t mysql_real_escape_string or addslashes on the posted data. The exploit is known and you can find more info on this link:<br />
<a href="http://www.milw0rm.com/exploits/4310">http://www.milw0rm.com/exploits/4310 </a></p>
<p>It comes with full info about how to reproduce the bug. I even tested it in<br />
the wild and managed to list users on a couple of sites. On one of them, I<br />
managed to login with FULL administrative access. All this, even though the<br />
password is stored md5-hashed. A simple Google search for the hash revealed<br />
the password (not necesarily the SAME password, but a pwd with the same hash).</p>
<p>So, to sum things up, this is the chain of events: script googles for sites<br />
that expose the com_jombib extension (with, say a simple google search:<br />
inurl:index.<strong style="color: black; background-color: #a0ffff;">php</strong>?option=com_jombib), finds our site, tries the exploit,<br />
and tricks the extension into listing all the joomla users and their md5-<br />
hashed password. A simple google search revealed the true password<br />
(adminpass).</p>
<p>At this stage, the remote user had administrative access to the site. He<br />
now installs a plugin called &#8220;com_article&#8221; &#8211; nothing suspicious about that,<br />
right? The plugin consists of a single <strong style="color: black; background-color: #a0ffff;">php</strong> file &#8211; the <strong style="color: black; background-color: #a0ffff;">php</strong> shell, that was<br />
available at the following link:</p>
<p>The GET parameter is required for the shell to be rendered. Otherwise an error<br />
is thrown. Once the user launched the shell, he edited whatever files he<br />
wanted, and then he uploaded other files as well. And this is the end. Another<br />
compromised box in the wild  <img src='http://www.leinadium.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>I couldn&#8217;t have found out any of the stuff above if it weren&#8217;t for the<br />
accesslogs. It was a good ideea to keep the last 6 months&#8217; archives <img src='http://www.leinadium.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>The <strong style="color: black; background-color: #a0ffff;">PHP</strong> shell can be found anywhere on the net (i think), and it had a<br />
&#8220;clever&#8221; trick to disguise its real <strong style="color: black; background-color: #a0ffff;">php</strong> code (it was base64 encoded and inline<br />
compressed TWELVE times &#8211; hence the 12 in the shell12.<strong style="color: black; background-color: #a0ffff;">php</strong> filename).</p>
<p>Any file could&#8217;ve been accessed by the remote attacker and a) deleted b)<br />
searched for various info (passwords, stuff like that). I don&#8217;t know and I<br />
can&#8217;t say what got affected by the shell, as there are no traces in the system<br />
(it is a pseudo-shell, running simple, exec() commands).</p>
<p>As a general preventive measure, systems need to be updated regularly to allow<br />
upstream security patches to be applied. This is true for every linux app,<br />
library, distribution, and for any script (<strong style="color: black; background-color: #ff66ff;">asp</strong>, <strong style="color: black; background-color: #a0ffff;">php</strong>, a.s.o). There is nothing<br />
that the user could&#8217;ve done to prevent this, except for using a stronger password<br />
(even though this is relative &#8211; check this forum thread:</p>
<p>&lt;<a href="http://forum.insidepro.com/viewtopic.php?t=1741">http://forum.insidepro.com/viewtopic.<strong style="color: black; background-color: #a0ffff;">php</strong>?t=1741</a>&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.leinadium.com/security/php-joomla-exploit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

