Attacking Session Management Juliette Lessing
Attacking Session Management Juliette Lessing
Attacking Session Management Juliette Lessing
Juliette Lessing
Session management
Encountered defects.
Two types of weaknesses
But actually:
Meaningful tokens (2)
Exhibit some structure allowing an attacker
to understand their function and means of
generation.
Components:
User name
E-mail address
Clients IP address
Meaningful tokens (3)
Hack steps:
Obtain single token from the application, modify it to determine validity. Change tokens
value one byte at a time and check whether application is still accepted. Are some
portions not required to be correct, exlude them.
Log in as several different users at different times and record the tokens received from the
server.
Analyze the tokens for any correlations that appear to be related to the username and
other user-controllable data.
If any meaning can be reverse engineered from the sample of session tokens, guess the
tokens, find a page of the application that is session-dependent, and make large numbers
of requests to this page using these guessed tokens. Monitor the results for any cases
where the page is loaded correctly, indicating a valid session token.
Weaknesses in Session Token
Generation
Predictable tokens (1)
Contain sequences or patterns
Arise from 3 different sources:
1. Concealed sequences
2. Time dependency
3. Weak random number generation
Predictable tokens (2)
1. Concealed sequences
Predictable tokens (2)
2. Time dependency Attack:
Start polling the server to obtain new session tokens in quick
succession
Monitor the increments in the first number. Increases more
than one? Token has been issued by another user
We know upper and lower bounds of second number which
was issued to them
brute-force attacks in order to successfully access a
protected page
Running this scripted attack continuously will enable us to
capture the session token of every other application user.
When an administrative user logs in, we will fully
compromise the entire application.
Predictable tokens (3)
3. Weak random number generation
Hack steps:
Walk through application in normal way and identify login functions and transitions
between HTTP and HTTPS communications
Are HTTP cookies used as transmission mechanism? Verify whether secure flag is
set
Verify whether a new token is issued following login, or whether a token transmitted
during the HTTP stage is still being used to track the users authenticed session
Verify whether server is listening on port 80. If so, visit any HTTP URL directly from
with an authenticated session and verify whether the session token is transmitted
In cases where a token for an authenticated session is transmitted to the server over
HTTP, verify whether that token continues to be valid or is immediately terminated by
the server.
Weaknesses in Session Token
Handling
Disclosure of tokens in logs
Hack steps:
Investigate whether session expiration is implemented on the
server side
Per-page Tokens
New page is created every time
Prevents session fixation attacks