I want to securely process a form data in a php project.
I found that it can be done in either with
current time based tokens
orsession based tokens
I want maximum security. Which of this strategy is good?
I want to securely process a form data in a php project.
I found that it can be done in either with
current time based tokens
orsession based tokens
I want maximum security. Which of this strategy is good?
You definitely don't want to use a token based purely on the current time (option 1). If everyone sees the same token, it's trivial for an attacker to request the "current" token himself (e.g., through his own server) and add use it in a CSRF attack.
Option 2 can't be attacked this way, since the attacker would need to be in the same session (however that's implemented) in order to get the right token.