<?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>Saiweb &#187; security</title>
	<atom:link href="http://www.saiweb.co.uk/category/security/feed" rel="self" type="application/rss+xml" />
	<link>http://www.saiweb.co.uk</link>
	<description>Ramblings of a Sys admin</description>
	<lastBuildDate>Mon, 06 Feb 2012 14:57:49 +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>PenTesting &#8211; mySQL password hash generation and lookup</title>
		<link>http://www.saiweb.co.uk/security/pentesting-mysql-password-hash-generation-and-lookup</link>
		<comments>http://www.saiweb.co.uk/security/pentesting-mysql-password-hash-generation-and-lookup#comments</comments>
		<pubDate>Wed, 17 Aug 2011 12:20:04 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[security]]></category>
		<category><![CDATA[generator]]></category>
		<category><![CDATA[hashdump]]></category>
		<category><![CDATA[hashing]]></category>
		<category><![CDATA[mySQL]]></category>
		<category><![CDATA[old_passwords]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=1104</guid>
		<description><![CDATA[One of the worst things you can have in any secure system is a user with a simple password, no matter what steps you take to protect your data, if a privileged user is using a simple password, it&#8217;s akin to having a safe door that&#8217;s glass window. First off we need to take a [...]]]></description>
			<content:encoded><![CDATA[<p>One of the worst things you can have in any secure system is a user with a simple password, no matter what steps you take to protect your data, if a privileged user is using a simple password, it&#8217;s akin to having a safe door that&#8217;s glass window.</p>
<p>First off we need to take a hash dump:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mysql -Bse 'select distinct(password),user from mysql.user;' &gt; hashdump.txt</div></td></tr></tbody></table></div>
<p>Now of course you can do the same using SQL Injection etc (WHY when you have SQLi already? duh privilege escalation!) , I&#8217;m going to cover this from the perspective that you are the administrator looking to strengthen your security &#8230;</p>
<p>Now you have your hashdump you need a hash table with the equivelent passwords within it, for this you will need 2 things</p>
<p>1. A dictionary file<br />
2. <a href="https://github.com/Oneiroi/PenTesting/blob/master/crypto/generators/mysql/csv_gen.py">https://github.com/Oneiroi/PenTesting/blob/master/crypto/generators/mysql/csv_gen.py</a></p>
<p>The python script above I wrote to use multiprocessing to map words onto the hash function, and I have had it grind through mySQL hashes at a rate of ~98k per second, there is no &#8220;lookup&#8221; script at this time though one is currently being written.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">./csv_gen.py -f /path/to/wordlist.txt -o /output/path/to/output.csv -t &lt;max threads, default 1&gt; [-l optional use legacy hash]</div></td></tr></tbody></table></div>
<p>once this has ground through your wordlist you will have a CSV file, which will be in the format <hash>,
<password>
the script defaults to the new PASSWORD() function, if you are using old_password=1 in your configuration then pass the -l flag to use legacy hashing instead.</p>
<p>ok let&#8217;s assume the following fictional scenario </p>
<p>1. old_passwords is in use, and we want chip&#8217;s password<br />
2. 077b91e3491e2fdd	chip<br />
3.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">grep 077b91e3491e2fdd output.txt<br />
077b91e3491e2fdd,a</div></td></tr></tbody></table></div>
<p>4. Chip has a password that is just he letter &#8220;a&#8221; which he will tell you is the best password ever &#8230;</p>
<p>And that&#8217;s about a simple as it gets you generate a set of hashes and you compare known hashes to your generate set to see if you can discern simple passwords, hopefully going on then to chastise the user and instructing them on proper password etiquette, there are more complicated methods of getting the password from the hash, in the case of old_passwords I believe it is possible to reverse the hash to get the original string for one (so don&#8217;t use old_passwords!)</p>
<p>If you go on to use my python scripts, please let me know how they perform, my test were carried out using an intel i5, I&#8217;d love to know how they perform on other CPUs.</p>
<p><span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/security/pentesting-mysql-password-hash-generation-and-lookup" data-text="PenTesting &#8211; mySQL password hash generation and lookup" href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Fsecurity%2Fpentesting-mysql-password-hash-generation-and-lookup&#038;text=PenTesting%20%26%238211%3B%20mySQL%20password%20hash%20generation%20and%20lookup" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/security/pentesting-mysql-password-hash-generation-and-lookup/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cloaking your web apps &#8211; Ninja vanish</title>
		<link>http://www.saiweb.co.uk/security/cloaking-your-web-apps-ninja-vanish</link>
		<comments>http://www.saiweb.co.uk/security/cloaking-your-web-apps-ninja-vanish#comments</comments>
		<pubDate>Sat, 18 Jun 2011 11:34:43 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[security]]></category>
		<category><![CDATA[apps]]></category>
		<category><![CDATA[cloak]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[hide]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=1033</guid>
		<description><![CDATA[Bad TMNT reference I know but with a reboot coming what do you expect realy? Right so you have hidden your versions via The Hooded Apache so what now? Well no matter what you do if your url&#8217;s contain .php / .asp / .cfm (Frankly if you are using coldfusion you deserve what you get [...]]]></description>
			<content:encoded><![CDATA[<p>Bad <a href="http://lmgtfy.com/?q=tmnt">TMNT</a> reference I know but with a reboot coming what do you expect realy?</p>
<p>Right so you have hidden your versions via <a href="http://www.saiweb.co.uk/security/cloaking-your-web-apps-the-hooded-apache">The Hooded Apache</a> so what now?</p>
<p>Well no matter what you do if your url&#8217;s contain .php / .asp / .cfm (Frankly if you are using coldfusion you deserve what you get &#8230; just saying &#8230;)</p>
<p>You are disclosing what your webapp is using as it&#8217;s server side language, now to be clear this hiding is only going to be effective if you are using a bespoke webapp, and not say Joomla / WordPress as they are easily identifiable via other means (for another post) &#8230;</p>
<p><strong>mod_rewrite</strong></p>
<p>Learn this, I mean seriously not only can it help cloak your server side language but you can do so using <a href="http://lmgtfy.com/?q=SEO">SEO</a> urls.</p>
<p><strong>BUT</strong> be careful if you think you&#8217;re being cleaver by having mod_rewrite change the extension alone &#8230;</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">RewriteEngine On<br />
RewriteRule (.*)\.inc$ $1.php [L]</div></td></tr></tbody></table></div>
<p>it will be easy to enumerate the back end language this way &#8230; the first 404 that an attacker gets when enumerating your file names will reveal this rule i.e. </p>
<p>&#8220;The file /asfasdgasdg.php was not found on this server&#8221; &#8230; yeh &#8230;</p>
<p><strong>Change the extension entirely</strong></p>
<p>Security through obscurity? you bet your ass, just add your new extension onto your AddType declaration, because you are already avoiding the <a href="http://www.saiweb.co.uk/uncategorized/apache-2-2-3-dual-extention-vulnerability">dual extension vulnerability</a> right? </p>
<p>how about .wtf</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">AddType application/x-httpd-php .php .phtml .wtf</div></td></tr></tbody></table></div>
<p>Now just name your files .wtf instead of .php</p>
<p><strong>So your using subversion</strong> good for you! you can use subversion as part of PCI 11.5 (iirc) to enforce file integrity assuming of course you have your subversion deploy setup securely just one tiny problem &#8230;</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">curl -s http://domain.com/.svn/entries<br />
<br />
10<br />
dir<br />
1234<br />
http://domain.com/PROJECT/tags/1.0<br />
http://domain.com<br />
<br />
2011-06-15T11:47:29.153442Z<br />
1234<br />
joe.blogs<br />
has-props<br />
<br />
9733698e-0000-0000-abab-ab0000000aba<br />
^L<br />
config.php<br />
file<br />
<br />
ddde986004c962d5827ca851403f96d5<br />
2011-05-25T08:13:14.961921Z<br />
1234<br />
joe.blogs</div></td></tr></tbody></table></div>
<p><strong><br />
Seemingly innocent right? oh how wrong you are &#8230;</strong></p>
<ol>
<li>http://domain.com we know the version control server location, we can attack that later</li>
<li>http:// is not an encrypted protocol, easy to sniff for if you get access to the server / company lan</li>
<li>joe.blogs we have a known username we can attempt to access using dictionary / brute force / social engineering</li>
<li>http:// the server could be vulnerable to <a href="http://www.cvedetails.com/cve/CVE-2011-1921/">CVE-2011-1921</a> </li>
<li>we know that config.php exists we can target that later for other crednetials</li>
</ol>
<p><strong>So assuming a worst case scenario, </strong></p>
<ol>
<li>Webapp is compromised and we managed to deploy a remote shell</li>
<li>Sniffing for http:// hiding silently in the background we find a site update / commit, and snag joe.blogs user credentials</li>
<li>Exploiting <a href="http://www.cvedetails.com/cve/CVE-2011-1921/">CVE-2011-1921</a> we enumerate all projects on the svn server (If we even have to &#8230; joe.blogs could have access to everything anyway &#8230;)</li>
<li>Inject backdoors into all projects committing changes as joe.blogs</li>
<li>Wait for co	de to be deployed to production &#8230;</li>
<li>And now you have backdoors into multiple projects</li>
</ol>
<p><strong>You can prevent this by &#8230;</strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;Directory ~ &quot;\.svn&quot;&gt;<br />
Order allow,deny<br />
Deny from all<br />
&lt;/Directory&gt;</div></td></tr></tbody></table></div>
<p><strong>Or using mod_security</strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">SecRule REQUEST_URI &quot;\.svn&quot; phase:1,deny</div></td></tr></tbody></table></div>
<p>Ensure you use an <strong>ENCRYPTED</strong> protocol for your version control https:// / ssh+svn:// for example with subversion.</p>
<p><span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/security/cloaking-your-web-apps-ninja-vanish" data-text="Cloaking your web apps &#8211; Ninja vanish" href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Fsecurity%2Fcloaking-your-web-apps-ninja-vanish&#038;text=Cloaking%20your%20web%20apps%20%26%238211%3B%20Ninja%20vanish" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/security/cloaking-your-web-apps-ninja-vanish/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cloaking your web apps &#8211; The hooded Apache</title>
		<link>http://www.saiweb.co.uk/security/cloaking-your-web-apps-the-hooded-apache</link>
		<comments>http://www.saiweb.co.uk/security/cloaking-your-web-apps-the-hooded-apache#comments</comments>
		<pubDate>Mon, 25 Apr 2011 19:54:06 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=1008</guid>
		<description><![CDATA[Go ahead and run 1curl -I http://www.saiweb.co.uk You will get 12345678HTTP/1.1 200 OK Date: Mon, 25 Apr 2011 19:33:29 GMT Server: Apache Vary: Accept-Encoding,Cookie Cache-Control: max-age=3, must-revalidate WP-Super-Cache: Served supercache file from PHP Connection: close Content-Type: text/html; charset=UTF-8 As an attacker looking to hit a web app, one of the first things you&#8217;re going to [...]]]></description>
			<content:encoded><![CDATA[<p>Go ahead and run</p>
<p><div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">curl -I http://www.saiweb.co.uk</div></td></tr></tbody></table></div>
</p>
<p>You will get </p>
<p><div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">HTTP/1.1 200 OK<br />
Date: Mon, 25 Apr 2011 19:33:29 GMT<br />
Server: Apache<br />
Vary: Accept-Encoding,Cookie<br />
Cache-Control: max-age=3, must-revalidate<br />
WP-Super-Cache: Served supercache file from PHP<br />
Connection: close<br />
Content-Type: text/html; charset=UTF-8</div></td></tr></tbody></table></div>
</p>
<p>As an attacker looking to hit a web app, one of the first things you&#8217;re going to want to look into is what version of web server is running, in this case you can see this blog in fact runs apache &#8230; but there is not much else to go on here is there.</p>
<p>That&#8217;s intentional, and by manual configuration changes I have put in place, this is not the case of a default LAMP install, take for instance, this snippet from another website,</p>
<p><div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Server: Apache/2.2.16 (Debian)<br />
X-Powered-By: PHP/5.2.14</div></td></tr></tbody></table></div>
</p>
<p>This already has given me a wealth of information to go on and begin prepping an attack, I now know the site is running php version 5.2.14 Apache version 2.2.16 and that the underlying OS is Debian.</p>
<p>See the dilemma? your default roll outs are just declaring their running versions to anyone willing to listen, so lets make it a little more stealthy.</p>
<p>First and foremost if you are using php, edit your php.ini and set the following:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">expose_php = off</div></td></tr></tbody></table></div>
<p>Now head into your httpd.conf and set the following</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ServerTokens prod</div></td></tr></tbody></table></div>
<p>and</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ServerSignature off</div></td></tr></tbody></table></div>
<p>With these 3 simple steps all the headers will now return is Server: Apache this is the first step to shielding your app, I&#8217;ll be covering further steps as time allows.</p>
<p><span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/security/cloaking-your-web-apps-the-hooded-apache" data-text="Cloaking your web apps &#8211; The hooded Apache" href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Fsecurity%2Fcloaking-your-web-apps-the-hooded-apache&#038;text=Cloaking%20your%20web%20apps%20%26%238211%3B%20The%20hooded%20Apache" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/security/cloaking-your-web-apps-the-hooded-apache/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>suPHP::LookupException</title>
		<link>http://www.saiweb.co.uk/security/suphplookupexception</link>
		<comments>http://www.saiweb.co.uk/security/suphplookupexception#comments</comments>
		<pubDate>Mon, 02 Feb 2009 10:56:17 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[security]]></category>
		<category><![CDATA[LookupException]]></category>
		<category><![CDATA[suPHP]]></category>
		<category><![CDATA[suPHP::LookupException]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/security/suphplookupexception</guid>
		<description><![CDATA[If you are seeing &#8216;suPHP::LookupException&#8216; in your apache error logs, this is due to the suPHP_UserGroup line in your virtualhost config. This error indicates that the user and/or the group specified in the config does not exist, this can happen if you have typed in either incorrectly, and/or the user has been removed from the [...]]]></description>
			<content:encoded><![CDATA[<p>If you are seeing &#8216;<b>suPHP::LookupException</b>&#8216; in your apache error logs, this is due to the <b>suPHP_UserGroup</b> line in your virtualhost config.</p>
<p>This error indicates that the user and/or the group specified in the config does not exist, this can happen if you have typed in either incorrectly, and/or the user has been removed from the system (see /etc/passwd).<span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/security/suphplookupexception" data-text="suPHP::LookupException" href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Fsecurity%2Fsuphplookupexception&#038;text=suPHP%3A%3ALookupException" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/security/suphplookupexception/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>User cleanup</title>
		<link>http://www.saiweb.co.uk/general/user-cleanup</link>
		<comments>http://www.saiweb.co.uk/general/user-cleanup#comments</comments>
		<pubDate>Mon, 08 Dec 2008 18:34:53 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/general/user-cleanup</guid>
		<description><![CDATA[Due to the security issues with wordpress pre 2.6.5, I have deleted all registered users. All the accounts were registered around the same time, and had never been logged in to. So please re-register if you are a genuine user. Cheers BuzzTweet]]></description>
			<content:encoded><![CDATA[<p>Due to the security issues with wordpress pre 2.6.5, I have deleted all registered users.</p>
<p>All the accounts were registered around the same time, and had never been logged in to.</p>
<p>So please re-register if you are a genuine user.</p>
<p>Cheers</p>
<p>Buzz<span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/general/user-cleanup" data-text="User cleanup" href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Fgeneral%2Fuser-cleanup&#038;text=User%20cleanup" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/general/user-cleanup/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The zen of secured shared hosting part 1</title>
		<link>http://www.saiweb.co.uk/security/the-zen-of-secured-shared-hosting-part-1</link>
		<comments>http://www.saiweb.co.uk/security/the-zen-of-secured-shared-hosting-part-1#comments</comments>
		<pubDate>Fri, 24 Oct 2008 08:20:02 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[suPHP]]></category>
		<category><![CDATA[zen]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/security/the-zen-of-secured-shared-hosting-part-1</guid>
		<description><![CDATA[Welcome to part one of the &#8216;zen of secured shared hosting&#8217; series. In this part I will be covering the concepts of secured shared hosting, and why you as a shared hosting provider should be taking steps to ensure this is how you deploy your hosting environments. Let&#8217;s first take a typical L.A.M.P setup: PHP [...]]]></description>
			<content:encoded><![CDATA[<p>Welcome to part one of the &#8216;zen of secured shared hosting&#8217; series.</p>
<p>In this part I will be covering the concepts of secured shared hosting, and why you as a shared hosting provider should be taking steps to ensure this is how you deploy your hosting environments.</p>
<p>Let&#8217;s first take a typical L.A.M.P setup:</p>
<p>PHP Compiled from source as apache module.<br />mySQL installed from RPM or update package (yum / up2date).<br />HTTPD installed as RPM or update package (yum / up2date).</p>
<p>Please note at the time of writing if you yum / apt-get / up2date install your PHP package you will have varying results when attempting to compile and install suPHP, as such grab the source code from php.net, and follow this series.</p>
<p>As a shared hosting provider lets say you have 5 clients all hosted from the one server, each client using vsftpd is chrooted() into their home directory, and their ssh access disabled, supposedly secure enough.</p>
<p>Unfortunatly not so, due to the L.A.M.P configuration the &#8216;apache&#8217; user needs a minimum of read and execute permissions over all the PHP files on the system, why is this a problem?</p>
<p>This is a problem largely due to human nature of the client, your &#8216;joe bloggs&#8217; client doesn&#8217;t care about the technical aspects of web hosting or websites, they just want an easy pretty interface to get their corner of the internet online, downloading something like drupal or joomla.</p>
<p>Now this isn&#8217;t a dig at open source CMS, this is an insight into human nature, look at the changelog for any open CMS and you will see &#8216;security fixes&#8217;, unfortunatly all &#8216;joe bloggs&#8217; cares about is that their website is working, and this is wher things take a turn for the worse.</p>
<p>Joe Bloggs never updates his open CMS platform, meaning any vulnerabilities patched in subsequent releases are still exploitable on his website, worst case scenario that this is an XSSI (Cross Server Script Includes) vulnerbility.</p>
<p>An attacker finds this website and idetifies the security hole, using XSSI to install a PHP interactive shell, giving the attacker SSH like access to the hosting environment, most people at this point think so the attacker has compromise one site &#8230; so what we can restore that site from backups and it&#8217;s only one site that&#8217;s affected, the other 4 users either do not use open CMS or are up to date with all the security patches.</p>
<p>Well that&#8217;s where you would be wrong, with the hosting setup outlined above the SSH like PHP shell is now running as the apache user, meaning the attacker can go anywhere and read anything apache can, and with the hosting setup oulined above that mean reading things like datbase connection files, suddenly all the clients on the hosting environment have their websites compromised as the attacker gains mySQL access and starts changing content on thewebsites, despite the fact that the other 4 sites themselves were never exploited.</p>
<p>One clients error just became a cascading exploit on your hosting platform, now make that a more realistic platform say 30 clients on the box, some are online shops, the issue just became a whole lot bigger there is lost revenue due to downtime of the shop sites, and worse still the attacker now has access to any customer details those shops were storing! but it&#8217;s not Joe Bloggs that&#8217;s accountable it&#8217;s YOU as the hosting provider, you can take steps to prevent one exploited site becoming 30, and this web series will tell you host to do it.</p>
<p>coming in part 2:</p>
<p>an introduction to suPHP<br />compiling php as a cgi binary, and why you need to do so</p>
<p><span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/security/the-zen-of-secured-shared-hosting-part-1" data-text="The zen of secured shared hosting part 1" href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Fsecurity%2Fthe-zen-of-secured-shared-hosting-part-1&#038;text=The%20zen%20of%20secured%20shared%20hosting%20part%201" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/security/the-zen-of-secured-shared-hosting-part-1/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Honeypotting for viruses &#8211; Statement of fees 2008/09</title>
		<link>http://www.saiweb.co.uk/security/honeypotting-for-viruses-statement-of-fees-200809</link>
		<comments>http://www.saiweb.co.uk/security/honeypotting-for-viruses-statement-of-fees-200809#comments</comments>
		<pubDate>Fri, 29 Aug 2008 08:23:08 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Microsoft Office 2003]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[Honey pot]]></category>
		<category><![CDATA[TROJ_AGENT.ANID]]></category>
		<category><![CDATA[TROJ_ZBOT.WB]]></category>
		<category><![CDATA[Virus]]></category>
		<category><![CDATA[WORM_SYSTEM.AA]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/security/honeypotting-for-viruses-statement-of-fees-200809</guid>
		<description><![CDATA[Getting this email on a regular basis? &#8220;Please find attached a statement of fees as requested, this will be posted today. The accommodation is dealt with by another section and I have passed your request on to them today. Kind regards. Hannah &#8221; Yes it is a virus the attached .doc.exe file seems to vary [...]]]></description>
			<content:encoded><![CDATA[<p>Getting this email on a regular basis?</p>
<p>&#8220;<em>Please find attached a statement of fees as requested, this will be<br />
posted today.</em></p>
<p><em>The accommodation is dealt with by another section and I have passed<br />
your request on to them today.</em></p>
<p><em>Kind regards.</em></p>
<p><em>Hannah </em>&#8221;</p>
<p>Yes it is a virus the attached .doc.exe file seems to vary daily in it&#8217;s choice of virus.</p>
<p>So far it has been:</p>
<p><a href="http://www.trendmicro.com/vinfo/virusencyclo/default5.asp?VName=TROJ_AGENT.ANID">TROJ_AGENT.ANID</a><br />
TROJ_ZBOT.WB (No page exists for this variant at the moment)<br />
<a href="http://www.trendmicro.com/vinfo/virusencyclo/default5.asp?VName=WORM_SYSTEM.AA">WORM_SYSTEM.AA</a></p>
<p>All 3 of which were not detected in the most uptodate pattern from trend, having to instead resort to their CPR release (Controlled Pattern), after emailing these samples to their labs (Another unknown variant was received today, and sent to Trend labs).</p>
<p>This brings into question the validity of &#8220;Honey pot&#8221; accounts to catch these viruses, the only reason I am able to attain these &#8220;samples&#8221; before they become a problem is due to the fact I have a &#8220;Honey pot&#8221; email account with a generic often spammed address format for this purpose.</p>
<p>This is making &#8220;Honey pots&#8221; more of a NEED now instead of an &#8220;Über Techies&#8221; box of tricks the end user is afraid to go within 30 meters of.</p>
<p>If you run a windows based network I suggest you do some research into how to setup a good honey pot (DO not use an account on your exchnage server that would be REALY stupid), you can also post a comment or use the contact for for advice.</p>
<p>Once setup make it part of your daily routine to test samples as they some in against your anti virus solution, making sure you know how to send samples to the providers labs for analysis.<span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/security/honeypotting-for-viruses-statement-of-fees-200809" data-text="Honeypotting for viruses &#8211; Statement of fees 2008/09" href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Fsecurity%2Fhoneypotting-for-viruses-statement-of-fees-200809&#038;text=Honeypotting%20for%20viruses%20%26%238211%3B%20Statement%20of%20fees%202008%2F09" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/security/honeypotting-for-viruses-statement-of-fees-200809/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Antivirus XP 2008 removal</title>
		<link>http://www.saiweb.co.uk/security/antivirus-xp-2008-removal</link>
		<comments>http://www.saiweb.co.uk/security/antivirus-xp-2008-removal#comments</comments>
		<pubDate>Tue, 05 Aug 2008 08:49:32 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[Antvirus XP 2008]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/security/antivirus-xp-2008-removal</guid>
		<description><![CDATA[Rarely has an adware / spyware given me cause to chuckle, this little sod sets the desktop background with a nice bright blue and yellow warning shouting &#8220;You have a virus&#8221; &#8230; and places a desktop shortcut to the offending program Antivirus XP 2008. On top of that in the case I am currently working [...]]]></description>
			<content:encoded><![CDATA[<p>Rarely has an adware / spyware given me cause to chuckle, this little sod sets the desktop background with a nice bright blue and yellow warning shouting &#8220;You have a virus&#8221; &#8230; and places a desktop shortcut to the offending program Antivirus XP 2008.</p>
<p>On top of that in the case I am currently working on it has set the local machines GPO to hide the &#8220;Desktop&#8221; tab in the desktop properties.</p>
<p>The idea behind this is shock fraud, upon running the program it will tell you the computer is infected with thousands of malware and viruses, which wont show up on any other anti virus product, leaving you with supposedly one option &#8230; to PAY for their software &#8230;</p>
<p>Yeh like hell &#8230;</p>
<p>Fortunately the guys over at <a href="http://www.bleepingcomputer.com">bleepingcomputer.com</a> are on top of things, and provide removal instructions for this fraudulent software.</p>
<p><a href="http://www.bleepingcomputer.com/malware-removal/remove-antivirus-xp-2008">http://www.bleepingcomputer.com/malware-removal/remove-antivirus-xp-2008</a></p>
<p>I&#8217;ll be intrested to see if their removal tool resets the GPO.</p>
<p><strong>UPDATE:</strong> Make sure after installing the malwarebytes&#8217; software that you first run an update before scanning.</p>
<p>As mentioned in the bleeping computer article, if your antvirus let this program in, in the first place it may be worth purchasing the pro version of Malwarebytes&#8217; to get the real time protection (NOTE: The freeware version will remove Antivirus XP 2008 regardless).</p>
<p>You can do this via with of the following links:</p>
<p><a href="https://www.cleverbridge.com/342/?affiliate=2235&#038;cart=29945&#038;scope=checkout">Saiweb Affiliate Link</a></p>
<p><a href="https://www.cleverbridge.com/342/?affiliate=1878&#038;cart=29945&#038;scope=checkout">Bleepingcomputer.com Affiliate Link</a></p>
<p><strong>UPDATE 2:</strong> Malwarebytes&#8217; removed Antivirus XP 2008, and restored the &#8220;display&#8221; tab, under desktop properties.</p>
<p><strong>*** DISCLAIMER ***</strong></p>
<p>As sad as it is, I have to include the following statement:</p>
<p>This information is provided as a self help guide only, by following the instructions provided you do so at your own risk.<span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/security/antivirus-xp-2008-removal" data-text="Antivirus XP 2008 removal" href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Fsecurity%2Fantivirus-xp-2008-removal&#038;text=Antivirus%20XP%202008%20removal" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/security/antivirus-xp-2008-removal/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CRYP_XED-3 Removal</title>
		<link>http://www.saiweb.co.uk/windows/cryp_xed-3-removal</link>
		<comments>http://www.saiweb.co.uk/windows/cryp_xed-3-removal#comments</comments>
		<pubDate>Mon, 12 May 2008 09:01:40 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[cryp_xed-3]]></category>
		<category><![CDATA[Virus]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/windows/cryp_xed-3-removal</guid>
		<description><![CDATA[Trend Micro Page After all the problems I had with Cryp-TAP-2 (here) I&#8217;m going strait for the COMBOFIX option! I&#8217;ll update with how I get on. UPDATE: Everything looks good so far, booted into safe mode, and ran combofix, the system is now rebooting normally, now waiting on the log report. UPDATE2: Combofix did the [...]]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript"><!--
google_ad_client = "pub-5002016982726982";
/* 468x60, created 09/04/08 */
google_ad_slot = "2202844884";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<p><a href="http://www.trendmicro.com/vinfo/virusencyclo/default5.asp?VName=CRYP_XED-3">Trend Micro Page</a></p>
<p><p>After all the problems I had with Cryp-TAP-2 (<a href="http://www.saiweb.co.uk/windows/cryp_tap-2-removal">here</a>) I&#8217;m going strait for the <a href="http://download.bleepingcomputer.com/sUBs/ComboFix.exe">COMBOFIX</a> option! I&#8217;ll update with how I get on.</p>
<p><strong>UPDATE:</strong> Everything looks good so far, booted into safe mode, and ran combofix, the system is now rebooting normally, now waiting on the log report.</p>
<p><strong>UPDATE2: </strong> Combofix did the job YET again! getting a popup or too still about the system restore volume, from the look of the report this little bugger hooks itself into system processes (explorer.exe svchost.exe)</p>
<p><span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/windows/cryp_xed-3-removal" data-text="CRYP_XED-3 Removal" href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Fwindows%2Fcryp_xed-3-removal&#038;text=CRYP_XED-3%20Removal" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/windows/cryp_xed-3-removal/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>vsftpd chrooting without the headache, allowing shared directories</title>
		<link>http://www.saiweb.co.uk/security/vsftpd-chrooting-without-the-headache-allowing-shared-directories</link>
		<comments>http://www.saiweb.co.uk/security/vsftpd-chrooting-without-the-headache-allowing-shared-directories#comments</comments>
		<pubDate>Mon, 14 Apr 2008 10:35:26 +0000</pubDate>
		<dc:creator>Buzz</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[chroot]]></category>
		<category><![CDATA[directories]]></category>
		<category><![CDATA[sahred]]></category>
		<category><![CDATA[vsftpd]]></category>

		<guid isPermaLink="false">http://www.saiweb.co.uk/?p=36</guid>
		<description><![CDATA[// // // ]]&#62; Chroot&#8217;ing a user is always a good idea from a security perspective, but by default it leaves usability lacking. For example a web development department quite rightly is using individual logins, with each developer able to access each of their site directories, in a non chroot environment. The downside? the can [...]]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript">// <![CDATA[
google_ad_client = "pub-5002016982726982";
/* 468x60, created 09/04/08 */
google_ad_slot = "2202844884";
google_ad_width = 468;
google_ad_height = 60;
// ]]&gt;</script></p>
<p><script type="text/javascript">// <![CDATA[
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
// ]]&gt;</script></p>
<p>Chroot&#8217;ing a user is always a good idea from a security perspective, but by default it leaves usability lacking.</p>
<p>For example a web development department quite rightly is using individual logins, with each developer able to access each of their site directories, in a non chroot environment.</p>
<p>The downside? the can also browse pretty much the entire server, and each others directories &#8230;</p>
<p>So rather than some extensive and long winded chmoding or directories, we need to chroot them and still preserve access to the shared directories &#8230;</p>
<p>But how?</p>
<p>In this case the shared resource will be /home/shared</p>
<p>First of all for security and chrooting purposes make the following changes to /etc/vsftpd/vsftpd.conf</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">anonymous_enable</span>=NO<br />
<span style="color: #007800;">chroot_local_user</span>=YES</div></td></tr></tbody></table></div>
<p>Now reload vsftpd: /etc/init.d/vsftpd</p>
<p>Create a test user (in this case buzz):</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">useradd buzz <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>buzz<br />
<span style="color: #c20cb9; font-weight: bold;">passwd</span> buzz</div></td></tr></tbody></table></div>
<p>Remove the user&#8217;s shell access (and subsequently sftp/scp) by editing /etc/pass wd (remove the space between pass wd, wordpress is breaking when I try to post it properly)</p>
<p>replace</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">buzz:x:123:123::/home/buzz:/bin/bash</div></td></tr></tbody></table></div>
<p>with</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">buzz:x:123:123::/home/buzz:/sbin/nologin</div></td></tr></tbody></table></div>
<p>Test the FTP session:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>buzz ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #c20cb9; font-weight: bold;">ftp</span> xxx.xxx.xxx.xxx<br />
Connected to xxx.xxx.xxx.xxx.<br />
<span style="color: #000000;">220</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>vsFTPd 2.0.1<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #000000;">530</span> Please <span style="color: #c20cb9; font-weight: bold;">login</span> with USER and PASS.<br />
<span style="color: #000000;">530</span> Please <span style="color: #c20cb9; font-weight: bold;">login</span> with USER and PASS.<br />
KERBEROS_V4 rejected <span style="color: #c20cb9; font-weight: bold;">as</span> an authentication <span style="color: #7a0874; font-weight: bold;">type</span><br />
Name <span style="color: #7a0874; font-weight: bold;">&#40;</span>xxx.xxx.xxx.xxx:buzz<span style="color: #7a0874; font-weight: bold;">&#41;</span>: buzz<br />
<span style="color: #000000;">331</span> Please specify the password.<br />
Password:<br />
<span style="color: #000000;">230</span> Login successful.<br />
Remote system <span style="color: #7a0874; font-weight: bold;">type</span> is UNIX.<br />
Using binary mode to transfer files.<br />
<span style="color: #c20cb9; font-weight: bold;">ftp</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #c20cb9; font-weight: bold;">ls</span><br />
<span style="color: #000000;">227</span> Entering Passive Mode <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">10</span>,<span style="color: #000000;">99</span>,<span style="color: #000000;">1</span>,<span style="color: #000000;">1</span>,<span style="color: #000000;">123</span>,<span style="color: #000000;">97</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #000000;">150</span> Here comes the directory listing.<br />
drwxrwxr-- <span style="color: #000000;">4</span> <span style="color: #000000;">48</span> <span style="color: #000000;">48</span> <span style="color: #000000;">4096</span> Mar <span style="color: #000000;">27</span> <span style="color: #000000;">15</span>:00 www<br />
<span style="color: #000000;">226</span> Directory send OK.<br />
<span style="color: #c20cb9; font-weight: bold;">ftp</span><span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>shared<br />
<span style="color: #000000;">550</span> Failed to change directory.<br />
<span style="color: #c20cb9; font-weight: bold;">ftp</span><span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #7a0874; font-weight: bold;">cd</span> .<span style="color: #000000; font-weight: bold;">/</span>www<br />
<span style="color: #000000;">550</span> Failed to change directory.<br />
<span style="color: #c20cb9; font-weight: bold;">ftp</span><span style="color: #000000; font-weight: bold;">&gt;</span> quit<br />
<span style="color: #000000;">221</span> Goodbye.</div></td></tr></tbody></table></div>
<p>In the example above <strong>www</strong> is a symlink to <strong>/home/shared</strong>, as can be seen symlinking does not bypass the chroot settings.</p>
<p>What you need to do is use the &#8220;bind&#8221; option of the mount command (as root or a sudo&#8217;er):</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>buzz<span style="color: #000000; font-weight: bold;">/</span>shared<br />
<span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #660033;">--bind</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>shared <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>buzz<span style="color: #000000; font-weight: bold;">/</span>shared</div></td></tr></tbody></table></div>
<p><strong>NOTE: &#8211;bind is double dash bind</strong><br />
<strong>NOTE: to reverse the bind (i.e. if you bind the wrong folder) umount /path/to/binded/folder</strong></p>
<p>Now re-test the ftp session:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">ftp</span> xxx.xxx.xxx.xxx<br />
Connected to xxx.xxx.xxx.xxx.<br />
<span style="color: #000000;">220</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>vsFTPd 2.0.1<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #000000;">530</span> Please <span style="color: #c20cb9; font-weight: bold;">login</span> with USER and PASS.<br />
<span style="color: #000000;">530</span> Please <span style="color: #c20cb9; font-weight: bold;">login</span> with USER and PASS.<br />
KERBEROS_V4 rejected <span style="color: #c20cb9; font-weight: bold;">as</span> an authentication <span style="color: #7a0874; font-weight: bold;">type</span><br />
Name <span style="color: #7a0874; font-weight: bold;">&#40;</span>xxx.xxx.xxx.xxx:buzz<span style="color: #7a0874; font-weight: bold;">&#41;</span>: buzz<br />
<span style="color: #000000;">331</span> Please specify the password.<br />
Password:<br />
<span style="color: #000000;">230</span> Login successful.<br />
Remote system <span style="color: #7a0874; font-weight: bold;">type</span> is UNIX.<br />
Using binary mode to transfer files.<br />
<span style="color: #c20cb9; font-weight: bold;">ftp</span><span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #c20cb9; font-weight: bold;">ls</span><br />
<span style="color: #000000;">227</span> Entering Passive Mode <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">10</span>,<span style="color: #000000;">99</span>,<span style="color: #000000;">1</span>,<span style="color: #000000;">1</span>,<span style="color: #000000;">123</span>,<span style="color: #000000;">97</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #000000;">150</span> Here comes the directory listing.<br />
drwxrwxr-- <span style="color: #000000;">4</span> <span style="color: #000000;">48</span> <span style="color: #000000;">48</span> <span style="color: #000000;">4096</span> Mar <span style="color: #000000;">27</span> <span style="color: #000000;">15</span>:00 www<br />
drwxrwxr-- <span style="color: #000000;">4</span> <span style="color: #000000;">48</span> <span style="color: #000000;">48</span> <span style="color: #000000;">4096</span> Mar <span style="color: #000000;">27</span> <span style="color: #000000;">15</span>:<span style="color: #000000;">12</span> shared<br />
<span style="color: #000000;">226</span> Directory send OK.<br />
<span style="color: #c20cb9; font-weight: bold;">ftp</span><span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>shared<br />
<span style="color: #000000;">550</span> Failed to change directory.<br />
<span style="color: #c20cb9; font-weight: bold;">ftp</span><span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #7a0874; font-weight: bold;">cd</span> .<span style="color: #000000; font-weight: bold;">/</span>www<br />
<span style="color: #000000;">550</span> Failed to change directory.<br />
<span style="color: #c20cb9; font-weight: bold;">ftp</span><span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #7a0874; font-weight: bold;">cd</span> .<span style="color: #000000; font-weight: bold;">/</span>shared<br />
<span style="color: #000000;">250</span> Directory successfully changed.<br />
<span style="color: #c20cb9; font-weight: bold;">ftp</span><span style="color: #000000; font-weight: bold;">&gt;</span> quit<br />
<span style="color: #000000;">221</span> Goodbye.</div></td></tr></tbody></table></div>
<p>The user now is in a chroot&#8217;ed environment, but can still access the share resources you specify, by binding them.</p>
<p><strong>FAQ:</strong></p>
<p><em>Why remove the users SSH / SCP access?</em></p>
<p>SCP/SFTP at the time of writing has no logging facility, making it next to impossible to find out who uploaded / overwrote a file in the shared resource at any given time. </p>
<p>(UPDATE 19/07/2010: <a href="http://www.saiweb.co.uk/linux/enable-logging-in-the-sftp-subsystem">http://www.saiweb.co.uk/linux/enable-logging-in-the-sftp-subsystem</a>)</p>
<p>By forcing FTP all transactions will appear in the xfer log.</p>
<p>There are mods for SCP out there to allow logging, however you can use them at your own risk I do not recommend using them on a customer facing environment.</p>
<p><em>Why would I want to &#8220;chroot&#8221; the user?</em></p>
<p>Change</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">chroot_local_user=YES</div></td></tr></tbody></table></div>
<p>to</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">chroot_local_user=NO</div></td></tr></tbody></table></div>
<p>and reload vsftpd, now login to ftp hand try to get out of your home directory,</p>
<p>you will notice you can pretty much browse the entire file system, and depending on the setup write and delete files owned by anyone in the same group as that user.</p>
<p>By chroot&#8217;ing the user you are reducing the potential for things to go wrong on your server, as you add more and more users it reduces the &#8220;sys admin&#8221; time incurred due to user error.</p>
<p>NOTE: Remember to put</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">chroot_local_user=YES</div></td></tr></tbody></table></div>
<p>back and reload vsftpd!</p>
<p><strong>Disclaimer:</strong></p>
<p>You break it, it&#8217;s not my fault!</p>
<p>If you run into problems just leave a comment.</p>
<p><script type="text/javascript">// <![CDATA[
google_ad_client = "pub-5002016982726982";
/* 468x60, created 09/04/08 */
google_ad_slot = "2202844884";
google_ad_width = 468;
google_ad_height = 60;
// ]]&gt;</script></p>
<p><script type="text/javascript">// <![CDATA[
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
// ]]&gt;</script><span style="float: left;" ><a class="twitter-share-button"  data-via="Saiweb" data-count="horizontal" data-related="Saiweb:David Busby" data-lang="en" data-url="http://www.saiweb.co.uk/security/vsftpd-chrooting-without-the-headache-allowing-shared-directories" data-text="vsftpd chrooting without the headache, allowing shared directories" href="http://twitter.com/share?via=Saiweb&#038;count=horizontal&#038;related=Saiweb%3ADavid%20Busby&#038;lang=en&#038;url=http%3A%2F%2Fwww.saiweb.co.uk%2Fsecurity%2Fvsftpd-chrooting-without-the-headache-allowing-shared-directories&#038;text=vsftpd%20chrooting%20without%20the%20headache%2C%20allowing%20shared%20directories" >Tweet</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saiweb.co.uk/security/vsftpd-chrooting-without-the-headache-allowing-shared-directories/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using apc
Database Caching 21/64 queries in 0.137 seconds using apc
Object Caching 2188/2305 objects using apc
Content Delivery Network via Rackspace Cloud Files: cdn.saiweb.co.uk

Served from: www.saiweb.co.uk @ 2012-02-08 16:34:57 -->
