SlideShare a Scribd company logo
1 of 64
Chapter.07 Attacking Session Management
KoreaTech
Web Application Hacking & Security Study
Presenter : Alchemic
(SoftTrack Administrator)
(KoreaTech Information Security Researcher)
(NLP Practitioner)
Index
0x01. The Need for State
1) Alternatives to Sessions
0x02. Weaknesses in Token Generation
1) Meaningful Tokens
2) Predictable Tokens
3) Encrypted Tokens
0x03. Weaknesses in Session Token Handling
1) Disclosure of Tokens on the Network
2) Disclosure of Tokens in Logs
3) Vulnerable Mapping of Tokens to Sessions
4) Vulnerable Session Termination
5) Client Exposure to Token Hijacking
6) Liberal Cookie Scope
212/15/2015 SoftTrack
0x04. Securing Session Management
1) Generate Strong Tokens
2) Protect Tokens Throughout Their Life Cycle
3) Log, Monitor, and Alert
Ch 7. Attacking Session Management
The session management mechanism is a fundamental security component
in the majority of web applications.
It is what enables the application to uniquely identify a given user across a
number of different requests and to handle the data that it accumulates about
the state of that user’s interaction with the application.
312/15/2015 SoftTrack
If an attacker can break an application’s session management, she can effect-
tively bypass its authentication controls and masquerade as other application
users without knowing their credentials.
0x01. The Need for State
412/15/2015 SoftTrack
12/15/2015 SoftTrack 5
0x01. The Need for State
The majority of web “sites” are in fact web applications.
They allow you to register and log in.
They let you buy and sell goods.
They remember your preferences the next time you visit.
They deliver rich multimedia experiences with content created dynamically
based on what you click and type.
To implement any of this functionality, web applications need to use the
concept of a session.
12/15/2015 SoftTrack 6
0x01. The Need for State
The simplest and still most common means of implementing sessions is to
issue each user a unique session token or identifier.
In most cases, applications use HTTP cookies as the transmission mechanism
for passing these session tokens between server and client.
The server’s first response to a new client contains an HTTP header like the
following:
and subsequent requests from the client contain this header:
12/15/2015 SoftTrack 7
0x01. The Need for State
This standard session management mechanism is inherently vulnerable to
various categories of attack.
An attacker’s primary objective in targeting the mechanism is to somehow
hijack the session of a legitimate user and thereby masquerade as that person.
If the user has been authenticated to the application, the attakcer may be able
to access private data belonging to the user or carry out unauthorized actions
on that person’s behalf.
If the user is unauthenticated the attacker may still be able to view sensitive
information submitted by the user during her session.
12/15/2015 SoftTrack 8
0x01. The Need for State
The vulnerabilities that exist in session management mechanisms largely fall
into tow categories:
■ Weaknesses in the generation of session tokens
■ Weaknesses in the handling of session tokens throughout their life cycle
12/15/2015 SoftTrack 9
0x01. The Need for State
Alternatives to Sessions
■ HTTP authentication
Applications using the various HTTP-based authentication technologies
(basic, digest, NTLM) sometimes avoid the need to use sessions.
12/15/2015 SoftTrack 10
0x01. The Need for State
Alternatives to Sessions
■ Sessionless state mechanisms
Some applications do not issue session tokens to manage the state of a
user’s interaction with the application.
Instead, they transmit all data required to manage that state via the client,
usually in a cookie or a hidden form field.
In effect, this mechanism uses sessionless state much like the ASP.NET
ViewState does.
For this type of mechanism to be secure, the data transmitted via the client
must be properly protected.
12/15/2015 SoftTrack 11
0x02. Weaknesses in Token Generation
12/15/2015 SoftTrack 12
0x02. Weaknesses in Token Generation
Session management mechanisms are often vulnerable to attack because
tokens are generated in an unsafe manner that enables an attacker to
identify the values of tokens that have been issued to other users.
★ NOTE
There are numerous locations where an application’s security depends on
the unpredictability of tokens it generates. Here are som examples :
■ Password recovery tokens sent to the user’s registered e-mail address
■ Tokens placed in hidden form fields to prevent CSRF attacks
■ Tokens used to give one-time access to protected resources
■ Persistent tokens used in “remember me” functions
■ Tokens allowing customers of a shopping application that does not use
authentication to retrieve the current status of an existing order
12/15/2015 SoftTrack 13
0x02. Weaknesses in Token Generation
Meaningful Tokens
Some session tokens are created using a transformation of the user’s username
or e-mail address, or other information associated with that person.
For example, the following token may initially appear to be a long random string:
However, on closer inspection, you can see that it contains only hexadecimal
characters.
Decoding…
12/15/2015 SoftTrack 14
0x02. Weaknesses in Token Generation
Meaningful Tokens
Tokens that contain meaningful data often exhibit a structure.
In other words, they contain serveral components, often separated by
a delimiter, that can be extracted and analyzed separately to allow an
attacker to understand their function and means of generation.
■ The Account username
■ The numeric identifier that the application uses to distinguish between
accounts
■ The user’s first and last names
■ The user’s e-mail address
■ The user’s group or role within the application
■ A date/time stamp
■ An incrementing or predictable number
■ The client IP address
12/15/2015 SoftTrack 15
0x02. Weaknesses in Token Generation
Meaningful Tokens
Encoding schemes that are commonly encountered include XOR, Base64, and
hexadecimal representation using ASCII characters.
It may be necessary to rest varous decodings on each component of a
structured token to unpack it to its original form.
12/15/2015 SoftTrack 16
0x02. Weaknesses in Token Generation
Predictable Tokens
Some session tokens do not contain any meaningful data associating them
with a particular user. Nevertheless, they can be guessed because they contain
sequences or patterns that allow an attacker to extrapolate from a sample of
tokens to fi nd other valid tokens recently issued by the application.
In the simplest and most brazenly vulnerable cases, an application may use
a simple sequential number as the session token.
Predictable session tokens commonly arise from three different sources:
■ Concealed sequences
■ Time dependency
■ Weak random number generation
12/15/2015 SoftTrack 17
0x02. Weaknesses in Token Generation
Predictable Tokens
12/15/2015 SoftTrack 18
0x02. Weaknesses in Token Generation
Predictable Tokens
■ Concealed sequences
It is common to encounter session tokens that cannot be easily predicted
when analyzed in their raw form but that contain sequences that reveal
themselves when the tokens are suitably decoded or unpacked.
Consider the following series of values, which form one component of a
structured session token:
12/15/2015 SoftTrack 19
0x02. Weaknesses in Token Generation
Predictable Tokens
■ Concealed sequences
No immediate pattern is discernible; however, a cursory inspection indicates
that the tokens may contain Base64-encoded data.
In addition to the mixed-case alphabetic and numeric characters, there is a
+ character, which is also valid in a Base64-encoded string.
Running the tokens a Base64 decoder reveals the following:
12/15/2015 SoftTrack 20
0x02. Weaknesses in Token Generation
Predictable Tokens
■ Concealed sequences
These strings appear to be gibberish and also contain nonprinting characters.
This normally indicates that you are dealing with binary data rather than
ASCII text.
Rendering the decoded data as hexadecimal numbers gives you the following:
12/15/2015 SoftTrack 21
0x02. Weaknesses in Token Generation
Predictable Tokens
■ Concealed sequences
There is still no visible pattern.
However, if you subtract each number from the previous one, you arrive
at the following:
which immediately reveals the concealed pattern.
12/15/2015 SoftTrack 22
0x02. Weaknesses in Token Generation
Predictable Tokens
■ Concealed sequences
The algorithm used to generate tokens adds 0x97C4EB6A to the previous
value, truncates the result to a 32-bit number, and Base64-encodes this
binary data to allow it to be transported using the text-based protocol
HTTP.
Value
+ 0x97C4EB6A
Value
Dividing… (32bit)
Value
Base64 Encoding…
Final
Value
12/15/2015 SoftTrack 23
0x02. Weaknesses in Token Generation
Predictable Tokens
■ Time Dependency
Some web servers and applications employ algorithms to generate
session tokens that use the time of generation as an input to the
token’s value.
If insuffi cient other entropy is incorporated into the algorithm, you
may be able to predict other users’ tokens.
In a busy application with a large number of sessions being created
each second, a scripted attack may succeed in identifying large numbers
of other users’ tokens.
12/15/2015 SoftTrack 24
0x02. Weaknesses in Token Generation
Predictable Tokens
■ Time Dependency
Each token is clearly composed of two separate numeric components.
The first number follows a simple incrementing sequence and is easy
to predict.
The second number increases by a varying amount each time.
12/15/2015 SoftTrack 25
0x02. Weaknesses in Token Generation
Predictable Tokens
■ Time Dependency
Calculating the differences between its value in each successive token
reveals the following:
12/15/2015 SoftTrack 26
0x02. Weaknesses in Token Generation
Predictable Tokens
■ Time Dependency
Comparing this second sequence of tokens with the fi rst, two points are
immediately obvious:
12/15/2015 SoftTrack 27
0x02. Weaknesses in Token Generation
Predictable Tokens
■ Time Dependency
1) The fi rst numeric sequence continues to progress incrementally;
however, five values have been skipped since the end of the first
sequence. This is presumably because the missing values have been
issued to other users who logged in to the application in the window
between the two tests.
2) The second numeric sequence continues to progress by similar
intervals as before; however, the first value we obtain is a massive
539,578 greater than the previous value.
This second observation immediately alerts us to the role played by
time in generating session tokens.
12/15/2015 SoftTrack 28
0x02. Weaknesses in Token Generation
Predictable Tokens
■ Time Dependency
Indeed, our hunch is correct. In a subsequent phase of our testing we
perform a code review, which reveals the following token-generation
algorithm:
12/15/2015 SoftTrack 29
0x02. Weaknesses in Token Generation
Predictable Tokens
■ Weak Random Number Generation
Very little that occurs inside a computer is random.
Therefore, when randomness is required for some purpose, software uses
various techniques to generate numbers in a pseudorandom manner.
An attacker who obtains a single session token from the server can obtain
the tokens of all current and future sessions.
12/15/2015 SoftTrack 30
0x02. Weaknesses in Token Generation
Predictable Tokens
■ Testing the Quality of Randomness
Please read the book…
Next…
12/15/2015 SoftTrack 31
0x02. Weaknesses in Token Generation
Encrypted Tokens
In some situations, depending on the encryption algorithm used and the
manner in which the application processes the tokens, it may nonetheless be
possible for users to tamper with the tokens’ meaningful contents without
actually decrypting them.
Bizarre as it may sound, these are actually viable attacks that are sometimes
easy to deliver, and numerous real-world applications have proven vulnerable
to them.
The kinds of attacks that are applicable depend on the exact cryptographic
algorithm that is being used.
12/15/2015 SoftTrack 32
0x02. Weaknesses in Token Generation
Encrypted Tokens
■ ECB Ciphers
Applications that employ encrypted tokens use a symmetric encryption
algorithm so that tokens received from users can be decrypted to recover
their meaningful contents.
Some symmetric encryption algorithms use an “electronic codebook”
(ECB) cipher.
Consider an application whose tokens contain several different meaningful
components, including a numeric user identifier:
12/15/2015 SoftTrack 33
0x02. Weaknesses in Token Generation
Encrypted Tokens
■ ECB Ciphers
When this token is encrypted, it is apparently meaningless and is likely to
pass all standard statistical tests for randomness:
The ECB cipher being employed operates on 8-byte blocks of data, and
the blocks of plaintext map to the corresponding blocks of ciphertext as
follows:
12/15/2015 SoftTrack 34
0x02. Weaknesses in Token Generation
Encrypted Tokens
■ ECB Ciphers
Now, because each block of ciphertext will always decrypt into the same
block of plaintext, it is possible for an attacker to manipulate the sequence
of ciphertext blocks so as to modify the corresponding plaintext in meanin-
gful ways.
For example, if the second block is duplicated following the fourth block,
the sequence of blocks will be as follows:
12/15/2015 SoftTrack 35
0x02. Weaknesses in Token Generation
Encrypted Tokens
■ ECB Ciphers
The decrypted token now contains a modified uid value, and also a
duplicated app value.
Exactly what happens depends on how the application processes the
decrypted token. Often, applications using tokens in this way inspect
only certain parts of the decrypted token, such as the user identifier.
If the application behaves like this, then it will process the request in the
context of the user who has a uid of 992, rather than the original 218.
12/15/2015 SoftTrack 36
0x02. Weaknesses in Token Generation
Encrypted Tokens
■ ECB Ciphers
Suppose you register the username daf1, and are issued with the
following token:
The blocks of plaintext and ciphertext for this token are as follows:
12/15/2015 SoftTrack 37
0x02. Weaknesses in Token Generation
Encrypted Tokens
■ ECB Ciphers
If you then duplicate the seventh block following the fourth block, your
decrypted token will contain a uid value of 1:
12/15/2015 SoftTrack 38
0x02. Weaknesses in Token Generation
Encrypted Tokens
■ ECB Ciphers
By registering a suitable range of usernames and reperforming this attack,
you could potentially cycle through the entire range of valid uid values, and
so masquerade as every user of the application.
12/15/2015 SoftTrack 39
0x02. Weaknesses in Token Generation
Encrypted Tokens
■ CBC Ciphers
The way in which CBC-encrypted tokens are often employed in web
applications means that an attacker may be able to manipulate parts of
the decrypted tokens without knowing the secret key.
12/15/2015 SoftTrack 40
0x02. Weaknesses in Token Generation
Encrypted Tokens
■ CBC Ciphers
Consider a variation on the preceding application whose tokens contain
several different meaningful components, including a numeric user identifier:
As before, when this information is encrypted, it results in an apparently
meaningless token:
By manipulating a single individual block of the token, the attacker can
systematically modify the decrypted contents of the block that follows it.
Depending on how the application processes the resulting decrypted token,
this may enable the attacker to switch to a different user or escalate
privileges.
12/15/2015 SoftTrack 41
0x02. Weaknesses in Token Generation
Encrypted Tokens
■ CBC Ciphers
Let’s see how.
The attacker works through the encrypted token, changing one character
at a time in arbitrary ways and sending each modifi ed token to the
application.
This involves a large number of requests.
The following is a selection of the values that result when the application
decrypts each modifi ed token:
12/15/2015 SoftTrack 42
0x02. Weaknesses in Token Generation
Encrypted Tokens
■ CBC Ciphers
In each case, the block that the attacker has modifi ed decrypts into junk,
as expected (indicated by ????????).
However, the following block decrypts into meaningful text that differs
slightly from the original token.
Although the attacker does not see the decrypted values, the application
attempts to process them, and the attacker sees the results in the
application’s responses.
Often applications using tokens in this way inspect only certain parts of
the decrypted token, such as the user identifi er. If the application behaves
like this, then the eighth example shown in the preceding list succeeds, and
the application processes the request in the context of the user who has a
uid of 226, rather than the original 216.
12/15/2015 SoftTrack 43
0x02. Weaknesses in Token Generation
Encrypted Tokens
■ CBC Ciphers
12/15/2015 SoftTrack 44
0x02. Weaknesses in Token Generation
Encrypted Tokens
■ CBC Ciphers
12/15/2015 SoftTrack 45
0x02. Weaknesses in Token Generation
Encrypted Tokens
■ CBC Ciphers
12/15/2015 SoftTrack 46
0x03. Weaknesses in Session Token Handling
12/15/2015 SoftTrack 47
0x03. Weaknesses in Session Token Handling
Disclosure of Tokens on the Network
This area of vulnerability arises when the session token is transmitted across
the network in unencrypted form, enabling a suitably positioned eavesdropper
to obtain the token and therefore masquerade as the legitimate user.
Suitable positions for eavesdropping include the user’s local network, within
the user’s IT department, within the user’s ISP, on the Internet backbone, within
the application’s ISP, and within the IT department of the organization hosting
the application.
In each case, this includes both authorized personnel of the relevant organ-
Ization and any external attackers who have compromised the infrastructure
concerned.
12/15/2015 SoftTrack 48
0x03. Weaknesses in Session Token Handling
Disclosure of Tokens on the Network
This weakness may occur in various ways, many of which can arise specifically
when HTTP cookies are used as the transmission mechanism for session tokens:
■ Some applications elect to use HTTPS to protect the user’s credentials during
login but then revert to HTTP for the remainder of the user’s session.
■ Some applications use HTTP for preauthenticated areas of the site, such as
the site’s front page, but switch to HTTPS from the login page onward.
■ Even if the application issues a fresh token following successful login, and
uses HTTPS from the login page onward, the token for the user’s authent-
icated session may still be disclosed. This can happen if the user revisits a
preauthentication page (such as Help or About), either by following links
within the authenticated area, by using the back button, or by typing the
URL directly.
12/15/2015 SoftTrack 49
0x03. Weaknesses in Session Token Handling
Disclosure of Tokens on the Network
This weakness may occur in various ways, many of which can arise specifically
when HTTP cookies are used as the transmission mechanism for session tokens:
■ In a variation on the preceding case, the application may attempt to switch
to HTTPS when the user clicks the Login link.
■ Some applications use HTTP for all static content within the application, such
as images, scripts, style sheets, and page templates.
■ Even if an application uses HTTPS for every page, including unauthenticated
areas of the site and static content, there may still be circumstances in which
users’ tokens are transmitted over HTTP.
12/15/2015 SoftTrack 50
0x03. Weaknesses in Session Token Handling
Disclosure of Tokens in Logs
Aside from the clear-text transmission of session tokens in network communi-
cations, the most common place where tokens are simply disclosed to unauth-
orized view is in system logs of various kinds.
Although it is a rarer occurrence, the consequences of this kind of disclosure
are usually more serious.
When applications transmit their session tokens in this way, it is likely that
their session tokens will appear in various system logs to which unauthorized
parties may have access:
■ User’s browser logs
■ Web server logs
■ Losg of corporate or ISP proxy servers
■ Logs of any reverse proxies employed within the application’s hosting
environment
■ The Referer logs of any servers that application users visit by following off-
site links, as shown in next Figure
12/15/2015 SoftTrack 51
0x03. Weaknesses in Session Token Handling
Disclosure of Tokens in Logs
12/15/2015 SoftTrack 52
0x03. Weaknesses in Session Token Handling
Vulnerable Mapping of Tokens to Sessions
Base64 Decoding….
12/15/2015 SoftTrack 53
0x03. Weaknesses in Session Token Handling
Vulnerable Session Termination
Proper termination of sessions is important for two reasons.
First, keeping the life span of a session as short as is necessary reduces the
window of opportunity within which an attacker may capture, guess, or misuse
a valid session token.
Second, it provides users with a means of invalidating an existing session when
they no longer require it.
■ In some cases, a logout function is simply not implemented. Users have
no means of causing the application to invalidate their session.
■ In some cases, the logout function does not actually cause the server to
invalidate the session. The server removes the token from the user’s browser
(for example, by issuing a Set-Cookie instruction to blank the token).
However, if the user continues to submit the token, the server still accepts it.
■ In the worst cases, when a user clicks Logout, this fact is not communicated
to the server, so the server performs no action.
12/15/2015 SoftTrack 54
0x03. Weaknesses in Session Token Handling
Client Expowure to Token Hijacking
An attacker can target other users of the application in an attempt to capture
or misuse the victim’s session token in various ways:
■ An obvious payload for cross-site scripting attacks is to query the user’s
cookies to obtain her session token, which can then be transmitted to an
arbitrary server controlled by the attacker.
■ Various other attacks against users can be used to hijack the user’s session
in different ways. With session fi xation vulnerabilities, an attacker feeds
a known session token to a user, waits for her to log in, and then hijacks
her session. With cross-site request forgery attacks, an attacker makes
a crafted request to an application from a web site he controls, and he
exploits the fact that the user’s browser automatically submits her current
cookie with this request.
12/15/2015 SoftTrack 55
0x03. Weaknesses in Session Token Handling
Liberal Cookie Scope
The usual simple summary of how cookies work is that the server issues a
cookie using the HTTP response header Set-cookie, and the browser then
resubmits this cookie in subsequent requests to the same server using the
Cookie header.
In fact, matters are rather more subtle than this.
- Cookie Domain Restrictions
- Cookie Path Restrictions
Please read the book…
Next…
12/15/2015 SoftTrack 56
0x04. Securing Session Management
12/15/2015 SoftTrack 57
0x04. Securing Session Management
Generate Strong Tokens
The most effective token generation mechanisms are those that:
■ Use an extremely large set of possible values
■ Contain a strong source of pseudorandomness, ensuring an even and
unpredictable spread of tokens across the range of possible values
The objective of designing a mechanism to generate strong tokens is that it
should be extremely unlikely that a determined attacker with large amounts
of bandwidth and processing resources should be successful in guessing a
single valid token within the life span of its validity.
Here are some examples of information that may be incorporated:
■ The source IP address and port number from which the request was received
■ The User-Agent header in the request
■ The time of the request in milliseconds
12/15/2015 SoftTrack 58
0x04. Securing Session Management
Generate Strong Tokens
A highly effective formula for incorporating this entropy is to construct a string
that concatenates a pseudorandom number, a variety of request-specific data as
listed, and a secret string known only to the server and generated afresh on
each reboot.
12/15/2015 SoftTrack 59
0x04. Securing Session Management
Protect Tokens Throughout Their Life Cycle
Now that you’ve created a robust token whose value cannot be predicted, this
token needs to be protected throughout its life cycle from creation to disposal,
to ensure that it is not disclosed to anyone other than the user to whom it is
issued:
■ The token should only be transmitted over HTTPS.
■ Session tokens should never be transmitted in the URL, because this
provides a simple vehicle for session fi xation attacks and results in tokens
appearing in numerous logging mechanisms.
■ Logout functionality should be implemented.
■ Session expiration should be implemented after a suitable period of inactivity
(such as 10 minutes). This should result in the same behavior as if the user
had explicitly logged out.
12/15/2015 SoftTrack 60
0x04. Securing Session Management
Protect Tokens Throughout Their Life Cycle
■ Concurrent logins should be prevented. Each time a user logs in, a different
session token should be issued, and any existing session belonging to the
user should be disposed of as if she had logged out from it.
■ If the application contains any administrative or diagnostic functionality that
enables session tokens to be viewed, this functionality should be robustly
defended against unauthorized access.
■ The domain and path scope of an application’s session cookies should be
set as restrictively as possible.
Specific measures should be taken to defend the session management
mechanism against the variety of attacks that the application’s users may find
themselves targets of:
12/15/2015 SoftTrack 61
0x04. Securing Session Management
Protect Tokens Throughout Their Life Cycle
■ The application’s codebase should be rigorously audited to identify and
remove any cross-site scripting vulnerabilities.
■ Arbitrary tokens submitted by users the server does not recognize should
not be accepted.
■ Cross-site request forgery and other session attacks can be made more diffi-
cult by requiring two-step confi rmation and/or reauthentication before
critical actions such as funds transfers are carried out.
■ Cross-site request forgery attacks can be defended against by not relying
solely on HTTP cookies to transmit session tokens.
■ A fresh session should always be created after successful authentication, to
mitigate the effects of session fi xation attacks.
12/15/2015 SoftTrack 62
0x04. Securing Session Management
Per-Page Tokens
Finer-grained control over sessions can be achieved, and many kinds of session
attacks can be made more diffi cult or impossible, by using per-page tokens in
addition to session tokens.
12/15/2015 SoftTrack 63
0x04. Securing Session Management
Log, Monitor, and Alert
The application’s session management functionality should be closely integrated
with its mechanisms for logging, monitoring, and alerting to provide suitable
records of anomalous activity and to enable administrators to take defensive
actions where necessary:
■ The application should monitor requests that contain invalid tokens.
■ Brute-force attacks against session tokens are diffi cult to block altogether,
because no particular user account or session can be disabled to stop the
attack.
■ Even if brute-force attacks against sessions cannot be effectively prevented
in real time, keeping detailed logs and alerting administrators enables them
to investigate the attack and take appropriate action where they can.
■ Wherever possible, users should be alerted to anomalous events relating to
their session, such as concurrent logins or apparent hijacking (detected using
per-page tokens).
Thank you !
KoreaTech
Web Application Hacking & Security Study
Presenter : Alchemic
(SoftTrack Administrator)
(KoreaTech Information Security Researcher)
(NLP Practitioner)

