473,698 Members | 2,409 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is the way i do, secure enought to avoid session hijacking

I am storing user login information (not password) in the session. I also
use, cookieless session. I realized that, if someone copy-pastes the URL
after he/she logged in to the system to another person, the other person's
browser opens as if the sender logged in.

1) Person A Logins to the system. (login information is stored in SQL
Session state)

2) Person A copy-paster the url and sends it to person B (format of the
url is http://domain/(sessionid)/XYZ.aspx)

3) When person B opens the URL, its window opens as if person A was
logged in to the system.

This is a security threat. I have overcome this by doing the following.

When user logins to the system, a login ticket is generated and
it is stored in the session. This login ticket contains two things, one is
client ip address, the other one is user-agent.

Then at the each request, I validate if the registered login ticket
information is same.

If person A sends URL to person B, then I assumed that, person Bs ip address
should be different than person A.

I found an article on MSND,
http://msdn.microsoft.com/msdnmag/is...08/WickedCode/ (Foiling Session
Hijacking Attempts). The way Jeff have done is similar to the one that i
have done. Is this relaible. The only think i wonder is if the users IP
address changes at each request!
Nov 19 '05
13 3826
when using a nat translations, there are several options:

1) there is only one outside nat address, and every interal ipaddress use
the same nat.
2) there are multiple outside nat addresses, which are mapped to internal
segments. in this case the nat adress is stable for a given internal
ipaddress.
3) there are a pool of outside nat address (because there are a pool of
proxy servers) and internal ipaddress may get a different nat address on
every request (even to the same webserver).

with http request is one page fetch. the browser usually does a keep alive
(http 1.1), so that images can be fetched on the same connection. but if a
user fetches a page, waits a couple of seconds, then posts back, these are
two separate connection, and may have different nat addresses.

also be because most browsers support 2 concurrent connection to the same
web site (allow two image downloads at once), one page request may have two
nat address (really common with framesets).
-- bruce (sqlwork.com)


"Phillip Ian" <ph****@comcast .net> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
Like Kevin, I'm stepping just outside my realm of knowledge, but
perhaps someone else can confirm this for us...

I understand that the way NAT works is to send all the requests from
one IP address, but using different port #s, so that it can tel that
responses on port 6346 are really meant for the machine at IP such and
such on port such and such.

At the server, we must know what port we are responding to, no? Then,
requests from two machines on the same network with the same IP will
still have to have different ports. According to what I see, it is in
Request.ServerV ariables("REMOT E_PORT")

Nov 19 '05 #11
AOL requests are forwarded via proxy servers - each request is 'round
robined' through x number of proxy servers, each request in the same session
can have a different IP because they were proxied through different servers.
the internal ip address wouldn't change but that isn't the address that the
web server sees - it sees the addresses of the proxy servers. same
principle as NAT but via multiple gateways.

