Contributions

Other (Category Index)
Search: 

Sam's Anti-hacker Account Mods

Secure your account pages against code/SQL injection attempts, yet allow strong passwords.

There are many instances now of websites being hacked (or cracked to use the correct term) and it is necessary to make your site as secure as possible, one important measure in this is to sanitize all visitor inputs to ensure no code injection etc. attempt can work.

However this creates an issue, if your user creates a strong password by using characters that are likely to be 'cleaned' either their password will not work, or the account gets a password that is different to what was input (as it was 'sanitized'). This is especially an issue if adding input sanitizing to an old site where visitors have added passwords that are now 'illegal'.

This contribution resolves this issue by safely allowing any character to be used within the password, it does this by processing all password inputs before anything else, passwords are translated to hex values, the inputs validated then deleted as no longer required (only the hex strings are processed further). An option is provided to allow string to be reverse translated at the point of password checking to ensure existing passwords will work. This means the passwords now stored in the dBase are salted hashes of the hex string. Once the initial processing is done, all inputs are sanitized.

Other account fields are also subject to additional checks or the input converted:

The date of birth field is now a drop down which automatically formats according to the store country, this ensures the format is correct, slashes (/) can still be sanitized and the visitor cannot transpose days & months.
The telephone field is checked its numeric (if entered) and contains only limited allowed chars.
The post code field is checked for the correct format, but only for UK & USA sites.
If strong password is enabled, password forgotten will generate strong passwords.
The State/Province/County: field is pre-filled with the zones for the store country, rather than a blank field that gets populated on submit!
The Country drop down is pre-selected to the store country.
All input fields are sanitized.

Tested on PHP 4 & 5, SQL 4 & 5, osC 2.2 ms2, rc1 & rc2a and is register_globals off compatible.

FULL PACKAGE

Expand All / Collapse All

Sam's Anti-hacker Account Mods V1.6 7 Mar 2010

Added code to redirect visitor to checkout on login if items in cart, as per account create completion.
Added extra dob validation check to fix PCI scan issue.
Updated some code to resolve notice issues.
Added code for cleaning post in product_reviews_write.php
Added code for cleaning post in tell_a_friend.php
Added code to allow editing of current selected shipping/payment address within checkout.
Addes code to allow repositioning of phone fields in create account &/or removal of fax field.

Changed files:

account_secure.php, login.php, create_account.php, checkout_shipping_address.php, checkout_payment_address.php, account_edit.php, validate_name_fields.php


Support thread will be found at http://forums.oscommerce.com/index.php?showtopic=352361

Tested on PHP 4 & 5, SQL 4 & 5, osC 2.2 ms2, rc1 & rc2a and is register_globals off compatible.

FULL PACKAGE

Sam's Anti-hacker Account Mods V1.5 23 Feb 2010
Sam's Anti-hacker Account Mods V1.4 9 Feb 2010
Sam's Anti-hacker Account Mods V1.3 3 Feb 2010
Sam's Anti-hacker Account Mods V1.2 28 Jan 2010
Sam's Anti-hacker Account Mods V1.1 24 Jan 2010
Sam's Anti-hacker Account Mods 18 Jan 2010

Note: Contributions are used at own risk.