UK WEB HOSTING FORUM FOR DISCUSSION ON WEB HOSTING SERVICE AND SUPPORT
LINUX HOSTING WINDOWS HOSTING PACKAGES SHOPPING CART OSCOMMERCE ZEN CART AGORA
ECOMMERCE HOSTING ASP MSSQL FRONTPAGE HOSTING PHP MYSQL HOSTING DISCUSSION FORUM
CPANEL RESELLER HOSTING DEDICATED SERVER VPS HOSTING PLESK VIRTUOZZO
Quick Search
Your forum announcement here!

  UK Web Hosting | Dedicated Server Windows and Linux VPS Forum > Web Hosting and Domains > PHP Hosting

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 19-10-2006, 08:07
Member
 
Join Date: Nov 2005
Posts: 56
Default PHP/MySQL Issue - Be Aware of this

Hello,

We have come across an issue using PHP/MySQL that most people may not be aware of.

When a user fills in a php form on a website, they can add some javascript code in a field and save the form. If this code is not converted/encoded and neutralised before it is saved, then when the data is viewed, it can execute and cause a real nuisance.

Unfortunately we had found this when it was too late.

This is just a consideration to bear in mind when building forms.

Cheers,
__________________
LD
------------------------------------------------------
Webmaster of DeanRichardson.Com
Web: http://www.deanrichardson.com/
Forum: http://www.deanrichardson.com/forum/
!!! AVE IT !!!
Reply With Quote
  #2 (permalink)  
Old 19-10-2006, 12:13
Member
 
Join Date: Oct 2006
Location: Nieuwkerken-Waas; Flanders
Posts: 32
Default

You always have to check data from POST or GET values (and initialise all variables that you use when php_register_globals is on). Otherwise, SQL injections is possible.
__________________
Êl síla nan lû e-govaded vín!
Reply With Quote
  #3 (permalink)  
Old 19-10-2006, 19:27
Member
 
Join Date: Nov 2005
Posts: 56
Default

Yep. I didn't realise that. Luckily it wasn't a major attack we had, but it left us scratching our heads for a while.

The attack had a prompt which wasn't the most pleasant of prompts )

But, you learn from your mistakes i suppose.

I've also found the value of MD5 encryption for any data in the GET headers.
__________________
LD
------------------------------------------------------
Webmaster of DeanRichardson.Com
Web: http://www.deanrichardson.com/
Forum: http://www.deanrichardson.com/forum/
!!! AVE IT !!!
Reply With Quote
  #4 (permalink)  
Old 20-10-2006, 10:00
Premium Member
 
Join Date: Sep 2006
Posts: 80
Default

The general rule when desiging web stuff is never trust data where you cant verfy the source

there are plenty of ways around it strip_tags() is one of them to dump all HTML etc and another is entity_encode.

If someone for example puts ">mwahahahahaha into a textbox or </table></html> HAHAHAHA or whatever it can seriously break the page viewing it
Reply With Quote
  #5 (permalink)  
Old 30-10-2006, 08:20
Member
 
Join Date: Oct 2006
Location: Nieuwkerken-Waas; Flanders
Posts: 32
Default

Quote:
Originally Posted by ledeanio View Post
I've also found the value of MD5 encryption for any data in the GET headers.
You should not encode data stored in a database (except for data that should be encoded, like passwords etc.). If you read the database from e.g. phpMyAdmin, you should see the data as it is (so no encoded data, no slashed data,etc.).
__________________
Êl síla nan lû e-govaded vín!
Reply With Quote
  #6 (permalink)  
Old 31-10-2006, 10:53
Premium Member
 
Join Date: Sep 2006
Posts: 80
Default

There is no such thing as "MD5 Encryption" if you take a 4GIG file and run it though MD5 you will get a 32byte string that is HASHING not Encryption.

It is also non reversible you cannot take a MD5 string and reverse MD5 it into the original plain text its a 1 way hashing algorithm which is why its so popular for use in passwords. You cant "MD5" the HTTP headers for a start it would require the users browser to send you the data in MD5 and even if it did you wouldn't be able to go back to the original value and it would NOT fix the problem at hand it would still store and execute the JavaScript.
Reply With Quote
  #7 (permalink)  
Old 01-11-2006, 11:43
Member
 
Join Date: Nov 2005
Posts: 56
Default

I meant hashing sorry. We've now started to look into SHA-1 as a way to disguise passwords etc. I should have paid more attention in my Computer Security course as I would then know about SHA-1.
__________________
LD
------------------------------------------------------
Webmaster of DeanRichardson.Com
Web: http://www.deanrichardson.com/
Forum: http://www.deanrichardson.com/forum/
!!! AVE IT !!!
Reply With Quote
  #8 (permalink)  
Old 06-11-2006, 16:26
Premium Member
 
Join Date: Sep 2006
Posts: 80
Default

SHA-1 is slowly replacing MD5 personally I havent had any problems with MD5 there are a few weeknesses but this will always be the issue with hashing algorithms its very unlikly there going to be able to break a md5 password.

I will prob start switching over now the functions are there in PHP.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 01:08.

 

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by Web Hosting 3.1.0
Copyright © 2001-2008, eUKhost.com. All rights reserved.

 
Site Map

knowledgebase articles

popular blog categories