here is a live example from our IIS logs files - some names have been
changed to protect the innocent ;-) :
2004-08-05 19:08:18 152.163.253.33 - 80 GET /valens.htm - 200
www.oursite.com
Mozilla/4.0+(compatible ;+MSIE+6.0;+AOL +9.0;+Windows+N T+5.1) -
2004-08-05 19:09:05 152.163.252.101 - 80 GET /announcements.h tm - 200
www.oursite.com Mozilla/4.0+(compatible ;+MSIE+6.0;+AOL +9.0;+Windows+N T+5.1)
http://www.oursite.com/valens.htm
2004-08-05 19:09:07 152.163.252.194 - 80 GET
/_derived/announcements.h tm_cmp_glacier-roots010_bnr.gi f - 200
www.oursite.com Mozilla/4.0+(compatible ;+MSIE+6.0;+AOL +9.0;+Windows+N T+5.1)
http://www.oursite.com/announcements.htm
2004-08-05 19:09:09 152.163.253.36 - 80 GET /images/AN01249_.gif - 200
www.oursite.com Mozilla/4.0+(compatible ;+MSIE+6.0;+AOL +9.0;+Windows+N T+5.1)
http://www.oursite.com/announcements.htm
2004-08-05 19:09:18 152.163.252.100 - 80 GET /family_forest.h tm - 200
www.oursite.com Mozilla/4.0+(compatible ;+MSIE+6.0;+AOL +9.0;+Windows+N T+5.1)
http://www.oursite.com/announcements.htm
2004-08-05 19:09:20 152.163.252.194 - 80 GET
/_derived/family_forest.h tm_cmp_glacier-roots010_bnr.gi f - 200
www.oursite.com Mozilla/4.0+(compatible ;+MSIE+6.0;+AOL +9.0;+Windows+N T+5.1)
http://www.oursite.com/family_forest.htm
2004-08-05 19:09:42 152.163.253.9 - 80 GET /gallery.htm - 200
www.oursite.com Mozilla/4.0+(compatible ;+MSIE+6.0;+AOL +9.0;+Windows+N T+5.1)
http://www.oursite.com/family_forest.htm
2004-08-05 19:09:46 152.163.252.196 - 80 GET
/_derived/gallery.htm_cmp _glacier-roots010_bnr.gi f - 200 www.oursite.com
Mozilla/4.0+(compatible ;+MSIE+6.0;+AOL +9.0;+Windows+N T+5.1)
http://www.oursite.com/gallery.htm
2004-08-05 19:09:52 152.163.253.36 - 80 GET /contacts.htm - 200
www.oursite.com Mozilla/4.0+(compatible ;+MSIE+6.0;+AOL +9.0;+Windows+N T+5.1)
http://www.oursite.com/gallery.htm
2004-08-05 19:09:53 152.163.252.98 - 80 GET
/_derived/contacts.htm_cm p_glacier-roots010_bnr.gi f - 200 www.oursite.com
Mozilla/4.0+(compatible ;+MSIE+6.0;+AOL +9.0;+Windows+N T+5.1)
http://www.oursite.com/contacts.htm
2004-08-05 19:10:05 152.163.253.98 - 80 GET /guest_book.htm - 200
www.oursite.com Mozilla/4.0+(compatible ;+MSIE+6.0;+AOL +9.0;+Windows+N T+5.1)
http://www.oursite.com/contacts.htm
2004-08-05 19:10:08 152.163.252.104 - 80 GET
/_derived/guest_book.htm_ cmp_glacier-roots010_bnr.gi f - 200 www.oursite.com
Mozilla/4.0+(compatible ;+MSIE+6.0;+AOL +9.0;+Windows+N T+5.1)
http://www.oursite.com/guest_book.htm
2004-08-05 19:10:18 152.163.253.103 - 80 GET /home.htm - 200 www.oursite.com
Mozilla/4.0+(compatible ;+MSIE+6.0;+AOL +9.0;+Windows+N T+5.1)
http://www.oursite.com/guest_book.htm
2004-08-05 19:10:19 152.163.252.101 - 80 GET
/_derived/valens.htm_cmp_ glacier-roots010_vbtn_a .gif - 200 www.oursite.com
Mozilla/4.0+(compatible ;+MSIE+6.0;+AOL +9.0;+Windows+N T+5.1)
http://www.oursite.com/
2004-08-05 19:10:19 152.163.253.36 - 80 GET
/_derived/home.htm_cmp_gl acier-roots010_bnr.gi f - 200 www.oursite.com
Mozilla/4.0+(compatible ;+MSIE+6.0;+AOL +9.0;+Windows+N T+5.1)
http://www.oursite.com/
2004-08-05 19:10:19 152.163.253.103 - 80 GET
/_derived/valens.htm_cmp_ glacier-roots010_vbtn.g if - 200 www.oursite.com
Mozilla/4.0+(compatible ;+MSIE+6.0;+AOL +9.0;+Windows+N T+5.1)
http://www.oursite.com/
2004-08-05 19:10:19 152.163.253.100 - 80 GET /images/j0174006.gif - 200
www.oursite.com Mozilla/4.0+(compatible ;+MSIE+6.0;+AOL +9.0;+Windows+N T+5.1)
http://www.oursite.com/
2004-08-05 19:10:19 152.163.253.101 - 80 GET /images/HM00287_.gif - 200
www.oursite.com Mozilla/4.0+(compatible ;+MSIE+6.0;+AOL +9.0;+Windows+N T+5.1)
http://www.oursite.com/
2004-08-05 19:10:21 152.163.252.98 - 80 GET
/_themes/glacier-roots/aglabul1.gif - 200 www.oursite.com
Mozilla/4.0+(compatible ;+MSIE+6.0;+A


"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:Og******** ******@TK2MSFTN GP10.phx.gbl...
Within the AOL LAN, IP addresses are assigned on a per-client-session basis, if I'm not mistaken (at least with dial-up connections). But again, this is not my area of expertise. Still, I understand quite a bit about networks,
and I can't imagine why an IP address of a machine inside a network would
change within the same client session. It is, again, the "return address" of the computer on the network.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

"gerry" <ge**@hotmail.c om> wrote in message
news:Oc******** ******@TK2MSFTN GP14.phx.gbl...
are you sure about that ?
from what I have read about AOL proxies and what i see in my IIS logs - it seems that this is not true and that there can be multiple ip's for a
single
client within a session.
i don't have the asp.net session id in the log files so i can't be 100%
certain.
Gerry

"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:OL******** ******@TK2MSFTN GP15.phx.gbl...
Hi Hope,

Your method looks pretty sound to me. The client's IP address cannot

change
between requests. It is, after all, the "return address" for the client's HTTP messages.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

"Hope Paka" <ut*******@hotm ail.com> wrote in message
news:es******** ******@TK2MSFTN GP09.phx.gbl...
>I am storing user login information (not password) in the session. I
>also
>use, cookieless session. I realized that, if someone copy-pastes the URL >after he/she logged in to the system to another person, the other

person's
>browser opens as if the sender logged in.
>
> 1) Person A Logins to the system. (login information is stored in
SQL
> Session state)
>
> 2) Person A copy-paster the url and sends it to person B (format
> of
> the url is http://domain/(sessionid)/XYZ.aspx)
>
> 3) When person B opens the URL, its window opens as if person A
> was
> logged in to the system.
>
> This is a security threat. I have overcome this by doing the
following. >
> When user logins to the system, a login ticket is