More Related Content

What's hot

Crypto currency - a digital asset
Crypto currency - a digital asset Crypto currency - a digital asset
Crypto currency - a digital asset mayil vealan
 
为啥别读HotSpot VM的源码(2012-03-03)
为啥别读HotSpot VM的源码(2012-03-03)为啥别读HotSpot VM的源码(2012-03-03)
为啥别读HotSpot VM的源码(2012-03-03)Kris Mok
 
урок 42 двокрапка в безсполучниковому складному реченні
урок 42 двокрапка в безсполучниковому складному реченніурок 42 двокрапка в безсполучниковому складному реченні
урок 42 двокрапка в безсполучниковому складному реченніVitaliy Babak
 
377 технологія критичного мислення на уроках укр м. л.
377 технологія критичного мислення на уроках укр м. л.377 технологія критичного мислення на уроках укр м. л.
377 технологія критичного мислення на уроках укр м. л.shatalinskaya
 
тарас григорович шевченко
тарас григорович шевченкотарас григорович шевченко
тарас григорович шевченкоmarishkahorkova
 
동시성 프로그래밍 하기 좋은 Clojure
동시성 프로그래밍 하기 좋은 Clojure동시성 프로그래밍 하기 좋은 Clojure
동시성 프로그래밍 하기 좋은 ClojureEunmin Kim
 
оксана іваненко
оксана іваненкооксана іваненко
оксана іваненкоsvetlananekh
 

What's hot (8)

