Reputation: 205
So the sessions are getting stored server-side, which means the client can't edit them. On the client side the cookie gets stored and save an id to find the right session.
Now my question is. Can a random user edit his own cookie, and then enter Eg. an admin's session?
Upvotes: 0
Views: 84
Reputation: 13024
Yes, a malicious user could modify their session id (in their local cookie) and impersonate another user to hijack their session. This is unsurprisingly called Session Hijacking.
But it is extremely unlikely an attacker could guess the correct session id. They would need to employ techniques to steal the session id from their victim.
An example of the default PHP session id cookie:
Upvotes: 1
Reputation: 71422
In most scenarios, the data in the session is itself secure against user tampering as it is only manipulated on the server (this assumes the server itself is secure). So there is no reason to treat the data stored in session as "dirty" as far as needing to cleanse/validate it.
The session itself is not inherently secure whether it is being propagated via cookies or via URL parameter. It can be impersonated via a session hijacking attack. There are a number of common techniques to prevent against this, including:
Upvotes: 2
Reputation: 146630
Some general rules:
As a result:
There're two main dangers regarding cookies:
admin=1
and actually use the value to validate as adminUpvotes: 0