close Warning: Can't synchronize with repository "(default)" (/project/cl-weblocks/svn does not appear to be a Subversion repository.). Look in the Trac log for more information.

Opened 17 years ago

Closed 17 years ago

#45 closed defect (fixed)

Don't use gensym for actions to avoid XSS attacks

Reported by: anonymous Owned by: Slava Akhmechet
Priority: medium Milestone: 0.1
Component: weblocks Version: pre-0.1
Keywords: security Cc: alexander.kjeldaas@…

Description

gensym-based action urls can be guessed and thus the following attack is possible:

A user has his weblock-based bank system open. In gmail, the user gets a link to a web-page that will generate lots of guessed action urls that transfers funds out of the users bank account.

Ways to fix:

  1. Require session id in URLs
  2. Or, generate stronger non-gensym based action ids

Change History (4)

comment:1 Changed 17 years ago by Slava Akhmechet

Milestone: 0.2
Priority: criticallow
Version: pre-0.1

I don't think this is an issue. Weblocks stores actions per session specifically so that a user cannot access another user's actions (unless the session has been highjacked). If a malicious site generates a lot of 'transfer' actions the user still won't be able to access them.

It's probably better to use a scheme that makes action URLs harder to guess anyway, but this isn't critical. Moving to 0.2.

comment:2 Changed 17 years ago by Slava Akhmechet

Milestone: 0.20.1
Priority: lowmedium

On 8/1/07, Alexander Kjeldaas <alexander.kjeldaas@…> wrote:

One user accessing another user's stuff is not the attack I am describing. The attack I am describing is a purely destructive *someone making a user do stuff* attack. Get a user to do something that they didn't really intend to do. In order to do this, one only need to get the user to click on a link that has a guessed action in it.

I see.

A multistep solution that comes to mind is this:

  1. Split actions into destructive actions that modify back-end data, and 'pure' actions.
  2. Ensure that destructive actions are only executed if the HTTP request is initiated via POST. I'll have to double check, but I think browsers don't allow forms to send POST requests to domains different from where HTML originally came from.
  3. Programmers will sometimes make mistakes and create destructive actions as regular ones (we could prevent them from doing it in Haskell, but unfortunately not in Lisp). This means all actions, not just destructive ones must have URLs that are hard to guess.

I'm not sure if I want to implement #1 (and therefore #2) because it forces a programmer to choose between two ways of creating an action. On the other hand this might be a good thing - this is something that needs to be thought out.

#3 should definetly be implemented.

comment:3 Changed 17 years ago by Slava Akhmechet

Please forgive the bad formatting. Numbers above don't mean tickets, but points from Alexander's email.

comment:4 Changed 17 years ago by Slava Akhmechet

Resolution: fixed
Status: newclosed

Fixed. I implemented approach 3 - action names should now be very hard to guess. I generate a random block of text, hash it with MD5 (to ensure an attacker can't crack the random number generator), and prepend it with a gensym counter (to avoid a very unlikely event of two MD5-encoding action names clashing in the same session).

Note: See TracTickets for help on using tickets.