Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hacking session variables in Asp.NET

Is it possible to hack someone's session variables and create a new shadow user?

What are the common ways of avoiding such surprizes?

SSL certificate installation or ....?

like image 533
OrElse Avatar asked Jun 05 '09 10:06

OrElse


People also ask

Can session variables be hacked?

No. Session data is stored on the server. The session ID is the only thing transferred back and forward between the client and the server.

Are asp net session variables secure?

Session state is kept entirely server-side, no matter which storage method you use (in-memory, session state server or database). So unless your server is hacked, Session variables are safe.

How to secure session in ASP net?

Secure methods of Session management replace this default cookie. Rename the default Session cookie – The ASP. NET_SessionId name reveals the name of the language as part of its SessionID characters and this gives away the security of the application to attackers.

What is session fixation in ASP net?

Session Fixation is an attack that permits an attacker to hijack a valid user session. The attack explores a limitation in the way the web application manages the session ID, more specifically the vulnerable web application.


2 Answers

Short answer... it depends.

Session in ASP.NET can be stored in a variety of ways (InProc / SQL Server / State Server) etc... another thing to note is how the client session is maintained (query string value, cookies etc...)

As the poster in this answer suggests

Can we hack a site that just stores the username as a session variable?

One thing you could do when you authenticate the user and store their name in Session, would be to also store some other information about them. e.g. Their UserAgentString, their IP Address and if a different IP or UserAgentString attempted to interact with the session, you could invalidate it.

like image 128
Eoin Campbell Avatar answered Sep 29 '22 07:09

Eoin Campbell


Anything is possible, however by default it's hard.

Generally you hijack a session by stealing the session cookie and recreating it on another machine. However in order to do this the web site must be vulnerable to Cross Site Scripting (which you can mitigate against with Server.HtmlEncode when you echo user input back). If if you do end up vulnerable the ASP.NET session cookie is marked as HTTP Only, which means, if a browser supports it, it is not accessible to access from client side scripts (although Safari ignores this setting).

like image 31
blowdart Avatar answered Sep 29 '22 07:09

blowdart