Crypto currency - a digital asset
Crypto currency - a digital asset Crypto currency - a digital asset
Crypto currency - a digital asset
 
Understanding jvm gc advanced
Understanding jvm gc advancedUnderstanding jvm gc advanced
Understanding jvm gc advanced
 
为啥别读HotSpot VM的源码(2012-03-03)
为啥别读HotSpot VM的源码(2012-03-03)为啥别读HotSpot VM的源码(2012-03-03)
为啥别读HotSpot VM的源码(2012-03-03)
 
урок 42 двокрапка в безсполучниковому складному реченні
урок 42 двокрапка в безсполучниковому складному реченніурок 42 двокрапка в безсполучниковому складному реченні
урок 42 двокрапка в безсполучниковому складному реченні
 
377 технологія критичного мислення на уроках укр м. л.
377 технологія критичного мислення на уроках укр м. л.377 технологія критичного мислення на уроках укр м. л.
377 технологія критичного мислення на уроках укр м. л.
 
тарас григорович шевченко
тарас григорович шевченкотарас григорович шевченко
тарас григорович шевченко
 
동시성 프로그래밍 하기 좋은 Clojure
동시성 프로그래밍 하기 좋은 Clojure동시성 프로그래밍 하기 좋은 Clojure
동시성 프로그래밍 하기 좋은 Clojure
 
оксана іваненко
оксана іваненкооксана іваненко
оксана іваненко
 

Viewers also liked

Web Application Security 101 - 07 Session Management
Web Application Security 101 - 07 Session ManagementWeb Application Security 101 - 07 Session Management
Web Application Security 101 - 07 Session ManagementWebsecurify
 
06 application security fundamentals - part 2 - security mechanisms - sessi...
06   application security fundamentals - part 2 - security mechanisms - sessi...06   application security fundamentals - part 2 - security mechanisms - sessi...
06 application security fundamentals - part 2 - security mechanisms - sessi...appsec
 
Microsoft Lync & Acme Packet Session Management Solutions
Microsoft Lync & Acme Packet Session Management SolutionsMicrosoft Lync & Acme Packet Session Management Solutions
Microsoft Lync & Acme Packet Session Management SolutionsMUCUGL
 
Secure Authentication and Session Management in Java EE
Secure Authentication and Session Management in Java EESecure Authentication and Session Management in Java EE
Secure Authentication and Session Management in Java EEPatrycja Wegrzynowicz
 
Session Management & Cookies In Php
Session Management & Cookies In PhpSession Management & Cookies In Php
Session Management & Cookies In PhpHarit Kothari
 
CNIT 129S: Ch 7: Attacking Session Management
CNIT 129S: Ch 7: Attacking Session Management CNIT 129S: Ch 7: Attacking Session Management
CNIT 129S: Ch 7: Attacking Session Management Sam Bowne
 

Viewers also liked (9)

Web Application Security 101 - 07 Session Management
Web Application Security 101 - 07 Session ManagementWeb Application Security 101 - 07 Session Management
Web Application Security 101 - 07 Session Management
 
Web Application Security
Web Application SecurityWeb Application Security
Web Application Security
 
06 application security fundamentals - part 2 - security mechanisms - sessi...
06   application security fundamentals - part 2 - security mechanisms - sessi...06   application security fundamentals - part 2 - security mechanisms - sessi...
06 application security fundamentals - part 2 - security mechanisms - sessi...
 
Microsoft Lync & Acme Packet Session Management Solutions
Microsoft Lync & Acme Packet Session Management SolutionsMicrosoft Lync & Acme Packet Session Management Solutions
Microsoft Lync & Acme Packet Session Management Solutions
 
Secure Authentication and Session Management in Java EE
Secure Authentication and Session Management in Java EESecure Authentication and Session Management in Java EE
Secure Authentication and Session Management in Java EE
 
Session Management & Cookies In Php
Session Management & Cookies In PhpSession Management & Cookies In Php
Session Management & Cookies In Php
 
CNIT 129S: Ch 7: Attacking Session Management
CNIT 129S: Ch 7: Attacking Session Management CNIT 129S: Ch 7: Attacking Session Management
CNIT 129S: Ch 7: Attacking Session Management
 
Cryptography
CryptographyCryptography
Cryptography
 
Cryptography
CryptographyCryptography
Cryptography
 

Similar to Attacking Session Management

LNK Payload exploit in windows
LNK Payload exploit in windowsLNK Payload exploit in windows
LNK Payload exploit in windowsssuser1d7287
 
A security strategy against steal and pass
A security strategy against steal and passA security strategy against steal and pass
A security strategy against steal and passIJNSA Journal
 
A SECURITY STRATEGY AGAINST STEAL-AND-PASS CREDENTIAL ATTACKS
A SECURITY STRATEGY AGAINST STEAL-AND-PASS CREDENTIAL ATTACKSA SECURITY STRATEGY AGAINST STEAL-AND-PASS CREDENTIAL ATTACKS
A SECURITY STRATEGY AGAINST STEAL-AND-PASS CREDENTIAL ATTACKSIJNSA Journal
 
A SECURITY STRATEGY AGAINST STEAL-AND-PASS CREDENTIAL ATTACKS
A SECURITY STRATEGY AGAINST STEAL-AND-PASS CREDENTIAL ATTACKSA SECURITY STRATEGY AGAINST STEAL-AND-PASS CREDENTIAL ATTACKS
A SECURITY STRATEGY AGAINST STEAL-AND-PASS CREDENTIAL ATTACKSIJNSA Journal
 
Nt2580 Final Project Essay Examples
Nt2580 Final Project Essay ExamplesNt2580 Final Project Essay Examples
Nt2580 Final Project Essay ExamplesSherry Bailey
 
Cyber Threat Intelligence
Cyber Threat IntelligenceCyber Threat Intelligence
Cyber Threat IntelligenceJames581435
 
DECENTRALIZED BLOCKCHAIN SERVICES USING CARDANO NETWORK
DECENTRALIZED BLOCKCHAIN SERVICES USING CARDANO NETWORKDECENTRALIZED BLOCKCHAIN SERVICES USING CARDANO NETWORK
DECENTRALIZED BLOCKCHAIN SERVICES USING CARDANO NETWORKIRJET Journal
 
Fundamental of Secure Socket Layer (SSL) | Part - 2
Fundamental of Secure Socket Layer (SSL) | Part - 2 Fundamental of Secure Socket Layer (SSL) | Part - 2
Fundamental of Secure Socket Layer (SSL) | Part - 2 Vishal Kumar
 
Multifactor authenticationMultifactor authentication or MFA .docx
Multifactor authenticationMultifactor authentication or MFA .docxMultifactor authenticationMultifactor authentication or MFA .docx
Multifactor authenticationMultifactor authentication or MFA .docxgilpinleeanna
 
Bit taka bangladeshi country owned crypto currency
Bit taka bangladeshi country owned crypto currencyBit taka bangladeshi country owned crypto currency
Bit taka bangladeshi country owned crypto currencyMohammad Salehin
 
ransomware keylogger rootkit.pptx
ransomware keylogger rootkit.pptxransomware keylogger rootkit.pptx
ransomware keylogger rootkit.pptxdawitTerefe5
 
Ethical Hacking Interview Questions and Answers.pdf
Ethical Hacking Interview Questions and Answers.pdfEthical Hacking Interview Questions and Answers.pdf
Ethical Hacking Interview Questions and Answers.pdfShivamSharma909
 
Blockchain Land Audit Report.pdf
Blockchain Land Audit Report.pdfBlockchain Land Audit Report.pdf
Blockchain Land Audit Report.pdfBlockchainLand
 
what is transport layer what are the typical attacks in transport l.pdf
what is transport layer what are the typical attacks in transport l.pdfwhat is transport layer what are the typical attacks in transport l.pdf
what is transport layer what are the typical attacks in transport l.pdfbrijeshagarwa329898l
 
Secure coding guidelines
Secure coding guidelinesSecure coding guidelines
Secure coding guidelinesZakaria SMAHI
 
IRJET- Multi sharing Data using OTP
IRJET- Multi sharing Data using OTPIRJET- Multi sharing Data using OTP
IRJET- Multi sharing Data using OTPIRJET Journal
 

Similar to Attacking Session Management (20)

LNK Payload exploit in windows
LNK Payload exploit in windowsLNK Payload exploit in windows
LNK Payload exploit in windows
 
A security strategy against steal and pass
A security strategy against steal and passA security strategy against steal and pass
A security strategy against steal and pass
 
A SECURITY STRATEGY AGAINST STEAL-AND-PASS CREDENTIAL ATTACKS
A SECURITY STRATEGY AGAINST STEAL-AND-PASS CREDENTIAL ATTACKSA SECURITY STRATEGY AGAINST STEAL-AND-PASS CREDENTIAL ATTACKS
A SECURITY STRATEGY AGAINST STEAL-AND-PASS CREDENTIAL ATTACKS
 
A SECURITY STRATEGY AGAINST STEAL-AND-PASS CREDENTIAL ATTACKS
A SECURITY STRATEGY AGAINST STEAL-AND-PASS CREDENTIAL ATTACKSA SECURITY STRATEGY AGAINST STEAL-AND-PASS CREDENTIAL ATTACKS
A SECURITY STRATEGY AGAINST STEAL-AND-PASS CREDENTIAL ATTACKS
 
Nt2580 Final Project Essay Examples
Nt2580 Final Project Essay ExamplesNt2580 Final Project Essay Examples
Nt2580 Final Project Essay Examples
 
Cyber Threat Intelligence
Cyber Threat IntelligenceCyber Threat Intelligence
Cyber Threat Intelligence
 
UNIT 5 (2).pptx
UNIT 5 (2).pptxUNIT 5 (2).pptx
UNIT 5 (2).pptx
 
DECENTRALIZED BLOCKCHAIN SERVICES USING CARDANO NETWORK
DECENTRALIZED BLOCKCHAIN SERVICES USING CARDANO NETWORKDECENTRALIZED BLOCKCHAIN SERVICES USING CARDANO NETWORK
DECENTRALIZED BLOCKCHAIN SERVICES USING CARDANO NETWORK
 
87559489 auth
87559489 auth87559489 auth
87559489 auth
 
Fundamental of Secure Socket Layer (SSL) | Part - 2
Fundamental of Secure Socket Layer (SSL) | Part - 2 Fundamental of Secure Socket Layer (SSL) | Part - 2
Fundamental of Secure Socket Layer (SSL) | Part - 2
 
Multifactor authenticationMultifactor authentication or MFA .docx
Multifactor authenticationMultifactor authentication or MFA .docxMultifactor authenticationMultifactor authentication or MFA .docx
Multifactor authenticationMultifactor authentication or MFA .docx
 
Iot Security
Iot SecurityIot Security
Iot Security
 
Bit taka bangladeshi country owned crypto currency
Bit taka bangladeshi country owned crypto currencyBit taka bangladeshi country owned crypto currency
Bit taka bangladeshi country owned crypto currency
 
ransomware keylogger rootkit.pptx
ransomware keylogger rootkit.pptxransomware keylogger rootkit.pptx
ransomware keylogger rootkit.pptx
 
Ethical Hacking Interview Questions and Answers.pdf
Ethical Hacking Interview Questions and Answers.pdfEthical Hacking Interview Questions and Answers.pdf
Ethical Hacking Interview Questions and Answers.pdf
 
otp crid cards
otp crid cardsotp crid cards
otp crid cards
 
Blockchain Land Audit Report.pdf
Blockchain Land Audit Report.pdfBlockchain Land Audit Report.pdf
Blockchain Land Audit Report.pdf
 
what is transport layer what are the typical attacks in transport l.pdf
what is transport layer what are the typical attacks in transport l.pdfwhat is transport layer what are the typical attacks in transport l.pdf
what is transport layer what are the typical attacks in transport l.pdf
 
Secure coding guidelines
Secure coding guidelinesSecure coding guidelines
Secure coding guidelines
 
IRJET- Multi sharing Data using OTP
IRJET- Multi sharing Data using OTPIRJET- Multi sharing Data using OTP
IRJET- Multi sharing Data using OTP
 

More from Sehan Lee

BSides Delhi CTF 2018 [st4t1c (Reversing 200pts)] WriteUp
BSides Delhi CTF 2018 [st4t1c (Reversing 200pts)] WriteUpBSides Delhi CTF 2018 [st4t1c (Reversing 200pts)] WriteUp
BSides Delhi CTF 2018 [st4t1c (Reversing 200pts)] WriteUpSehan Lee
 
BSides Delhi CTF 2018 [Never Too Late Mister (Forensics 200pts)] WriteUp
BSides Delhi CTF 2018 [Never Too Late Mister (Forensics 200pts)] WriteUpBSides Delhi CTF 2018 [Never Too Late Mister (Forensics 200pts)] WriteUp
BSides Delhi CTF 2018 [Never Too Late Mister (Forensics 200pts)] WriteUpSehan Lee
 
