| 1 |
========================== |
| 2 |
Django 1.5.3 release notes |
| 3 |
========================== |
| 4 |
|
| 5 |
*September 10, 2013* |
| 6 |
|
| 7 |
This is Django 1.5.3, the third release in the Django 1.5 series. It addresses |
| 8 |
one security issue and also contains an opt-in feature to enhance the security |
| 9 |
of :mod:`django.contrib.sessions`. |
| 10 |
|
| 11 |
Directory traversal vulnerability in ``ssi`` template tag |
| 12 |
========================================================= |
| 13 |
|
| 14 |
In previous versions of Django it was possible to bypass the |
| 15 |
``ALLOWED_INCLUDE_ROOTS`` setting used for security with the ``ssi`` |
| 16 |
template tag by specifying a relative path that starts with one of the allowed |
| 17 |
roots. For example, if ``ALLOWED_INCLUDE_ROOTS = ("/var/www",)`` the following |
| 18 |
would be possible: |
| 19 |
|
| 20 |
.. code-block:: html+django |
| 21 |
|
| 22 |
{% ssi "/var/www/../../etc/passwd" %} |
| 23 |
|
| 24 |
In practice this is not a very common problem, as it would require the template |
| 25 |
author to put the ``ssi`` file in a user-controlled variable, but it's possible |
| 26 |
in principle. |
| 27 |
|
| 28 |
Mitigating a remote-code execution vulnerability in :mod:`django.contrib.sessions` |
| 29 |
================================================================================== |
| 30 |
|
| 31 |
:mod:`django.contrib.sessions` currently uses :mod:`pickle` to serialize |
| 32 |
session data before storing it in the backend. If you're using the :ref:`signed |
| 33 |
cookie session backend<cookie-session-backend>` and :setting:`SECRET_KEY` is |
| 34 |
known by an attacker (there isn't an inherent vulnerability in Django that |
| 35 |
would cause it to leak), the attacker could insert a string into their session |
| 36 |
which, when unpickled, executes arbitrary code on the server. The technique for |
| 37 |
doing so is simple and easily available on the internet. Although the cookie |
| 38 |
session storage signs the cookie-stored data to prevent tampering, a |
| 39 |
:setting:`SECRET_KEY` leak immediately escalates to a remote code execution |
| 40 |
vulnerability. |
| 41 |
|
| 42 |
This attack can be mitigated by serializing session data using JSON rather |
| 43 |
than :mod:`pickle`. To facilitate this, Django 1.5.3 introduces a new setting, |
| 44 |
:setting:`SESSION_SERIALIZER`, to customize the session serialization format. |
| 45 |
For backwards compatibility, this setting defaults to using :mod:`pickle`. |
| 46 |
While JSON serialization does not support all Python objects like :mod:`pickle` |
| 47 |
does, we highly recommend switching to JSON-serialized values. Also, |
| 48 |
as JSON requires string keys, you will likely run into problems if you are |
| 49 |
using non-string keys in ``request.session``. See the |
| 50 |
:ref:`session_serialization` documentation for more details. |