I am co-developing a simple web app in Rails 3.0.9 and I have realized that there is a possible session_id tampering possible via malicious request. Mind the fact, that this is my first RoR application, so I could be totally wrong in my conceptions.
Current application functionality requires sessions so I turned to ActiveRecordStore session storage, installed it and started testing in primitive workflows. I noticed that Rails framework creates cookie with the name _session_id
and value of some random hash-like string (in DB SESSION table this string corresponds to session_id
column).
If that value in the cookie is changed, for example with Firebug, current session id changes to one provided with cookie's data (inspected with request.session_options[:id]
), and the change is propagated to the database table, creating new session record with aforementioned parameters.
While this brings no implications on a variables of the session, the session id have deviated from its usual hash-like appearance to a user tampered one.
Here is the question - how this behavior can be detected or preferably prevented?