TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 12-11-2008, 05:56 AM   #1 (permalink)
The Wanderer
 
kokjj87's Avatar
 
Join Date: Oct 2008
Posts: 18
Thanks: 0
kokjj87 is on a distinguished road
Default Security Token?

Hi, i am trying to come up with a security token system for all my
form, normal approach would be setting a token and put it in to the
session whenerever the user request a new page.

$_SESSION['token'] = random string here.

The problem is, the string would be overwritten everytime when a user
request a new page.
But it is common now for people to open up a few tab for a website.
And it would cause the token to expire, and cause the last few tabs
you open to fail the security token check.

Is there a better soultion?
kokjj87 is offline  
Reply With Quote
Old 12-11-2008, 06:57 AM   #2 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

I have no idea, but how about:
PHP Code:
if($_SESSION['token'] == '')
{
       
$_SESSION['token'] = 'random string';

that way, the token is only generated if the user don't already have a token.
But I'm not sure if this would actually work as a security then.
__________________
Tanax is offline  
Reply With Quote
Old 12-11-2008, 08:01 AM   #3 (permalink)
The Wanderer
 
kokjj87's Avatar
 
Join Date: Oct 2008
Posts: 18
Thanks: 0
kokjj87 is on a distinguished road
Default

Maybe i can add a timer for my session...

$_SESSION['token_created_time'] = //time of the token created

and check on the request, and update the token value, in about every 20minutes.
But still worried that people visit the page on the 19th minutes, and they will have trouble with the token.

I am still trying to think of a more complex way, maybe store a array of the last few tokens in the session? and they are allow to by pass the security check?

Any comment would be greatly appreciate.
kokjj87 is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Several Questions - Security and Performance Killswitch General 0 12-09-2008 03:10 AM
Security Article / Tutorial on PHPFreaks.com drewbee General 0 07-03-2008 04:36 PM
security Evulness Advanced PHP Programming 2 04-17-2008 02:15 AM
security section (xss,injection,etc) sarmenhb Feedback 2 01-29-2008 08:06 PM
Tips: PHP security Village Idiot Tips & Tricks 22 11-23-2007 11:17 PM


All times are GMT. The time now is 12:30 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design