Ruby on Rails 内部是否使用 MD5 加密哈希函数(特别是针对 session )?
Ruby on Rails Security Guide指出:
The session id is a 32 byte long MD5 hash value. A session id consists of the hash value of a random string. The random string is the current time, a random number between 0 and 1, the process id number of the Ruby interpreter (also basically a random number) and a constant string. Currently it is not feasible to brute-force Rails' session ids. To date MD5 is uncompromised, but there have been collisions, so it is theoretically possible to create another input text with the same hash value. But this has had no security impact to date.
然而,众所周知,MD5 确实已被泄露。例如。 Wikipedia:MD5状态:
The security of the MD5 hash function is severely compromised. A collision attack exists that can find collisions within seconds ...
我是不是理解错了,还是RailsGuides事实上只是 Rails 的 w3schools?
最佳答案
请注意,本指南的这一部分已在 https://github.com/rails/rails/pull/25035 中更新。之后https://github.com/rails/rails/issues/25032已被举报。
该指南的一些内容已经过时了(例如,xss 部分没有跟上这样的事实,即 Rails 认为所有字符串都需要转义,除非另有说明)——它肯定需要一些爱。看起来至少自 2009 年以来该部分就没有被触及过
Rails 已经很长时间没有使用您描述的方法来生成 session id 了。如果我正确地读取了 rune ,从 Rails 2.3 开始, session id 是使用 SecureRandom 生成的,它提供了加密安全的随机数(使用 1.8.7 上的 Ruby 内置支持,或者使用特定于平台的方法,例如如 openssl、/dev/urandom、win32 api)
此外,从rails 2.0开始,默认的 session 存储一直是cookie存储,它首先不使用 session id(或者更确切地说, session cookie的值是 session ,而不是比用于从其他地方读取 session 的 key )
关于ruby-on-rails - Rails 是否使用(受损的)MD5 进行 session ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25588133/