BSides Delhi CTF 2018 [krev (Reversing 200pts)] WriteUp
BSides Delhi CTF 2018 [krev (Reversing 200pts)] WriteUpBSides Delhi CTF 2018 [krev (Reversing 200pts)] WriteUp
BSides Delhi CTF 2018 [krev (Reversing 200pts)] WriteUpSehan Lee
 
BSides Delhi CTF 2018 [avap (Reversing 75pts)] WriteUp
BSides Delhi CTF 2018 [avap (Reversing 75pts)] WriteUpBSides Delhi CTF 2018 [avap (Reversing 75pts)] WriteUp
BSides Delhi CTF 2018 [avap (Reversing 75pts)] WriteUpSehan Lee
 
Plaid CTF 2017 Write-Up [zipper (MISC 50pts)]
Plaid CTF 2017 Write-Up [zipper (MISC 50pts)]Plaid CTF 2017 Write-Up [zipper (MISC 50pts)]
Plaid CTF 2017 Write-Up [zipper (MISC 50pts)]Sehan Lee
 
Mr.Robot CTF Write-Up (Korean version)
Mr.Robot CTF Write-Up (Korean version)Mr.Robot CTF Write-Up (Korean version)
Mr.Robot CTF Write-Up (Korean version)Sehan Lee
 
SECCON 2016 Online CTF [Memory Analysis] Write-Up (ver.korean)
SECCON 2016 Online CTF [Memory Analysis] Write-Up (ver.korean)SECCON 2016 Online CTF [Memory Analysis] Write-Up (ver.korean)
SECCON 2016 Online CTF [Memory Analysis] Write-Up (ver.korean)Sehan Lee
 
