zhouzhongyuan / qa

Questions recods
MIT License
5 stars 1 forks source link

登录的原理详解 #3

Open zhouzhongyuan opened 7 years ago

zhouzhongyuan commented 7 years ago

.

zhouzhongyuan commented 7 years ago

regenerate session

为什么需要验证帐号密码匹配之后,要regenerate session呢?

为了更安全。

不regenerate会有什么影响?

可能会遭受session hijacking 和 session fixation攻击。

session hijacking是什么?

From this Security.SE answer: Session hijacking refers to stealing the session cookie. This can be most easily accomplished when sharing a local network with other computers. E.g. at Starbucks. Example... a user with session Y is browsing James's website at Starbucks. I am listening in on their network traffic, sipping my latte. I take user with session Y's cookies for James's website and set my browser to use them. Now when I access James's site, James's site.

session fixation是什么?

From this webpage: Session Fixation is an attack technique that forces a user's session ID to an explicit value. Depending on the functionality of the target web site, a number of techniques can be utilized to "fix" the session ID value. These techniques range from Cross-site Scripting exploits to peppering the web site with previously made HTTP requests. After a user's session ID has been fixed, the attacker will wait for that user to login. Once the user does so, the attacker uses the predefined session ID value to assume the same online identity.

怎么发动session fixation攻击呢?

zhouzhongyuan commented 7 years ago

http协议是『无状态』的,这句话什么意思?(stateless)

无状态是指协议对于事务处理没有记忆能力,服务器不知道客户端是什么状态。即我们给服务器发送 HTTP 请求之后,服务器根据请求,会给我们发送数据过来,但是,发送完,不会记录任何信息。

什么协议是『有状态』的?(stateful)

TCP协议。 TCP是有状态的,它通过包头中的一些控制字段(序列编码等)来表明各个包之间的关系(前后关系,重包与否等等)。所以,通过这个协议你可以做到一个可靠的传输。那么TCP是面向连接的协议是什么意思呢?其实这里的面向连接其实就是“三次握手”。三次握手,首先可以保证对方的存在,其次握手的所交换的内容是为将来进行有状态的传输做准备。

zhouzhongyuan commented 5 years ago

Cookies