shymonk/django-datatable

XSS vulnerability when using AJAX.

Mamsaac opened this issue · 1 comments

When I implemented datatables with AJAX for my own library I had this pitfall before tests, so I decided to check if the library had the issue, and after a quick test, it does.

To try it:

  1. Open example project.
  2. Open django shell (python manage.py shell).
  3. Add the following:
from app.models import *
Organization(name="<script>alert(1)</script>").save()
Person(name="<script>alert(1)</script>", organization=myorg).save()
  1. Run development server (python manage.py runserver)
  2. Select to load any of the two AJAX-based tables.

You fill find it gives you an alert(1) javascript popup.

Non-ajax tables load their columns escaped.

I was too lazy to validate where in your code you stop using escape() when rendering the column.

Great issue! Thanks a lot!