Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Harm of passing session id as url parameter

So I just noticed that one of the internet banks websites is passing session id as url parameter. ( See image below )

enter image description here

I didn't previously see anywhere that ';' in url, in this case it is after 'private;'.

1) What is the use of this ';'?

2) And why internet bank, which needs to be securest place in the internet is passing session id as url parameter?

At first, I thought they are doing it because some of the users disallow use of cookies, but then again, if they allow it, use cookies, if not - url, but I do allow use of cookies, so obviously thats not the case.

3) I guess then they should have some other security measures? What they could be?

4) And what one can possibly do if he knows others valid session id? As I know, you can quite easily log into others peoples session if you know that id, because its not hard to edit cookies and its much easier to pass that session id as url parameter, especially if you have something like:

session_id($_GET[sessionid]);

Thanks!

like image 763
user3722573 Avatar asked Dec 16 '14 07:12

user3722573


2 Answers

1) You should ask whoever designed the application your red box is covering. URL can be anything you want; the convention of key=value&key2=value2 is just that - a convention. In this case, it's Java, and it commonly uses the convention of ;jsessionid=.... for its SID.

2) It's not that big of a deal. Normal users can't copy-paste cookies like they can copy-paste a GET parameter, but power users can do whatever they want (using Mechanize, wget, curl and other non-browser means, or even browser extensions). And if you allow it for some users and disallow for some, it's not really much of a security precaution, is it? Basically, cookie SID will make the attack a bit harder, but it's like putting your front door key under the mat - definitely doesn't keep your door secure. Additionally, cookies are shared between tabs: if a site wants you to be logged in with two accounts at once, you can't do it with cookies.

3) Serverside security, yes. One effective countermeasure is one-time SIDs (each time you visit a page, the server reads the session from the current SID, then starts a new session with a new SID for the next request). A less effective but still good method is to validate other information for consistency (e.g. - still same IP? Still same browser?)

4) Yes, if you know someone's valid SID, and the server does not adequately protect against session fixation, you can "become" that person. This might enable the attacker to, say, pay his bills with your money, for instance.

like image 100
Amadan Avatar answered Sep 29 '22 03:09

Amadan


So, @Amadan correctly covered #1 and #4. But there's a bit more that needs expansion.

Using Session identifiers in a URL can be a major problem. There are a few cases where it's critically bad:

  1. Session Hijacking:

    If a user copy-pastes a URL into an email.

    In this case, the attacker can simply read the email, and steal the session identifier (thereby resuming the session).

    You could partially defend against this by making session lifetimes short, and validating things like IP addresses or User Agents in the session. Note that none of these are foolproof, they just make it "slightly" harder to attack.

  2. If the connection is ever downgraded to HTTP.

    If they are not using Http-Strict-Transport-Security (HSTS), then an attacker may be able to successfully downgrade the session to HTTP only (via MITM style attack). If the server isn't setup perfectly, this can cause the URL to leak to the attacker, and hence the session identifier.

  3. Session Fixation Attacks

    An attacker can craft a session identifier, and send the user a forged link with that session identifier. The user then logs in to the site, and the session is now tied to their account.

    You can mitigate this by strictly rotating session identifiers every time the session changes (log in, log out, privilege upgrade or downgrade, etc). But many servers don't do this, and hence are susceptible to fixation style attacks.

The reason that cookie sessions are seen as more secure is not because they are harder to edit. It's because they are more resistant to fixation attacks (you can't create a URL or link or form or js or anything that sends a fraudulent cookie on behalf of the user).

Why the bank uses a URL parameter? I have two guesses:

  1. Because they want to support those who don't allow cookies.

    Which is sigh worthy.

  2. They don't know any better.

    Seriously. If it's not in a compliance doc or NIST recommendation, then they likely don't do it. Hell, there are implemented NIST recommendations that are known to be insecure, yet are still followed because it's in writing.

like image 23
ircmaxell Avatar answered Sep 29 '22 03:09

ircmaxell