L4 - Session Management & Security Flashcards

1
Q

HTTP

A

HTTP is a stateless protocol.
- It follows a request/response pattern i.e, user requests a resource and the web server responds with the requested resource.
- Information is not retained (pass on) from one request to another.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Client side session management

A

View state, hidden field, cookies, control state, query string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Server side session management

A

Session, application object, caching

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Session (Server)

A
  • Session is used to store information and identity. The server stores the session using Session_id.
  • 2 events: Session_start(), Session_End()
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How to create a session variable (Server)

A

Session.add(“ssuser”, txtboxloginid.Text);
Session[“ssuser”] = txtboxloginid.Text;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How to retrieve value from session (Server)

A

string LoginUser = (String)Session[“ssuserName”]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How to delete session object(s) (Server)

A

Session.Remove(“cartvalue”)
Session.Abandon(); // Remove all objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Session Timeout (Server)

A
  • Session timeout can be configured in the web.config file
  • It indicates the time that the session can be idle before it is abandoned
  • <sessionState></sessionState>
  • By default, session timeout = 20minutes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How is data stored in “Session” (Server)

A

– InProc Mode
* It is a default session mode and a value store in web server
memory (IIS).
* Session value stored when server starts and it ends when
the server is restarted.
* limited to ONLY one server
– State Server Mode
* In this mode session data is stored in separate server.
– SQL Server Mode
* In this session is stored in the database. It is a secure mode

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Application (Server)

A
  • State is maintained throughout till application shut down.
  • Shared by all users accessing the application
  • 3 events: Application_start(), Application_Error(), Application_End()
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Cache (Server)

A
  • Cache is stored on server side
  • Cache is used to set expiration policies
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Cookies (Client)

A

– a small amount of data which is either stored at client side in text file or in memory of the client browser session.
– Every time a user visits a website, cookies are retrieved from the user
machine and help identify the user.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Persistent Cookie (Client)

A

Cookies having an expiration data is called persistent cookie. This type of cookie reaches their end as their expiration dates comes to an end. IN this cookie we set an expiration date

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Non persistent cookie (Client)

A
  • Not stored in the client’s hard drive
    permanently.
  • Once the user exits the browser, the cookies will be cleared
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Control state

A
  • A private ViewState for specific controls only
  • to cahce data necessary for a control to function properly
  • not affected when ViewState is turned off
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Hidden Field

A
  • Hidden field is not displayed on the browser.
  • It is visible to all the users in url as in the following link
17
Q

Viewstate

A

– stores any type of data (small data)
– enables and disables on page level control.
– supports Encryption and Decryption and data/value is
stored in hashed format.

18
Q

Query String

A
  • Query string stores the value in the URL
  • It is visible to all the users in url as in the following link
19
Q

Broken Authentication and Session Managment Prevention

A
  • Account credentials must be properly protected by means of strong encryption.
    – SSL should be used in the transmission of credential information.
  • Secure Session ID
    – Name should not give away details about the purpose and meaning of ID.
    – Length at least 128 bit to prevent brute force attack.
    – Must be random enough to prevent guessing.
    – No meaning to the ID to prevent information disclosure attacks.
  • Avoid XSS flaws which could be used to steal session ID.
20
Q

Session Fixation

A
  • Session Fixation is a specific attack against the session that allows an attacker to gain access to a victim’s session.
  • An attacker visits the website to obtain a valid Session.
  • This valid session cookie is placed in the victim’s browser by getting the victim to click on some malicious link.
  • When the victim logs into the website, both the attacker and the victim will use the same session cookie that the attacker already knows, and thus the attacker-owned cookie is now authenticated and can be exploited.
21
Q

How to prevent Session FIxation Attack

A
  • To generate a new set of session_id or tokens each time a user logs in and invalidate the old ones if any.
  • Add additional session_id to circumvent the default behaviours
  • Perform session timeout.
22
Q

ASP.NET_SessionId Issue

A
  • ‘ASP.NET_SessionId’ wasn’t deleted upon user logout.
  • To overcome this problem we will create another cookie, ‘AuthToken,’ that has random a GUID as its value.

When the user clicks on the logout button, the ‘btnLogout_Click’ event will be triggered. This event removes all sessions. Also, we are explicitly removing the values of thecookies ‘ASP.NET_SessionId,’ and ‘AuthToken’ so that an attacker cannot fixate the session.