Session Management More
Session Management More
& MORE
Dr. Koyel Datta Gupta
Sessions
A sequence of requests and responses from
one browser to one (or more) sites
Session can be long or short
Without session management:
Users would have to constantly re-authenticate
Session management:
Authorize user once
All subsequent requests are tied to user
Pre-history: HTTP auth
HTTP auth problems
Hardly used in commercial sites
Easily spoofed
Session tokens
Storing session tokens:
Browser cookie:
Set-Cookie: SessionToken=fduhye63sfdb
SessionToken=kh7y3b
In a hidden form field:
<input type=“hidden” name=“sessionid”
value=“kh7y3b”>
PROBLEM
Storing session tokens: problems
Browser cookie:
browser sends cookie with every request, even
when it should not
Embed in all URL links:
token leaks via HTTP Referer header
In a hidden form field: short sessions only
Active and Passive Attack
Scenarios
Session Hijacking
Eavesdropping
Session Fixation
Cross-Site Scripting
Exhaustive Search
Intelligent Manipulation of Session Data
Network Manipulation (e.g. change of DNS
entries)
etc.
URL-based Solutions
The session token is part of the URL and will be transmitted to
the web server through HTTP GET requests
Example: http://www.blabla.com/buy.asp?
article=27781;sessionid=IE5579901578
This mechanism works even in case of user client security
restrictions (if, for example, no cookies are allowed). Thus, it
can serve as a fallback mechanism if the server detects
problems with other mechanisms like cookies or JavaScript
Problems:
All information contained in the URL might be stored in firewall
or proxy log files
Also, it could simply be printed out with the web page on a
shared printer
Moreover, the URL, including potentially sensitive data, can be
sent in the HTTP referrer field to other web servers. This
implies a high risk of sensitive session data being disclosed to
Form-based Solutions with Hidden
Fields
Session token and information can be included in so-called
hidden fields in a form
The form will be sent by the user client to the server with an
HTTP POST command. This looks like the following example:
<FORM METHOD=POST ACTION=”/cgi-bin/order_goods.pl”>
<INPUT TYPE=”hidden” NAME=”customerid” VALUE=”0815”>
<INPUT TYPE=”hidden” NAME=”valid_order” VALUE=”yes”>
<INPUT TYPE=”hidden” NAME=”productid” VALUE=”4711”>
As described in the case of URL-encoded session tokens, this
form-based mechanism works even in case of user client
security restrictions (if, for example, no cookies are allowed).
Thus, it can serve as a fallback mechanism if the server detects
problems with other mechanisms like cookies or JavaScript
The form-based solution does not provide pre-defined
protection mechanisms as those provided by cookies, for
example
Moreover, the form-based approach requires repeated sending
of HTTP forms via POST commands, which implies a certain
amount of overhead that might reduce performance. Also,
HTTP Basic and/or Digest
Authentication-based Solutions
In HTTP Basic authentication, the client sends his username
and password in cleartext as part of the HTTP request
In all subsequent HTTP requests for content from
subdirectories of the original request, these credentials will be
automatically resent
In HTTP Digest authentication, no passwords are sent in the
clear
Instead, a cryptographic hash value containing the username,
password, and additional security-relevant data, will be
transmitted from the client to the server (more details can be
found in RFC2617 - HTTP Authentication: Basic and Digest
Access Authentication, June 1999)
Problems:
HTTP Basic authentication is vulnerable to passive
eavesdropping. Moreover, it provides no mechanism for
explicit session expiration (i.e. logout)
HTTP Digest authentication cannot guarantee sufficient
support on all client platforms
Cookie-based Solutions
Cookies are a simple session management mechanism