Re: /admin Cross-Site Scripting (XSS) issue!

27 views
Skip to first unread message

James Bennett

unread,
May 7, 2008, 3:41:57 PM5/7/08
to django-d...@googlegroups.com
On Wed, May 7, 2008 at 2:32 PM, Jan Rademaker <j.rad...@gmail.com> wrote:
>
> It does work, make sure you're not logged in.
>
> $ lynx -source -dump http://localhost:8000/admin/%22%3E%3Cscript%3Ealert%283939%29%3C/script%3E/
> | grep alert
> <form action="/admin/"><script>alert(3939)</script>/" method="post"
> id="login-form">

OK, so what's happening is that the admin is assuming that if you're
not logged in, the current URL should be used as the URL to submit
login information to. Which means it drops the request path into the
form's "action" attribute and, since there are valid things for URLs
that'd be incorrectly escaped if we let the autoescaper get at them,
it's marked "safe" and so can contain HTML.

Since there is a genuine XSS threat here, it needs to be fixed in the
current admin and not simply punted to nfa. Optimal solution is to
just point the thing at a genuinely consistent login URL and redirect
back to where they were trying to go once the user's authenticated
(preferably keeping the URL firmly in the address bar the whole time,
like we already do with the "next" param for logging in everywhere
else).


--
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

Karen Tracey

unread,
May 7, 2008, 6:26:44 PM5/7/08
to django-d...@googlegroups.com

Trying this on newforms-admin (circa r7500) does not produce an alert box.  In fact the form action is escaped:

<form action="/admin/&quot;&gt;&lt;script&gt;alert(3939)&lt;/script&gt;/" method="post" id="login-form">

But from the first paragraph above it sounds like that's not the correct behavior either?

Just trying to understand if newforms-admin has a different problem....

Karen

peschler

unread,
May 8, 2008, 2:39:34 PM5/8/08
to Django developers
Just confirming for:
Django version 0.97-newforms-admin-SVN-7233
does not produce an alert box.
In fact the form action is escaped here, too.

peschler


On May 8, 12:26 am, "Karen Tracey" <kmtra...@gmail.com> wrote:
> On Wed, May 7, 2008 at 3:41 PM, James Bennett <ubernost...@gmail.com> wrote:
>
> > On Wed, May 7, 2008 at 2:32 PM, Jan Rademaker <j.radema...@gmail.com>
> > wrote:
>
> > > It does work, make sure you're not logged in.
>
> > > $ lynx -source -dump
> >http://localhost:8000/admin/%22%3E%3Cscript%3Ealert%283939%29%3C/scri...
Reply all
Reply to author
Forward
0 new messages