PHP Session Fixation / Hijacking

前端 未结 5 1183
闹比i
闹比i 2020-11-22 06:19

I\'m trying to understand more about PHP Session Fixation and hijacking and how to prevent these problems. I\'ve been reading the following two articles on Chris Shiflett\'s

5条回答
  •  死守一世寂寞
    2020-11-22 06:34

    The tokens you mention are a "nonce" - number used once. They don't necessarily have to be used only once, but the longer they're used, the higher the odds that the nonce can be captured and used to hijack the session.

    Another drawback to nonces is that it's very hard to build a system that uses them and allows multiple parallel windows on the same form. e.g. the user opens two windows on a forum, and starts working on two posts:

    window 'A' loads first and gets nonce 'P'
    window 'B' loads second and gets nonce 'Q'
    

    If you have no way of tracking multiple windows, you'll only have stored one nonce - that of window B/Q. When the user then submits their post from window A and passes in nonce 'P', ths system will reject the post as P != Q.

提交回复
热议问题