What is sent to the client is a session identifier, not a session variable. These session identifiers are usually set as cookies in the client. Of course, if someone receives a session identifier (for example, using a cross-site scripting attack) from a user's browser or client, he can set the session identifier in his own client and impersonate another user.
However, session variables usually refer to values ββin the $_SESSION
. See http://www.php.net/manual/en/function.session-start.php for an example. These values ββare never sent over the network to the client.
Regarding the protection of session identifiers, I already explained in the first paragraph that they are stored as cookies in the browser. In an HTTP session, cookies are transmitted between the server and the client in clear text. This is vulnerable to eavesdropping (for example, the guy on the router through which your packets go through can grab your packets and read the session identifier from it). The best way to solve this problem is to use HTTPS instead.
source share