Which version of Django is this happening in? Automatic default
escaping of template contents didn't start until after the 0.96
release...
--
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."
Visiting the precise URL he pasted, in current Django trunk (SVN
revision 7514), I get a 404.
And I can't see any way that the URL would match something in a prior
version of Django, since there's never been an admin URL pattern that
can match "index.php". or the other junk in that URL.
My best guess is somebody made a 404.html template and is displaying
the raw path of the URL without escaping (or with escaping turned off,
depending on the Django version).
What happens on your site at /admin/index.php (.php?)?
Does it allow this script (including the unescaped tags) to somehow be
presented to another user for execution?
If not, where is the XSS attack?
Django, at least as of recent builds, escapes the tags when putting
things into the DB and into templates.
A typical example of an XSS attack path would be putting a script into
a form field at a public site and having the next user to view that
entry (blog, perhaps) getting the script back in a subsequent request
and having it execute. Typically the script would then run and send
any cookies to the attackers site (with login credentials for a bank
or some such nonsense). Nothing that any application developer can do
can prevent me from sending the current session cookie for my ebanking
site to a known xss attack url.
I have done some pretty extensive testing of the application security
aspects of Django (by trade I am a security consultant) and find it to
be very reasonably secure, provided sessions timeouts are set to a
reasonable amount of time and cookies do not contain any information
other than a session id. Both of which prevent allowing unauthorized
access to someone's account after that user was the victim of XSS from
another site.
If you review any of the documentation regarding preventing XSS
attacks, they all focus on escaping 'dirty' characters at the server,
prior to database insertion or other processing for further
presentation to other users.
My advice: congratulate the security guru at your company, he
obviously got through a few chapters of Jeremiah Grossman's book;),
but then ask him to explain in detail the actual risk to your app or
your users.
hth,
-richard
WARNING! cynical satire ahead!
For those of you willing to succumb to an opt-in XSS attack: please
reply to the list with a valid credit card number, expiration date,
and CVV2 id (it is on the back next to the signature block) thank
you;)
-richard
I'd imagine the big threat is actually not "scripting" per se, but the
fact that you can tweak the URL that form submits to for a
non-logged-in user. That user then, you hope, ignores the glaring
warning of the URL and submits username/password to wherever you want
him/her to send it.
Easily prevented by users who have half a brain, but still needs
fixing. I've cross-posted to django-dev to get it handled.
If I said that this condition is indicative of an XSS attack vector I
may as well say that Apache is vulnerable to a Denial of Service
attack because 'after I ran apachectl stop, I could no longer get to
my website'
-richard
No, because someone else could put a link on their site to my admin
with this sort of thing embedded. Yeah, it's a big reach in terms of
the user needing to be completely braindead to fall for it, but it's
possible and so we need to take it seriously.
On 5/7/08, James Bennett <ubern...@gmail.com> wrote:
>