generated and
> it is stored in the session. This login ticket contains two things,
one is
> client ip address, the other one is user-agent.
>
> Then at the each request, I validate if the registered login ticket
> information is same.
>
> If person A sends URL to person B, then I assumed that, person Bs ip
> address should be different than person A.
>
> I found an article on MSND,
> http://msdn.microsoft.com/msdnmag/is...08/WickedCode/ (Foiling
> Session Hijacking Attempts). The way Jeff have done is similar to the

one
> that i have done. Is this relaible. The only think i wonder is if the
> users IP address changes at each request!
>
>



Nov 19 '05 #12


Marina wrote:
What about this:

If you make sure that the only way users navigate from page to page is via
posts, then you can require that all your pages send the sessionid as a post
variable. So just check that.
Or alternatively you can store some GUID in session, and also pass it around
as a post variable. And then check that what got posted, is the same thing
you are storing in session.

The person who cut and pasted the URL, is going to be getting the URL as a
GET, not a POST, so you will know it is someone else.

I know it's not an ideal solution, as you have to change the mechanism of
the way navigation takes place on your site, but I think it may work.

Nice idea. I might use that on my next website (which I'd already
intended to force all navigation through POST anyway).

One thing I've done on one of my sites (where I *can* track IP as well,
due to the nature of the users :-)) is to keep track, within the
session, of which page the user is currently on. If an "impossible "
navigation occurs (i.e. they suddenly jump to a page they cannot reach
from the current page), then I abort the session and force them back to
the login page. So any hijack tends to be:

Person A is on page 3
--hijack--
Person B is on page 3

now, if person A goes to page 6, any place person B goes (except to
page 6) will abort the session. Ditto if person B happens to be the
first to navigate. Okay, it doesn't prevent the hijack, but it detects
it pretty quickly, unless person B is just performing exactly the same
actions as person A.

Nov 19 '05 #13
I would summarize; you cannot rely on client IP addresses in the HTTP header
because it is both not unique enough (NAT, Proxy Server, thousands of IPs
funneling through one firewall) and too unique (load balanced proxy farm
working in round robbin, multiple firewalls servicing thousands of IPs). I
would even think you cannot rely on POST only navigation because you have to
start somewhere and that will always be a GET. Think of users saving
bookmarks to favorite pages. A well written application should allow a user
to save a bookmark, then when they go to the bookmark the application should
check login status, see that they are not logged in and send them to the
login page then send to their bookmarked page after login. POST only
navigation would not allow this. My question, why no cookies? It is not
unreasonable to requires cookies, if a user wants to wear a tin foil hat and
turn cookies off then perhaps you don't want them using your application.