Basic My SQL Problems(sqlzoo.net - select from world) & Basic SQL Injection(z...
Basic My SQL Problems(sqlzoo.net - select from world) & Basic SQL Injection(z...Basic My SQL Problems(sqlzoo.net - select from world) & Basic SQL Injection(z...
Basic My SQL Problems(sqlzoo.net - select from world) & Basic SQL Injection(z...Sehan Lee
 
GoogleCTF 2016 [Wallowing Wallabies - Part One] Write-Up (ver.korean)
GoogleCTF 2016 [Wallowing Wallabies - Part One] Write-Up (ver.korean)GoogleCTF 2016 [Wallowing Wallabies - Part One] Write-Up (ver.korean)
GoogleCTF 2016 [Wallowing Wallabies - Part One] Write-Up (ver.korean)Sehan Lee
 
GoogleCTF 2016 [No Big Deal] Write-Up (ver.korean)
GoogleCTF 2016 [No Big Deal] Write-Up (ver.korean)GoogleCTF 2016 [No Big Deal] Write-Up (ver.korean)
GoogleCTF 2016 [No Big Deal] Write-Up (ver.korean)Sehan Lee
 
GoogleCTF 2016 [In Recorded Conversation] Write-Up (ver.korean)
GoogleCTF 2016 [In Recorded Conversation] Write-Up (ver.korean)GoogleCTF 2016 [In Recorded Conversation] Write-Up (ver.korean)
GoogleCTF 2016 [In Recorded Conversation] Write-Up (ver.korean)Sehan Lee
 
GoogleCTF 2016 [Ernst Echidna] Write-Up (ver.korean)
GoogleCTF 2016 [Ernst Echidna] Write-Up (ver.korean)GoogleCTF 2016 [Ernst Echidna] Write-Up (ver.korean)
GoogleCTF 2016 [Ernst Echidna] Write-Up (ver.korean)Sehan Lee
 
PlaidCTF 2016 Write-Up [hevc (MISC 50pts)]
PlaidCTF 2016 Write-Up [hevc (MISC 50pts)]PlaidCTF 2016 Write-Up [hevc (MISC 50pts)]
PlaidCTF 2016 Write-Up [hevc (MISC 50pts)]Sehan Lee
 
Web Application Technologies
Web Application TechnologiesWeb Application Technologies
Web Application TechnologiesSehan Lee
 
Packet Tracer를 이용한 OSPF 설정
Packet Tracer를 이용한 OSPF 설정Packet Tracer를 이용한 OSPF 설정
Packet Tracer를 이용한 OSPF 설정Sehan Lee
 
레이스 컨디션 기초(Basic Race Condition)
레이스 컨디션 기초(Basic Race Condition)레이스 컨디션 기초(Basic Race Condition)
레이스 컨디션 기초(Basic Race Condition)Sehan Lee
 
Packet tracer 설치 및 사용법
Packet tracer 설치 및 사용법Packet tracer 설치 및 사용법
Packet tracer 설치 및 사용법Sehan Lee
 

More from Sehan Lee (17)

BSides Delhi CTF 2018 [st4t1c (Reversing 200pts)] WriteUp
BSides Delhi CTF 2018 [st4t1c (Reversing 200pts)] WriteUpBSides Delhi CTF 2018 [st4t1c (Reversing 200pts)] WriteUp
BSides Delhi CTF 2018 [st4t1c (Reversing 200pts)] WriteUp
 
BSides Delhi CTF 2018 [Never Too Late Mister (Forensics 200pts)] WriteUp
BSides Delhi CTF 2018 [Never Too Late Mister (Forensics 200pts)] WriteUpBSides Delhi CTF 2018 [Never Too Late Mister (Forensics 200pts)] WriteUp
BSides Delhi CTF 2018 [Never Too Late Mister (Forensics 200pts)] WriteUp
 
BSides Delhi CTF 2018 [krev (Reversing 200pts)] WriteUp
BSides Delhi CTF 2018 [krev (Reversing 200pts)] WriteUpBSides Delhi CTF 2018 [krev (Reversing 200pts)] WriteUp
BSides Delhi CTF 2018 [krev (Reversing 200pts)] WriteUp
 
BSides Delhi CTF 2018 [avap (Reversing 75pts)] WriteUp
BSides Delhi CTF 2018 [avap (Reversing 75pts)] WriteUpBSides Delhi CTF 2018 [avap (Reversing 75pts)] WriteUp
BSides Delhi CTF 2018 [avap (Reversing 75pts)] WriteUp
 
Plaid CTF 2017 Write-Up [zipper (MISC 50pts)]
Plaid CTF 2017 Write-Up [zipper (MISC 50pts)]Plaid CTF 2017 Write-Up [zipper (MISC 50pts)]
Plaid CTF 2017 Write-Up [zipper (MISC 50pts)]
 
Mr.Robot CTF Write-Up (Korean version)
Mr.Robot CTF Write-Up (Korean version)Mr.Robot CTF Write-Up (Korean version)
Mr.Robot CTF Write-Up (Korean version)
 
SECCON 2016 Online CTF [Memory Analysis] Write-Up (ver.korean)
SECCON 2016 Online CTF [Memory Analysis] Write-Up (ver.korean)SECCON 2016 Online CTF [Memory Analysis] Write-Up (ver.korean)
SECCON 2016 Online CTF [Memory Analysis] Write-Up (ver.korean)
 
Basic My SQL Problems(sqlzoo.net - select from world) & Basic SQL Injection(z...
Basic My SQL Problems(sqlzoo.net - select from world) & Basic SQL Injection(z...Basic My SQL Problems(sqlzoo.net - select from world) & Basic SQL Injection(z...
Basic My SQL Problems(sqlzoo.net - select from world) & Basic SQL Injection(z...
 
GoogleCTF 2016 [Wallowing Wallabies - Part One] Write-Up (ver.korean)
GoogleCTF 2016 [Wallowing Wallabies - Part One] Write-Up (ver.korean)GoogleCTF 2016 [Wallowing Wallabies - Part One] Write-Up (ver.korean)
GoogleCTF 2016 [Wallowing Wallabies - Part One] Write-Up (ver.korean)
 
GoogleCTF 2016 [No Big Deal] Write-Up (ver.korean)
GoogleCTF 2016 [No Big Deal] Write-Up (ver.korean)GoogleCTF 2016 [No Big Deal] Write-Up (ver.korean)
GoogleCTF 2016 [No Big Deal] Write-Up (ver.korean)
 
GoogleCTF 2016 [In Recorded Conversation] Write-Up (ver.korean)
GoogleCTF 2016 [In Recorded Conversation] Write-Up (ver.korean)GoogleCTF 2016 [In Recorded Conversation] Write-Up (ver.korean)
GoogleCTF 2016 [In Recorded Conversation] Write-Up (ver.korean)
 
GoogleCTF 2016 [Ernst Echidna] Write-Up (ver.korean)
GoogleCTF 2016 [Ernst Echidna] Write-Up (ver.korean)GoogleCTF 2016 [Ernst Echidna] Write-Up (ver.korean)
GoogleCTF 2016 [Ernst Echidna] Write-Up (ver.korean)
 
PlaidCTF 2016 Write-Up [hevc (MISC 50pts)]
PlaidCTF 2016 Write-Up [hevc (MISC 50pts)]PlaidCTF 2016 Write-Up [hevc (MISC 50pts)]
PlaidCTF 2016 Write-Up [hevc (MISC 50pts)]
 
Web Application Technologies
Web Application TechnologiesWeb Application Technologies
Web Application Technologies
 
Packet Tracer를 이용한 OSPF 설정
Packet Tracer를 이용한 OSPF 설정Packet Tracer를 이용한 OSPF 설정
Packet Tracer를 이용한 OSPF 설정
 
레이스 컨디션 기초(Basic Race Condition)
레이스 컨디션 기초(Basic Race Condition)레이스 컨디션 기초(Basic Race Condition)
레이스 컨디션 기초(Basic Race Condition)
 
Packet tracer 설치 및 사용법
Packet tracer 설치 및 사용법Packet tracer 설치 및 사용법
Packet tracer 설치 및 사용법
 

Recently uploaded

internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonJericReyAuditor
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 

Recently uploaded (20)

internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lesson
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 

Attacking Session Management

  • 1. Chapter.07 Attacking Session Management KoreaTech Web Application Hacking & Security Study Presenter : Alchemic (SoftTrack Administrator) (KoreaTech Information Security Researcher) (NLP Practitioner)
  • 2. Index 0x01. The Need for State 1) Alternatives to Sessions 0x02. Weaknesses in Token Generation 1) Meaningful Tokens 2) Predictable Tokens 3) Encrypted Tokens 0x03. Weaknesses in Session Token Handling 1) Disclosure of Tokens on the Network 2) Disclosure of Tokens in Logs 3) Vulnerable Mapping of Tokens to Sessions 4) Vulnerable Session Termination 5) Client Exposure to Token Hijacking 6) Liberal Cookie Scope 212/15/2015 SoftTrack 0x04. Securing Session Management 1) Generate Strong Tokens 2) Protect Tokens Throughout Their Life Cycle 3) Log, Monitor, and Alert
  • 3. Ch 7. Attacking Session Management The session management mechanism is a fundamental security component in the majority of web applications. It is what enables the application to uniquely identify a given user across a number of different requests and to handle the data that it accumulates about the state of that user’s interaction with the application. 312/15/2015 SoftTrack If an attacker can break an application’s session management, she can effect- tively bypass its authentication controls and masquerade as other application users without knowing their credentials.
  • 4. 0x01. The Need for State 412/15/2015 SoftTrack
  • 5. 12/15/2015 SoftTrack 5 0x01. The Need for State The majority of web “sites” are in fact web applications. They allow you to register and log in. They let you buy and sell goods. They remember your preferences the next time you visit. They deliver rich multimedia experiences with content created dynamically based on what you click and type. To implement any of this functionality, web applications need to use the concept of a session.
  • 6. 12/15/2015 SoftTrack 6 0x01. The Need for State The simplest and still most common means of implementing sessions is to issue each user a unique session token or identifier. In most cases, applications use HTTP cookies as the transmission mechanism for passing these session tokens between server and client. The server’s first response to a new client contains an HTTP header like the following: and subsequent requests from the client contain this header:
  • 7. 12/15/2015 SoftTrack 7 0x01. The Need for State This standard session management mechanism is inherently vulnerable to various categories of attack. An attacker’s primary objective in targeting the mechanism is to somehow hijack the session of a legitimate user and thereby masquerade as that person. If the user has been authenticated to the application, the attakcer may be able to access private data belonging to the user or carry out unauthorized actions on that person’s behalf. If the user is unauthenticated the attacker may still be able to view sensitive information submitted by the user during her session.
  • 8. 12/15/2015 SoftTrack 8 0x01. The Need for State The vulnerabilities that exist in session management mechanisms largely fall into tow categories: ■ Weaknesses in the generation of session tokens ■ Weaknesses in the handling of session tokens throughout their life cycle
  • 9. 12/15/2015 SoftTrack 9 0x01. The Need for State Alternatives to Sessions ■ HTTP authentication Applications using the various HTTP-based authentication technologies (basic, digest, NTLM) sometimes avoid the need to use sessions.
  • 10. 12/15/2015 SoftTrack 10 0x01. The Need for State Alternatives to Sessions ■ Sessionless state mechanisms Some applications do not issue session tokens to manage the state of a user’s interaction with the application. Instead, they transmit all data required to manage that state via the client, usually in a cookie or a hidden form field. In effect, this mechanism uses sessionless state much like the ASP.NET ViewState does. For this type of mechanism to be secure, the data transmitted via the client must be properly protected.
  • 11. 12/15/2015 SoftTrack 11 0x02. Weaknesses in Token Generation
  • 12. 12/15/2015 SoftTrack 12 0x02. Weaknesses in Token Generation Session management mechanisms are often vulnerable to attack because tokens are generated in an unsafe manner that enables an attacker to identify the values of tokens that have been issued to other users. ★ NOTE There are numerous locations where an application’s security depends on the unpredictability of tokens it generates. Here are som examples : ■ Password recovery tokens sent to the user’s registered e-mail address ■ Tokens placed in hidden form fields to prevent CSRF attacks ■ Tokens used to give one-time access to protected resources ■ Persistent tokens used in “remember me” functions ■ Tokens allowing customers of a shopping application that does not use authentication to retrieve the current status of an existing order
  • 13. 12/15/2015 SoftTrack 13 0x02. Weaknesses in Token Generation Meaningful Tokens Some session tokens are created using a transformation of the user’s username or e-mail address, or other information associated with that person. For example, the following token may initially appear to be a long random string: However, on closer inspection, you can see that it contains only hexadecimal characters. Decoding…
  • 14. 12/15/2015 SoftTrack 14 0x02. Weaknesses in Token Generation Meaningful Tokens Tokens that contain meaningful data often exhibit a structure. In other words, they contain serveral components, often separated by a delimiter, that can be extracted and analyzed separately to allow an attacker to understand their function and means of generation. ■ The Account username ■ The numeric identifier that the application uses to distinguish between accounts ■ The user’s first and last names ■ The user’s e-mail address ■ The user’s group or role within the application ■ A date/time stamp ■ An incrementing or predictable number ■ The client IP address
  • 15. 12/15/2015 SoftTrack 15 0x02. Weaknesses in Token Generation Meaningful Tokens Encoding schemes that are commonly encountered include XOR, Base64, and hexadecimal representation using ASCII characters. It may be necessary to rest varous decodings on each component of a structured token to unpack it to its original form.
  • 16. 12/15/2015 SoftTrack 16 0x02. Weaknesses in Token Generation Predictable Tokens Some session tokens do not contain any meaningful data associating them with a particular user. Nevertheless, they can be guessed because they contain sequences or patterns that allow an attacker to extrapolate from a sample of tokens to fi nd other valid tokens recently issued by the application. In the simplest and most brazenly vulnerable cases, an application may use a simple sequential number as the session token. Predictable session tokens commonly arise from three different sources: ■ Concealed sequences ■ Time dependency ■ Weak random number generation
  • 17. 12/15/2015 SoftTrack 17 0x02. Weaknesses in Token Generation Predictable Tokens
  • 18. 12/15/2015 SoftTrack 18 0x02. Weaknesses in Token Generation Predictable Tokens ■ Concealed sequences It is common to encounter session tokens that cannot be easily predicted when analyzed in their raw form but that contain sequences that reveal themselves when the tokens are suitably decoded or unpacked. Consider the following series of values, which form one component of a structured session token:
  • 19. 12/15/2015 SoftTrack 19 0x02. Weaknesses in Token Generation Predictable Tokens ■ Concealed sequences No immediate pattern is discernible; however, a cursory inspection indicates that the tokens may contain Base64-encoded data. In addition to the mixed-case alphabetic and numeric characters, there is a + character, which is also valid in a Base64-encoded string. Running the tokens a Base64 decoder reveals the following:
  • 20. 12/15/2015 SoftTrack 20 0x02. Weaknesses in Token Generation Predictable Tokens ■ Concealed sequences These strings appear to be gibberish and also contain nonprinting characters. This normally indicates that you are dealing with binary data rather than ASCII text. Rendering the decoded data as hexadecimal numbers gives you the following:
  • 21. 12/15/2015 SoftTrack 21 0x02. Weaknesses in Token Generation Predictable Tokens ■ Concealed sequences There is still no visible pattern. However, if you subtract each number from the previous one, you arrive at the following: which immediately reveals the concealed pattern.
  • 22. 12/15/2015 SoftTrack 22 0x02. Weaknesses in Token Generation Predictable Tokens ■ Concealed sequences The algorithm used to generate tokens adds 0x97C4EB6A to the previous value, truncates the result to a 32-bit number, and Base64-encodes this binary data to allow it to be transported using the text-based protocol HTTP. Value + 0x97C4EB6A Value Dividing… (32bit) Value Base64 Encoding… Final Value
  • 23. 12/15/2015 SoftTrack 23 0x02. Weaknesses in Token Generation Predictable Tokens ■ Time Dependency Some web servers and applications employ algorithms to generate session tokens that use the time of generation as an input to the token’s value. If insuffi cient other entropy is incorporated into the algorithm, you may be able to predict other users’ tokens. In a busy application with a large number of sessions being created each second, a scripted attack may succeed in identifying large numbers of other users’ tokens.
  • 24. 12/15/2015 SoftTrack 24 0x02. Weaknesses in Token Generation Predictable Tokens ■ Time Dependency Each token is clearly composed of two separate numeric components. The first number follows a simple incrementing sequence and is easy to predict. The second number increases by a varying amount each time.
  • 25. 12/15/2015 SoftTrack 25 0x02. Weaknesses in Token Generation Predictable Tokens ■ Time Dependency Calculating the differences between its value in each successive token reveals the following:
  • 26. 12/15/2015 SoftTrack 26 0x02. Weaknesses in Token Generation Predictable Tokens ■ Time Dependency Comparing this second sequence of tokens with the fi rst, two points are immediately obvious:
  • 27. 12/15/2015 SoftTrack 27 0x02. Weaknesses in Token Generation Predictable Tokens ■ Time Dependency 1) The fi rst numeric sequence continues to progress incrementally; however, five values have been skipped since the end of the first sequence. This is presumably because the missing values have been issued to other users who logged in to the application in the window between the two tests. 2) The second numeric sequence continues to progress by similar intervals as before; however, the first value we obtain is a massive 539,578 greater than the previous value. This second observation immediately alerts us to the role played by time in generating session tokens.
  • 28. 12/15/2015 SoftTrack 28 0x02. Weaknesses in Token Generation Predictable Tokens ■ Time Dependency Indeed, our hunch is correct. In a subsequent phase of our testing we perform a code review, which reveals the following token-generation algorithm:
  • 29. 12/15/2015 SoftTrack 29 0x02. Weaknesses in Token Generation Predictable Tokens ■ Weak Random Number Generation Very little that occurs inside a computer is random. Therefore, when randomness is required for some purpose, software uses various techniques to generate numbers in a pseudorandom manner. An attacker who obtains a single session token from the server can obtain the tokens of all current and future sessions.
  • 30. 12/15/2015 SoftTrack 30 0x02. Weaknesses in Token Generation Predictable Tokens ■ Testing the Quality of Randomness Please read the book… Next…
  • 31. 12/15/2015 SoftTrack 31 0x02. Weaknesses in Token Generation Encrypted Tokens In some situations, depending on the encryption algorithm used and the manner in which the application processes the tokens, it may nonetheless be possible for users to tamper with the tokens’ meaningful contents without actually decrypting them. Bizarre as it may sound, these are actually viable attacks that are sometimes easy to deliver, and numerous real-world applications have proven vulnerable to them. The kinds of attacks that are applicable depend on the exact cryptographic algorithm that is being used.
  • 32. 12/15/2015 SoftTrack 32 0x02. Weaknesses in Token Generation Encrypted Tokens ■ ECB Ciphers Applications that employ encrypted tokens use a symmetric encryption algorithm so that tokens received from users can be decrypted to recover their meaningful contents. Some symmetric encryption algorithms use an “electronic codebook” (ECB) cipher. Consider an application whose tokens contain several different meaningful components, including a numeric user identifier:
  • 33. 12/15/2015 SoftTrack 33 0x02. Weaknesses in Token Generation Encrypted Tokens ■ ECB Ciphers When this token is encrypted, it is apparently meaningless and is likely to pass all standard statistical tests for randomness: The ECB cipher being employed operates on 8-byte blocks of data, and the blocks of plaintext map to the corresponding blocks of ciphertext as follows:
  • 34. 12/15/2015 SoftTrack 34 0x02. Weaknesses in Token Generation Encrypted Tokens ■ ECB Ciphers Now, because each block of ciphertext will always decrypt into the same block of plaintext, it is possible for an attacker to manipulate the sequence of ciphertext blocks so as to modify the corresponding plaintext in meanin- gful ways. For example, if the second block is duplicated following the fourth block, the sequence of blocks will be as follows:
  • 35. 12/15/2015 SoftTrack 35 0x02. Weaknesses in Token Generation Encrypted Tokens ■ ECB Ciphers The decrypted token now contains a modified uid value, and also a duplicated app value. Exactly what happens depends on how the application processes the decrypted token. Often, applications using tokens in this way inspect only certain parts of the decrypted token, such as the user identifier. If the application behaves like this, then it will process the request in the context of the user who has a uid of 992, rather than the original 218.
  • 36. 12/15/2015 SoftTrack 36 0x02. Weaknesses in Token Generation Encrypted Tokens ■ ECB Ciphers Suppose you register the username daf1, and are issued with the following token: The blocks of plaintext and ciphertext for this token are as follows:
  • 37. 12/15/2015 SoftTrack 37 0x02. Weaknesses in Token Generation Encrypted Tokens ■ ECB Ciphers If you then duplicate the seventh block following the fourth block, your decrypted token will contain a uid value of 1:
  • 38. 12/15/2015 SoftTrack 38 0x02. Weaknesses in Token Generation Encrypted Tokens ■ ECB Ciphers By registering a suitable range of usernames and reperforming this attack, you could potentially cycle through the entire range of valid uid values, and so masquerade as every user of the application.
  • 39. 12/15/2015 SoftTrack 39 0x02. Weaknesses in Token Generation Encrypted Tokens ■ CBC Ciphers The way in which CBC-encrypted tokens are often employed in web applications means that an attacker may be able to manipulate parts of the decrypted tokens without knowing the secret key.
  • 40. 12/15/2015 SoftTrack 40 0x02. Weaknesses in Token Generation Encrypted Tokens ■ CBC Ciphers Consider a variation on the preceding application whose tokens contain several different meaningful components, including a numeric user identifier: As before, when this information is encrypted, it results in an apparently meaningless token: By manipulating a single individual block of the token, the attacker can systematically modify the decrypted contents of the block that follows it. Depending on how the application processes the resulting decrypted token, this may enable the attacker to switch to a different user or escalate privileges.
  • 41. 12/15/2015 SoftTrack 41 0x02. Weaknesses in Token Generation Encrypted Tokens ■ CBC Ciphers Let’s see how. The attacker works through the encrypted token, changing one character at a time in arbitrary ways and sending each modifi ed token to the application. This involves a large number of requests. The following is a selection of the values that result when the application decrypts each modifi ed token:
  • 42. 12/15/2015 SoftTrack 42 0x02. Weaknesses in Token Generation Encrypted Tokens ■ CBC Ciphers In each case, the block that the attacker has modifi ed decrypts into junk, as expected (indicated by ????????). However, the following block decrypts into meaningful text that differs slightly from the original token. Although the attacker does not see the decrypted values, the application attempts to process them, and the attacker sees the results in the application’s responses. Often applications using tokens in this way inspect only certain parts of the decrypted token, such as the user identifi er. If the application behaves like this, then the eighth example shown in the preceding list succeeds, and the application processes the request in the context of the user who has a uid of 226, rather than the original 216.
  • 43. 12/15/2015 SoftTrack 43 0x02. Weaknesses in Token Generation Encrypted Tokens ■ CBC Ciphers
  • 44. 12/15/2015 SoftTrack 44 0x02. Weaknesses in Token Generation Encrypted Tokens ■ CBC Ciphers
  • 45. 12/15/2015 SoftTrack 45 0x02. Weaknesses in Token Generation Encrypted Tokens ■ CBC Ciphers
  • 46. 12/15/2015 SoftTrack 46 0x03. Weaknesses in Session Token Handling
  • 47. 12/15/2015 SoftTrack 47 0x03. Weaknesses in Session Token Handling Disclosure of Tokens on the Network This area of vulnerability arises when the session token is transmitted across the network in unencrypted form, enabling a suitably positioned eavesdropper to obtain the token and therefore masquerade as the legitimate user. Suitable positions for eavesdropping include the user’s local network, within the user’s IT department, within the user’s ISP, on the Internet backbone, within the application’s ISP, and within the IT department of the organization hosting the application. In each case, this includes both authorized personnel of the relevant organ- Ization and any external attackers who have compromised the infrastructure concerned.
  • 48. 12/15/2015 SoftTrack 48 0x03. Weaknesses in Session Token Handling Disclosure of Tokens on the Network This weakness may occur in various ways, many of which can arise specifically when HTTP cookies are used as the transmission mechanism for session tokens: ■ Some applications elect to use HTTPS to protect the user’s credentials during login but then revert to HTTP for the remainder of the user’s session. ■ Some applications use HTTP for preauthenticated areas of the site, such as the site’s front page, but switch to HTTPS from the login page onward. ■ Even if the application issues a fresh token following successful login, and uses HTTPS from the login page onward, the token for the user’s authent- icated session may still be disclosed. This can happen if the user revisits a preauthentication page (such as Help or About), either by following links within the authenticated area, by using the back button, or by typing the URL directly.
  • 49. 12/15/2015 SoftTrack 49 0x03. Weaknesses in Session Token Handling Disclosure of Tokens on the Network This weakness may occur in various ways, many of which can arise specifically when HTTP cookies are used as the transmission mechanism for session tokens: ■ In a variation on the preceding case, the application may attempt to switch to HTTPS when the user clicks the Login link. ■ Some applications use HTTP for all static content within the application, such as images, scripts, style sheets, and page templates. ■ Even if an application uses HTTPS for every page, including unauthenticated areas of the site and static content, there may still be circumstances in which users’ tokens are transmitted over HTTP.
  • 50. 12/15/2015 SoftTrack 50 0x03. Weaknesses in Session Token Handling Disclosure of Tokens in Logs Aside from the clear-text transmission of session tokens in network communi- cations, the most common place where tokens are simply disclosed to unauth- orized view is in system logs of various kinds. Although it is a rarer occurrence, the consequences of this kind of disclosure are usually more serious. When applications transmit their session tokens in this way, it is likely that their session tokens will appear in various system logs to which unauthorized parties may have access: ■ User’s browser logs ■ Web server logs ■ Losg of corporate or ISP proxy servers ■ Logs of any reverse proxies employed within the application’s hosting environment ■ The Referer logs of any servers that application users visit by following off- site links, as shown in next Figure
  • 51. 12/15/2015 SoftTrack 51 0x03. Weaknesses in Session Token Handling Disclosure of Tokens in Logs
  • 52. 12/15/2015 SoftTrack 52 0x03. Weaknesses in Session Token Handling Vulnerable Mapping of Tokens to Sessions Base64 Decoding….
  • 53. 12/15/2015 SoftTrack 53 0x03. Weaknesses in Session Token Handling Vulnerable Session Termination Proper termination of sessions is important for two reasons. First, keeping the life span of a session as short as is necessary reduces the window of opportunity within which an attacker may capture, guess, or misuse a valid session token. Second, it provides users with a means of invalidating an existing session when they no longer require it. ■ In some cases, a logout function is simply not implemented. Users have no means of causing the application to invalidate their session. ■ In some cases, the logout function does not actually cause the server to invalidate the session. The server removes the token from the user’s browser (for example, by issuing a Set-Cookie instruction to blank the token). However, if the user continues to submit the token, the server still accepts it. ■ In the worst cases, when a user clicks Logout, this fact is not communicated to the server, so the server performs no action.
  • 54. 12/15/2015 SoftTrack 54 0x03. Weaknesses in Session Token Handling Client Expowure to Token Hijacking An attacker can target other users of the application in an attempt to capture or misuse the victim’s session token in various ways: ■ An obvious payload for cross-site scripting attacks is to query the user’s cookies to obtain her session token, which can then be transmitted to an arbitrary server controlled by the attacker. ■ Various other attacks against users can be used to hijack the user’s session in different ways. With session fi xation vulnerabilities, an attacker feeds a known session token to a user, waits for her to log in, and then hijacks her session. With cross-site request forgery attacks, an attacker makes a crafted request to an application from a web site he controls, and he exploits the fact that the user’s browser automatically submits her current cookie with this request.
  • 55. 12/15/2015 SoftTrack 55 0x03. Weaknesses in Session Token Handling Liberal Cookie Scope The usual simple summary of how cookies work is that the server issues a cookie using the HTTP response header Set-cookie, and the browser then resubmits this cookie in subsequent requests to the same server using the Cookie header. In fact, matters are rather more subtle than this. - Cookie Domain Restrictions - Cookie Path Restrictions Please read the book… Next…
  • 56. 12/15/2015 SoftTrack 56 0x04. Securing Session Management
  • 57. 12/15/2015 SoftTrack 57 0x04. Securing Session Management Generate Strong Tokens The most effective token generation mechanisms are those that: ■ Use an extremely large set of possible values ■ Contain a strong source of pseudorandomness, ensuring an even and unpredictable spread of tokens across the range of possible values The objective of designing a mechanism to generate strong tokens is that it should be extremely unlikely that a determined attacker with large amounts of bandwidth and processing resources should be successful in guessing a single valid token within the life span of its validity. Here are some examples of information that may be incorporated: ■ The source IP address and port number from which the request was received ■ The User-Agent header in the request ■ The time of the request in milliseconds
  • 58. 12/15/2015 SoftTrack 58 0x04. Securing Session Management Generate Strong Tokens A highly effective formula for incorporating this entropy is to construct a string that concatenates a pseudorandom number, a variety of request-specific data as listed, and a secret string known only to the server and generated afresh on each reboot.
  • 59. 12/15/2015 SoftTrack 59 0x04. Securing Session Management Protect Tokens Throughout Their Life Cycle Now that you’ve created a robust token whose value cannot be predicted, this token needs to be protected throughout its life cycle from creation to disposal, to ensure that it is not disclosed to anyone other than the user to whom it is issued: ■ The token should only be transmitted over HTTPS. ■ Session tokens should never be transmitted in the URL, because this provides a simple vehicle for session fi xation attacks and results in tokens appearing in numerous logging mechanisms. ■ Logout functionality should be implemented. ■ Session expiration should be implemented after a suitable period of inactivity (such as 10 minutes). This should result in the same behavior as if the user had explicitly logged out.
  • 60. 12/15/2015 SoftTrack 60 0x04. Securing Session Management Protect Tokens Throughout Their Life Cycle ■ Concurrent logins should be prevented. Each time a user logs in, a different session token should be issued, and any existing session belonging to the user should be disposed of as if she had logged out from it. ■ If the application contains any administrative or diagnostic functionality that enables session tokens to be viewed, this functionality should be robustly defended against unauthorized access. ■ The domain and path scope of an application’s session cookies should be set as restrictively as possible. Specific measures should be taken to defend the session management mechanism against the variety of attacks that the application’s users may find themselves targets of:
  • 61. 12/15/2015 SoftTrack 61 0x04. Securing Session Management Protect Tokens Throughout Their Life Cycle ■ The application’s codebase should be rigorously audited to identify and remove any cross-site scripting vulnerabilities. ■ Arbitrary tokens submitted by users the server does not recognize should not be accepted. ■ Cross-site request forgery and other session attacks can be made more diffi- cult by requiring two-step confi rmation and/or reauthentication before critical actions such as funds transfers are carried out. ■ Cross-site request forgery attacks can be defended against by not relying solely on HTTP cookies to transmit session tokens. ■ A fresh session should always be created after successful authentication, to mitigate the effects of session fi xation attacks.
  • 62. 12/15/2015 SoftTrack 62 0x04. Securing Session Management Per-Page Tokens Finer-grained control over sessions can be achieved, and many kinds of session attacks can be made more diffi cult or impossible, by using per-page tokens in addition to session tokens.
  • 63. 12/15/2015 SoftTrack 63 0x04. Securing Session Management Log, Monitor, and Alert The application’s session management functionality should be closely integrated with its mechanisms for logging, monitoring, and alerting to provide suitable records of anomalous activity and to enable administrators to take defensive actions where necessary: ■ The application should monitor requests that contain invalid tokens. ■ Brute-force attacks against session tokens are diffi cult to block altogether, because no particular user account or session can be disabled to stop the attack. ■ Even if brute-force attacks against sessions cannot be effectively prevented in real time, keeping detailed logs and alerting administrators enables them to investigate the attack and take appropriate action where they can. ■ Wherever possible, users should be alerted to anomalous events relating to their session, such as concurrent logins or apparent hijacking (detected using per-page tokens).
  • 64. Thank you ! KoreaTech Web Application Hacking & Security Study Presenter : Alchemic (SoftTrack Administrator) (KoreaTech Information Security Researcher) (NLP Practitioner)

