What you suggest is indeed possible but...

This is not an example of CRSF. CRSF is when a malicous site redirects
the user to a site where the user is already authenticated (a web2py
site) and forces the user to perform action (for example submit a
form). web2py prevents this by hiding a formkey in forms.

When you suggest is an example of phishing. For the scam to work the
victim would have to:
1) start from the malicious web site
2) login with a url provided by the malicious web site
3) provide credentials to a clone of the original web site.

If a user falls for 1,2,3 there are much easier ways to implement this
scam even if web2py did not provide the next functionality and without
redirecting at all to the web2py site.
I do not do believe this kind of phishing can be avoided.

We can have a flag that checks whether _next is on a different domain
but it would not prevent this type of scam, just this particular
implementation.

Massimo


On Nov 23, 10:42 am, Richard G <[email protected]> wrote:
> Howdy all,
>
> In web2py I've noticed a number of methods in gluon/tools.py that
> utilize client input to determine site flow:
>         if next == DEFAULT:
>         next = request.get_vars._next \
>             or request.post_vars._next \
>             or self.settings.login_next
>
> and subsequent
>     if next and not next[0] == '/' and next[:4] != 'http':
>         next = self.url(next.replace('[id]', str(form.vars.id)))
>     redirect(next)
>
> Methods:
>   AUTH: login ,  register,  retieve_username,
> reset_password_deprecated, reset_password,
> request_reset_password(retrieve_password), change_password, profile,
>
>   CRUD: update, delete
>
> Too me this seems that a malicious individual can abuse the trust of
> our site to:
> a) trick users into instantiating a CSRF from our site
> b) providing information (credentials?) to a phishing site.
>
> I'm sure we can all come up with some simple examples to provide users
> links that will redirect to a malicious site upon authentication.
> Simple ex: (http://web2py-site/login?_next=http://web2py_site/login)
> where the secondary site mimics original and identifies that the
> authentication failed, and to reenter id/pw (even though we only get
> here after original site auth was success).
>
> Unless I am missing something, the _next flow seems a strange
> 'default' behaviour for a secure framework.
>
> I'm wondering if the community has input / thoughts on my (perceived?)
> _next issue.
>
> Thanks all!!

Reply via email to