"Hope Paka" wrote:
I am storing user login information (not password) in the session. I also
use, cookieless session. I realized that, if someone copy-pastes the URL
after he/she logged in to the system to another person, the other person's
browser opens as if the sender logged in.

1) Person A Logins to the system. (login information is stored in SQL
Session state)

2) Person A copy-paster the url and sends it to person B (format of the
url is http://domain/(sessionid)/XYZ.aspx)

3) When person B opens the URL, its window opens as if person A was
logged in to the system.

This is a security threat. I have overcome this by doing the following.

When user logins to the system, a login ticket is generated and
it is stored in the session. This login ticket contains two things, one is
client ip address, the other one is user-agent.

Then at the each request, I validate if the registered login ticket
information is same.

If person A sends URL to person B, then I assumed that, person Bs ip address
should be different than person A.

I found an article on MSND,
http://msdn.microsoft.com/msdnmag/is...08/WickedCode/ (Foiling Session
Hijacking Attempts). The way Jeff have done is similar to the one that i
have done. Is this relaible. The only think i wonder is if the users IP
address changes at each request!

Nov 19 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1955
by: opt_inf_env | last post by:
Hello, I have a page such that each user can see only a corresponding (personal) part of the page. In the beginning I wanted to perform initialization of users (by asking there names and passwords and comparing them with names and passwords stored in database), than I planed (if comparison was successful) to set a corresponding value of variable $user_name and on the mentioned page with the help of the "if"-operator to check whether...
2
2322
by: Gurra | last post by:
Hi ive seen alot of communites that use the session("") cookie to assaign the userid after the login Since this is a cookie, isnt it easy to modifie it and become which user you want at the current community ?
7
14526
by: ehendrikd | last post by:
hi all i need some clarification on how the php session work in relation to cookies. we have a web site where users need to log in. a few of our users were having troubles with their browser clients having different levels of cookie security settings. i assumed a solution would be to have the php site use the session only, and set session.use_cookies to 0 in the php.ini file. after doing this, the session no longer persits after
4
3055
by: Stefan | last post by:
Hi! I just want to know if it's common to decrypt a Session-Object in a ASP.NET application. My collegue says that I have not do this because the information is stored on the server. Any suggestions?
0
1330
by: Daniel Malcolm | last post by:
Hi I have a site where I would like some pages to be accessed via SSL (login and payment etc) and others via regular http. However I'm not sure whether Session state can be maintained between the 2 protocols. We have SSL set up on the site so that it can be accessed via the same domain: http://www.mydomain.com/login.aspx
14
4914
by: knal | last post by:
Hi there, I'm looking for a secure login script for a sort-of-community site... (PHP, MySQL, sessions, or maybe something else ... ) I know there are a lot of scripts out there, but none of them really seem secure, or have other kind of flaws (like IP based login etc.). Why i'm asking here, is because there's experience out there, and i hope experience can tell me what my best shot is. I'm aware that i will very probably have to do...
2
4418
by: =?Utf-8?B?YW5vb3A=?= | last post by:
Hello, I am developing a Simple ASP Application with a Login page. I want to know how session ID can be generated after User has authenticated instead of generation along with the Login page request. Also Session ID must be unique each time the user logs in. This is required so that Session Hijacking and Session Fixation could be prevented. Should I have to use other process instead of General ASP Session Management. Please Help Thank...
14
1575
by: Dave | last post by:
Hello, Not sure if this is php related or not, but i'd like to have certain users who have the ability to upload files to my site, and others to download files. I thought about .htaccess and basic authentication, but then i thought that's not very secure i was wondering if there was a php solution, something that splits user uploads and downloads in to two separate sections? I checked out some scripts on phpbuilder.com but they don't seem...
8
2864
by: Harris Kosmidhs | last post by:
Hello, while I'm developing sites for some time I never coded a login form with security in mind. I was wondering what guidelines there are. For my point of view I'm thinking of using md5 passwords (it's an one way function right?) in db. Is this a correct approach?
0
8678
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9166
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9030
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7737
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4371
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.