Editor's Notes

  1. 제7장. 세션 관리 공격 발표자 : Alchemic (SoftTrack Administrator) http://www.softtrack.co.kr http://www.facebook.com/softtrack2012
  2. 목차 상태에 대한 유지 필요 1) 세션 대안 세션 토큰 생성 과정에서 발생하는 취약점 1) 중요한 토큰 2) 추측 가능한 토큰 3) 암호화된 토큰 세션 토큰을 처리할 때 발생하는 취약점 1) 네트워크상의 토큰 노출 2) 로그에서 토큰 노출 3) 세션에 취약한 토큰 매핑 4) 세션 종료의 취약점 5) 토큰 하이재킹에 대한 클라이언트 노출 6) 개방적인 쿠키 범위 안전한 세션 관리 1) 강력한 토큰 생성 2) 토큰이 생성되고 나서 없어질 때까지 안전하게 보호 3) 로그, 감시, 경고
  3. 세션 관리 메커니즘은 웹 애플리케이션의 기본적인 보안 컴포넌트입니다. 대부분의 웹 애플리케이션은 세션을 통해 수많은 사용자의 요청을 구별하고, 사용자와 애플리케이션 사이에서 주고받는 데이터를 처리합니다. 세션 관리 메커니즘은 애플리케이션에 있어서 중요한 보안 역할을 하기 때문에 공격자에게는 주요 공격 목표가 됩니다. 공격자가 애플리케이션의 세션 관리를 뚫을 수 있으면 해당 애플리케이션의 다른 사용자에 대한 권한을 획득해 그들의 아이디를 도용할 수도 있다.
  4. 1. 상태에 대한 유지 필요
  5. 대다수의 웹사이트는 사실 웹 애플리케이션과 마찬가지입니다. 대부분의 웹 애플리케이션은 사용자에게 사용자 정보를 등록하고 로그인을 요청합니다. 사용자는 웹 애플리케이션을 통해 물건을 구매하거나 다른 사용자에게 물건을 팔기도 합니다. 그리고 다음에 사용자가 웹 사이트에 다시 접속하면 웹사이트는 사용자에 대한 이전의 기록들을 그대로 보존하고 있습니다. 웹 사이트는 사용자가 이전에 무엇을 구매하고 어떤 콘텐츠를 살펴봤는지에 따라 해당 사용자에게 개별적인 콘텐츠를 제공합니다. 웹 애플리케이션은 세션이라는 개념을 통해 이와 같이 개별적으로 사용자를 구분할 수 있습니다.
  6. 간단하지만 일반적으로 사용하는 세션 생성 방법에는 각 사용자에게 유일한 세션 토큰이나 식별자를 부여하는 것입니다. 대부분의 애플리케이션은 HTTP 쿠키를 사용해서 서버와 클라이언트 간에 세션 토큰을 주고 받습니다. 웹 애플리케이션이 새로운 사용자에게 보내는 첫 번째 응답은 다음과 같은 HTTP 헤더를 갖고 있습니다. 클라이언트는 웹 애플리케이션으로부터 받은 쿠키 정보를 이용해서 웹 애플리케이션에게 특정 자원을 요청할 때 다음과 같은 헤더를 포함시킵니다.
  7. 세션 관리와 관련해서는 취약점이 많기 때문에 그만큼 공격 방법도 다양합니다. 공격자가 세션 관리 매커니즘을 공격 목표로 할 때 첫 번째 고려 사항은 어떻게 해서든 다른 사용자의 세션을 빼앗아서 그 사용자로 위장하는 것입니다. 세션을 도용 당한 사용자가 애플리케이션 관리자라면 공격자는 관리자에 대한 개인 정보에 접근하거나 웹사이트에 있는 다른 사용자의 정보를 볼 수 있고 심지어 불법적인 행동을 할 수도 있다. 도용 당한 사용자가 애플리케이션의 일반 사용자라고 해도 공격자는 여전히 해당 사용자의 민감한 정보나 기타 중요한 정보를 볼 수 있다.
  8. 세션 관리 메커니즘에 존재하는 취약점은 다음과 같이 크게 두 종류로 나눠집니다. 세션 토큰을 만드는 과정에서 발생하는 취약점 세션 토큰을 처리할 때 발생하는 취약점
  9. 세션 대안 HTTP 인증 애플리케이션은 다양한 HTTP 기반의 인증 기법(basic, digest, NTLM 등)을 통해 세션을 사용하지 않을 수 있습니다. HTTP를 기반으로 한 인증 방법은 애플리케이션이 세션을 사용하지 않고 사용자에게 웹 애플리케이션에 요청할 때마다 인증을 요구하게 할 수도 있습니다. HTTP 인증은 인터넷을 기반으로 한 애플리케이션에서는 잘 사용되지 않지만, 세션 메커니즘은 다양한 기능을 제공하기 때문에 사실상 모든 웹 애플리케이션은 세션 인증을 사용하는 것과 다름없습니다.
  10. 비세션(sessionless) 상태 메커니즘 일부 애플리케이션은 사용자와 애플리케이션의 상호 작용을 관리하기 위해 세션 토큰을 발행하지 않습니다. 대신 클라이언트에게 상태를 관리하기 위한 데이터를 보내는데, 보통 쿠키나 보이지 않는 형식으로 돼 있습니다. 그렇게 함으로써 이 메커니즘은 ASP 닷넷 ViewState와 비슷한 비세션 상태를 사용할 수 있게 됩니다. 비세션 상태 메커니즘이 안전하게 사용되기 위해서는 클라이언트에게 보내진 데이터가 외부 악의적인 사용자에게 노출되지 않아야 합니다.
  11. 2. 세션 토큰 생성 과정에서 발생하는 취약점
  12. 웹 애플리케이션에서 토큰을 만들어내는 과정이 안전하지 않으면 공격자가 다른 사용자들에게 보내진 토큰의 값을 쉽게 알 수 있고 이를 이용해서 자신을 속여서 웹 애플리케이션에 상당한 혼란을 야기할 수 있습니다. 일반적으로 세션 토큰을 만드는 과정에서 많은 취약점이 발생하기 때문에 세션 관리 메커니즘은 공격하기가 어렵지 않은 취약점에 속합니다. 애플리케이션에서 토큰을 생성하는 부분은 예측할 수 없을 정도로 다양한 위치에서 생성됩니다. 다음은 토큰이 생성되는 부분에 대한 일부 예시입니다. 첫번째, 비밀번호 복구 토큰은 사용자가 등록한 이메일 주소로 전달한다. 두번째, 토큰은 CSRF 공격을 막기 위해 숨김 폼 필드에 위치한다. 세번째, 토큰은 보호된 자원에 원타임 접근을 할 때 사용되곤 한다. 네번째, 영구적인 토큰은 ‘내 정보 기억하기’ 기능에서 사용된다. 다섯번째, 토큰은 사용자가 이전에 구매한 주문 내용을 별도 인증 없이 쇼핑 애플리케이션에서 보여줄 때 사용된다.
  13. 중요한 토큰 세션 토큰은 사용자명이나 이메일 주소를 변경해서 만들어지기도 하고 그 외의 다른 정보를 이용해서 만들어지기도 합니다. 예를 들어 다음과 같이 토큰은 긴 무작위 문자열을 이용한 것처럼 만들어지기도 합니다. 하지만 더 자세히 보면 이것은 단순히 16진수 문자열만을 갖고 있는 것을 알 수 있습니다. 이 문자열이 사실 16진법 인코딩을 사용한 아스키코드 문자열이라고 가정해 보면 디코더를 사용해서 다음과 같은 결과를 볼 수 있습니다.
  14. 일반적으로 사용하는 인코딩 스키마는 XOR, Base64, 아스키 문자열을 사용한 16진법 등이 있다. 구조화된 토큰의 컴포넌트를 원래의 상태로 다시 되돌려 놓으려면 각 컴포넌트를 다양한 방법을 통해 디코딩하면 된다.
  15. 추측 가능한 토큰 일부 세션 토큰은 웹 애플리케이션 사용자와의 연관성이나 의미 있는 데이터를 전혀 포함하고 있지 않는 경우도 있습니다. 그럼에도 불구하고 애플리케이션이 사용자에게 전달하는 토큰이 일정한 패턴을 가진 경우 공격자는 샘플을 수집해서 세션 토큰을 추측할 수 있는 경우도 있습니다. 가장 간단한 세션 관리 취약점의 경우는 애플리케이션이 세션 토큰을 연속적인 숫자 몇 개로만 사용할 때입니다. 추측 가능한 세션 토큰은 보통 다음과 같은 세 가지 소스에서 나옵니다. 첫번째, 숨겨진 시퀀스 두번째, 시간 의존성 세번째, 약한 무작위 번호 생성
  16. 이 화면은 버프 인트루더가 순차적인 세션 토큰의 제일 마지막 두 자리 수를 돌려서 활성화돼 있는 세션을 찾는 화면입니다.
  17. 숨겨진 시퀀스 세션 토큰의 원래 형태에서는 어떤 것도 추측 불가능할 수 있습니다. 하지만 적절한 디코딩이나 언패킹을 하면 숨겨진 내용을 찾을 수 있는 경우도 있습니다. 다음과 같은 구조화된 세션 토큰의 컴포넌트인 연속된 값을 살펴보도록 하겠습니다.
  18. 대략적인 조사로 이 토큰이 Base64로 인코딩된 데이터를 가졌을 수도 있다는 단서를 찾을 수 있씁니다. 알파벳과 숫자로 된 문자열에 + 문자도 보이는 것으로 보아서 Base64 일 가능성이 큽니다. 그래서 이 토큰들을 Base64로 디코딩하면 다음과 같은 문자들을 얻을 수 있습니다.
  19. 이 이상한(?) 문자열은 전혀 사람이 이해할 수 없는 것들입니다. 이렇게 되면 지금 다루는 것은 아스키 문자열이라기 보다는 바이너리 데이터에 가깝다고 볼 수 있습니다. 그럼 다시 디코딩된 데이터를 16진법 숫자로 나타내면 다음과 같아집니다.
  20. 하지만 여전히 아무런 패턴도 발견할 수 없습니다. 하지만 이전의 하나에서 각 숫자를 빼본다면 다음과 같은 결과가 나옵니다. 이렇게 하면 숨겨진 패턴이 나타나게 됩니다.
  21. 토큰을 생성할 때 쓰는 알고리즘은 이전값에 0x97C4EB6A를 더하고, 그 결과를 32비트 숫자로 자르고, 이 바이너리 데이터를 Base64로 인코딩해 텍스트를 기반으로 한 HTTP 프로토콜에서 전송할 수 있게 하는 방식입니다.
  22. 시간 의존성 일부 웹 서버와 애플리케이션은 세션 토큰을 만들 때 시간과 관련된 알고리즘을 이용해 토큰 값을 만드는 경우가 있습니다. 불충분한 다른 엔트로피가 알고리즘에 포함돼 있다면 여기서 다른 사용자의 토큰을 예상할 수 있습니다. 1초 동안 수많은 세션이 생성되는 애플리케이션과 같은 경우에 다른 사용자의 토큰을 구별하기 위해 스크립트 공격을 사용하면 성공할 가능성이 높습니다.
  23. 각 토큰은 분명 두 개로 나뉘어진 숫자로 구성돼 있습니다. 첫 번째 숫자는 단순히 증가하는 것이므로 볼 필요 없고, 두 번째 숫자는 매번 다른 수로 증가를 하고 있습니다.
  24. 각 토큰 값의 차이를 일일이 계산한 결과 다음과 같은 숫자들을 얻었습니다. 그런데 딱히 추측 가능한 패턴을 가지고 있지 않아서 토큰을 더 확보해보았습니다.
  25. 이 두 번째로 얻은 시퀀스 토큰들을 첫 번째로 얻은 토큰들과 비교해보면 다음과 같은 두 가지 사실을 얻을 수 있습니다.
  26. 처음에 나오는 연속된 숫자들을 살펴보면 계속해서 증가하는 것을 알 수 있습니다. 하지만 첫 번째 연속된 숫자에서 마지막 5개 값(3124548, 3124549, 3124550, 3124551, 3124552)은 뛰어넘어버렸다는 것을 알 수 있습니다. 이 5개의 값은 애플리케이션이 다른 사용자에게 보냈을 수도 있을 것이라 추측됩니다. 두 번째 나오는 연속된 숫자들은 이전과 비슷한 식으로 진행된다는 것을 알 수 있습니다. 하지만 첫 번째로 얻은 값(1172764800468)이 이전에 얻은 값(1172764260890)보다 무려 539,578이나 많다는 것을 알 수 있습니다. 두 번째 결과를 살펴보면 세션 토큰을 생성할 때 생성된 시간과 연관돼 있다는 것을 알 수 있습니다. 비교를 해보면 아마도 밀리초를 세는 것일수도 있습니다.
  27. 그리고 예상대로 코드를 검토해서 다음과 같은 토큰 생성 알고리즘을 발견할 수 있었습니다. 토큰이 어떻게 생성되는지를 알았으니 애플리케이션이 다른 사용자에게 발행하는 세션 토큰을 얻기 위해 스크립트를 만들어서 공격을 할 수 있습니다.
  28. 컴퓨터에서 드물게 일어나는 일 중에 하나가 바로 ‘무작위’입니다. 그러므로 무작위라는 개념이 어떤 목적으로 필요하면 소프트웨어는 의사 랜덤 방법으로 번호를 생성하기 위해 여러 가지 기술을 사용합니다. 서버로부터 하나의 세션 토큰을 얻은 공격자는 그 후에 일어날 세션의 토큰을 모두 얻을 수 있습니다. 바로 무작위 생성의 방식을 알면 되기 때문입니다.
  29. 무작위 보안 수준 검사
  30. 암호화된 토큰 일부 경우에는 토큰을 암호화하는 데 사용되는 암호화 알고리즘과 암호화 알고리즘을 처리하는 방식에 따라 사용자가 실제로 암호를 해독하지 않고도 토큰에서 중요한 내용을 조작할 수 있습니다. 이것은 좀 이상하게 들리겠지만, 이런 사실이 실제로 가능하며, 수많은 실세계 애플리케이션은 취약한 것으로 증명됐습니다. 실행 가능한 공격 유형은 사용되는 암호 알고리즘에 따라 다릅니다.
  31. ECB 암호 중요한 내용을 해독할 수 있게 암호화된 토큰을 사용하는 일부 애플리케이션은 대칭 암호화 알고리즘을 사용하는데, 일부 대칭 암호화 알고리즘은 ECB 를 사용합니다. 토큰이 숫자로 된 사용자 ID를 포함해 여러 가지 중요한 요소를 포함하는 웹 애플리케이션을 생각해 봅시다.
  32. 이 토큰은 암호화될 때 분명 의미 없는 형태로 변형돼 무작위성에 대한 모든 표준 통계 테스트를 통과할 가능성이 높습니다. 적용되는 ECB 암호는 8바이트 데이터 블록 단위로, 다음과 같이 일반 텍스트 블록을 암호화된 블록과 대응하게 동작합니다.
  33. 현재 암호문의 각 블록은 일반 텍스트의 동일한 블록으로 항상 복호화되기 때문에 공격자는 암호문 블록의 순서를 조작할 수 있으며, 이와 같은 방식으로 대응하는 평문을 수정할 수 있습니다.
  34. 복호화된 토큰은 현재 수정된 uid 값이나 중복된 app 값을 포함합니다. 정확하게 어떤 일이 발생하는지는 애플리케이션이 복호화된 토큰을 처리하는 방식에 따라 달라지는데, 대부분의 경우 애플리케이션은 사용자 식별자로 복호화된 토큰의 특정 부분만을 검사하고 해당 토큰을 사용합니다. 만약 이렇게 동작을 한다면, 기존 uid=218 보다 uid=992를 가진 사용자의 환경으로 해당 요청을 처리할 것입니다.
  35. 사용자명으로 daf1을 등록하고 다음과 같은 토큰을 발급 받았다고 가정해 봅시다. 이 토큰에 대한 평문과 암호문의 블록은 다음과 같습니다.
  36. 그런 다음 네 번째 블록 다음의 일곱 번째 블록을 복제할 경우 복호화된 토큰은 uid 값으로 1을 포함합니다.
  37. 사용자명의 적절한 범위를 등록하고 이 공격을 다시 수행함으로써 잠재적으로 유호한 uid 값의 전체 범위를 찾을수 있고, 이를 통해 모든 사용자로 가장할 수 있습니다.
  38. CBC 암호 (암호화 블록 체인 암호) 이 암호화 방식은 ECB 암호의 단점을 보완해 개발되었습니다. 평문의 각 블록이 암호화되기 전에 그림과 같이 XOR 연산을 수행합니다. 이는 같은 암호문 블록으로 암호화되는 동일한 평문 블록을 방지할 수 있습니다. 그러나 웹 애플리케이션에서 CBC 암호화된 토큰을 채택하는 방법은 공격자가 비밀키를 알지 못해도 복호화된 토큰의 일부분을 조작할 수 있습니다.
  39. 숫자로 된 사용자 ID를 포함해 여러 가지 중요한 구성 요소를 포함한 토큰을 생성하는 애플리케이션을 고려해 보겠습니다. 이전과 마찬가지로 이 정보를 암호화하면 다음과 같이 의미를 파악하기 힘든 형태의 토큰이 생성됩니다. 그러나 공격자는 토큰의 단일 개별 블록을 조작해 체계적으로 다음 블록의 복호화된 내용을 수정할 수 있습니다. 애플리케이션이 복호화된 토큰을 처리하는 방법에 따라 공격자는 다른 사용자로 전환하거나 권한을 상승할 수 있습니다.
  40. 방법을 살펴봅시다. 공격자는 암호화된 토큰을 임의의 방법으로 한번에 한 문자씩 변경하고, 애플리케이션에 수정된 토큰을 전송합니다. 이 작업은 많은 요청을 필요로 하며, 다음은 애플리케이션이 각 수정된 토큰을 복호화할 때 얻은 결과입니다.
  41. 각각의 경우에 예상대로 공격자가 수정했을 때 ???????를 포함해 무언가 쓰레기 값을 보여줍니다. 그러나 ??????? 다음 블록은 원래 토큰과 약간 다르며, 의미 있는 토큰을 복호화하는데 어느 정도 힌트를 주고 있습니다. 공격자는 복호화된 값을 볼 수 없지만, 애플리케이션의 응답을 통해 어느정도 결과를 알 수 있습니다. 많은 애플리케이션은 사용자 식별자로 복호화된 토큰의 특정 부분만을 검사합니다. 만약 이렇게 동작을 하게 된다면, 목록 중 uid 부분만을 통해 8번째 토큰은 성공적으로 uid=216이 아닌 uid=226 사용자의 정보 요청을 처리하게 됩니다.
  42. 그리고 우리는 쉽게 툴을 이용해서 공격 테스트를 진행해 볼 수 있습니다.
  43. 3. 세션 토큰을 처리할 때 발생하는 취약점
  44. 네트워크상의 토큰 노출 세션 토큰은 네트워크에서 암호화되지 않은 상태로 전송될 때 세션 토큰 노출 취약점이 발생하며, 공격자는 네트워크에서 도청을 통해 다른 사용자의 토큰을 얻을 수 있습니다. 도청을 하기 위한 장소로는 사용자의 로컬 네트워크에서 사용자의 IT 부서, 인터넷 백본 사용자의 ISP, 애플리케이션의 ISP, 기관 호스팅을 하는 애플리케이션의 IT 부서 등이 있습니다. 도청이 가능한 사용자 : 그 기관에 권한이 있는 사용자, 그 기관을 뚫으려는 외부 공격자
  45. 이런 취약점이 나타나는 방법은 수없이 많지만, 특히 HTTP 쿠키가 세션 토큰의 전송 메커니즘으로 사용될 때 이와 같은 취약점이 주로 나타난다. 첫 번째, 일부 애플리케이션은 로그인할 때 사용자의 자격 증명을 보호하기 위해 HTTPS를 사용하지만 그 이후로는 사용자의 남아 있는 세션을 단지 HTTP로 전송하는 경우가 있습니다. 두 번째, 일부 애플리케이션은 HTTP를 사이트의 제일 첫 페이지에서 로그인하고 난 후로는 HTTPS를 사용하게 하기도 합니다. 세 번째, 애플리케이션이 로그인하고 나서 새로운 토큰을 발행하고, 로그인한 후 HTTPS를 사용하더라도 사용자가 승인을 받기 전의 페이지에 다시 접속하거나 승인을 받은 영역에서 뒤로 가기 버튼이나 주소 창에 URL을 바로 쳐서 링크를 따라가는 행동을 한다면 사용자의 인증 세션 토큰은 여전히 노출돼 있을 것입니다.
  46. 네 번째, 앞에서 말한 경우를 좀 더 활용해 보면 애플리케이션은 사용자가 로그인을 클릭할 때 HTTPS로 변환하려고 할 것입니다. 다섯 번째, 일부 애플리케이션은 사진, 스크립트, 스타일시트, 페이지 템플릿 같은 애플리케이션의 모든 정적 콘텐츠에 HTTP를 사용합니다. 여섯 번째, 애플리케이션이 정적 콘텐츠와 승인되지 않은 영역을 포함한 모든 페이지에서 HTTPS를 사용하더라도 여전히 사용자의 토큰이 HTTP를 통해 전송될 경우가 있다.
  47. 로그에서 토큰 노출 네트워크 통신에서 세션 토큰이 문자 그대로 전송되는 것 외에도 다양한 종류의 시스템 로그에서도 토큰이 노출되기도 합니다. 드문 경우이기는 하지만 로그에서 토큰이 노출되면 결과는 더욱 심각해집니다. 애플리케이션이 세션 토큰을 이와 같은 방식으로 전송한다면 다음에 나타난 다양한 부분에 세션 토큰의 내용을 남길 것입니다. 첫번째, 사용자의 브라우저 로그들 두번재, 웹 서버 로그들 세번째, 기업이나 ISP 프록시 서버들의 로그 네번째, 애플리케이션의 호스팅에서 사용된 모든 리버스 프록시 로그들 다섯째, 그림 서버에서 나타난 것과 같이 오프사이트 링크에 담겨있는 리퍼러 로그
  48. 세션에 취약한 토큰 매핑
  49. 세션 종료의 취약점 세션 종료가 중요한 이유는 두 가지가 있습니다. 첫번째, 세션의 사용 기간을 짧게할수록 공격자들이 유효한 세션 토큰을 수집하고, 추측하고, 악용하는 시간을 줄일 수 있습니다. 두번째, 사용자들이 애플리케이션을 한동안 사용하지 않으면 세션을 종료함으로써 존재하는 세션을 무효하게 만듭니다. 잘못된 세션 종료의 가장 큰 취약점은 보통 위에서 언급한 두 가지 이유 때문입니다. 어떤 경우에는 로그아웃 기능이 아예 없는 경우도 있는데, 이런 경우 사용자들은 자신의 세션을 종료할 방법이 없습니다. 어떤 경우에는 로그아웃 기능은 있지만 서버가 제대로 세션을 종료하지 않는 경우가 있습니다. 서버는 사용자의 브라우저로부터 토큰을 없애지만(set-cookie를 통해 세션을 없앤다.) 사용자가 계속해서 토큰을 전송한다면 서버는 해당 토큰을 받아들입니다. 최악의 경우 사용자가 로그아웃을 클릭할 때 이것이 아예 서버로 전송되지 않는 경우입니다. 그러면 당연히 서버는 아무런 행동도 취하지 않습니다.
  50. 토큰 하이재킹에 대한 클라이언트 노출 공격자들이 사용자들의 애플리케이션에서 세션 토큰을 수집하거나 악용할 수 있는 방법은 아주 다양합니다. 첫번째, XSS 공격코드를 만들어 사용자의 쿠키를 요청한 다음에 공격자가 통제 가능한 조작된 서버로 사용자의 세션을 전송하게 하는 방법이 있습니다. 두번째, 사용자의 세션을 가로채는 것이 있습니다. 마찬가지로 CSRF 공격법도 있는데, 이는 공격자가 통제할 수 있는 웹사이트의 애플리케이션에 미리 특정 요청을 만들어둔 다음 사용자가 현재 쿠키를 전송할 때 사용자의 브라우저는 자동으로 이 요청과 함께 전송하는 방법입니다.
  51. 개방적인 쿠키 범위 쿠키가 어떻게 사용되는지 간단히 설명하면 서버가 HTTP 응답 헤더 Set-Cookie를 사용해서 쿠키를 발행하고 브라우저는 다시 이 쿠키를 Cookies 헤더를 사용해서 서버에게 전송합니다. 하지만 사실 이것보다는 좀 더 복잡하게 돌아갑니다. 쿠키 도메인 제한과 쿠키 경로 제한에 대해 설명이 나와있는데 이는 책을 읽어보면 금방 알 수 있으며, 이미 어느 정도 앞부분에서 다루었기 때문에 넘어가도록 하겠습니다.
  52. 4. 안전한 세션 관리
  53. 강력한 토큰 생성 다음은 가장 효과적으로 토큰을 생성하는 두 가지 메커니즘이다. 첫번째, 가능한 한 많은 집합으로 이뤄진 값을 이용 두번째, 그 값의 집합에 강력한 랜덤과 예상하기 어렵게 토큰을 분포시키는 방법 이렇게 두 가지 메커니즘입니다. 강력한 토큰을 생성하는 주된 목적은 수많은 대역폭과 처리 자원을 가진 공격자가 하나의 유효한 토큰을 추측하는데 최대한 오랜 시간이 걸리게 해서 쉽게 추측하지 못하게 하는 것입니다. 다음은 토큰 생성에 추가할 수 있는 정보들입니다. 첫번째, 요청을 받은 소스의 IP 주소와 포트 번호 두번째, 요청에 포함돼 있는 User-Agent 헤더 세번째, 밀리초와 같은 요청 시간
  54. 이와 같은 값을 이용해서 복잡도를 높이는 효율적인 방법은 의사 난수와 다양한 요청 데이터의 리스트와 서버만 알고 있는 비밀 문자열과 재부팅할 때마다 새로 생성된 문자열을 잘 결합한 새로운 문자열을 만드는 것입니다.
  55. 토큰이 생성되고 나서 없어질 때까지 안전하게 보호 토큰을 추측하기 어렵게 강력하게 만들고 나면 생성되고 나서부터 없어질 때까지 안전하게 보호해야 한다. 토큰을 발행한 사용자 외의 다른 사람들이 사용하지 않게 해야 되기 때문이다. 다음은 토큰을 안전하게 보호하는 방법입니다. 첫번째, 토큰은 반드시 HTTPS를 통해 전송돼야 합니다. 두번째, 세션 토큰은 절대로 URL에 전송돼서는 안 됩니다. 그렇게 된다면 세션 고정 공격의 대상이 되고 수많은 로깅 메커니즘에서 토큰이 드러나게 하는 결과를 가져오게 됩니다. 세번째, 로그아웃 기능은 꼭 사용돼야 합니다. 그래야 서버에서 다뤄진 모든 세션 자원이 처리되고 세션 토큰을 확실히 폐기할 수 있기 때문입니다. 네번째, 사용자가 로그아웃을 하지 않았더라도 적당한 시간 후에는 (10분 정도) 자동으로 로그아웃을 해서 세션이 종료되게 해야 합니다.
  56. 다섯번째, 로그인을 동시에 허용하는 것은 피해야 합니다. 사용자가 로그인할 때마다 다른 세션 토큰이 생성돼야 하고, 사용자에게 속해 있는 모든 세션은 로그아웃을 할 때 모두 없어져야 합니다. 여섯번째, 애플리케이션의 관리자 페이지에서 세션 토큰을 볼 수 있는 기능이 있다면 허가를 받지 않은 사용자가 관리자 페이지에 접근하지 못하게 강력하게 접근 통제를 해야 합니다. 일곱번째, 도메인과 애플리케이션의 세션 쿠키 경로 범위는 가능한 한 많이 제한시켜야 합니다. 애플리케이션의 사용자들을 공격하는 다양한 공격으로부터 세션 관리 메커니즘을 보호하기 위해 다음과 같은 특정 방법을 사용해야 합니다.
  57. 첫번째, 애플리케이션의 코드베이스는 모든 XSS 취약점을 알아내고 제거하기 위해 엄격히 감시돼야 합니다. 두번째, 사용자가 보낸 토큰 중에서 서버가 인정하지 않는 것은 받아들여서는 안 됩니다. 세번째, 계좌 이체와 같은 민감한 기능을 수행할 때 사용자를 확인하는 절차를 한 번더 거치면 CSRF와 다른 세션 공격 같은 것을 하기가 더 힘들어집니다. 네번째, CSRF 공격은 세션 토큰을 전송할 때 HTTP 쿠키에만 의존하지 않고 다른 것도 사용함으로써 막을 수 있습니다. 다섯번째, 성공적인 승인 과정을 거치고 나면 반드시 새로운 토큰을 생성해서 세션 고정 공격을 막게 해야 합니다.
  58. 페이지당 토큰 세션 토큰과 함께 페이지마다 토큰을 주면 세션에 대해 더 강력하게 통제되고 많은 종류의 세션 공격은 더 어려워지고 불가능해집니다.
  59. 로그, 감시, 경고 애플리케이션의 세션 관리 기능은 로그, 감시, 경고 메커니즘과 함께 어우러져 비정상적인 행동을 기록 하고 관리자가 세션과 관련된 공격을 막을 수 있게 해줍니다. 애플리케이션은 유효하지 않은 토큰을 담고 있는 요청을 감시해야 합니다. 세션 토큰에 대한 무차별 대입 공격은 공격을 막을 수 있는 사용자 계정이나 세션이 없기 때문에 완전히 막기는 어렵습니다. 세션에 대한 무차별 대입 공격을 실시간으로 막을 수 없다면 로그에 대한 세부 사항을 남기고, 그에 대한 경고를 줘서 관리자가 효율적으로 공격을 막을 수 있게 해야 합니다. 가능하다면 사용자들은 자신들과 관련된 비정상적인 이벤트 (예를 들어 동시에 일어나는 로그인이나 페이지당 토큰을 사용한다고 탐지된 하이재킹 같은 것)에 대해 경계를 해야 합니다.