Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. CODo you think I should do this in combination with a regular session regeneration and a token or drop the other two and just compare IPs? I suppose the current token does cover this though, since it's salted with the IP of the user trying to gain access. That is to say, spoofing the token of a valid user wouldn't do any good unless you share an IP -- right?
      singulars
    2. CODefinitely not in combination. Session regeneration doesn't gain you much in terms of security, but feel free to use it for other purposes. As for the token, a hijacker could generate their own if they could work out the salt (which makes it less salt and more a secret key) rather than stealing the target's token. Considering that data from the client isn't trustworthy and that the main point of sessions is the only thing you need to store on the client is a session ID, drop any scheme that stores data on the client. Server side, the IP (and date) isn't secret, so a hash isn't needed.
      singulars
    3. COBe wary of CSRF using this technique. This alone doesn't verify the user's intent, only that they are logged in. An attacker could con them into clicking a link that leads to the action of one of your forms, such as creating a new admin user with the attackers credentials. To prevent that, use your technique in the question to create a hash and add that to the action of the form (and to the session), then compare on the opposite end. Only perform the action if the two values match, meaning the user that clicked on to the action was the same as generated the form in the first place.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload