Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 701744 (CVE-2019-19118) - dev-python/django: privilege escalation in the django admin (CVE-2019-19118)
Summary: dev-python/django: privilege escalation in the django admin (CVE-2019-19118)
Status: RESOLVED FIXED
Alias: CVE-2019-19118
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Security
URL:
Whiteboard: B2 [glsa+ cve]
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-02 10:54 UTC by Jeroen Roovers (RETIRED)
Modified: 2020-04-30 23:32 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeroen Roovers (RETIRED) gentoo-dev 2019-12-02 10:54:27 UTC
https://www.djangoproject.com/weblog/2019/dec/02/security-releases/ <https://www.djangoproject.com/weblog/2019/dec/02/security-releases/>

In accordance with `our security release policy <https://docs.djangoproject.com/en/dev/internals/security/>`_, the Django team is issuing `Django 2.2.8 <https://docs.djangoproject.com/en/dev/releases/2.2.8/>`_ and `Django 2.1.15 <https://docs.djangoproject.com/en/dev/releases/2.1.15/>`_. These release addresses the security issue detailed below. We encourage all users of Django to upgrade as soon as possible.

CVE-2019-19118: Privilege escalation in the Django admin.
=========================================================

Since Django 2.1, a Django model admin displaying a parent model with related
model inlines, where the user has view-only permissions to a parent model but
edit permissions to the inline model, would display a read-only view of the
parent model but editable forms for the inline.

Submitting these forms would not allow direct edits to the parent model, but
would trigger the parent model's ``save()`` method, and cause pre and post-save
signal handlers to be invoked. This is a privilege escalation as a user who
lacks permission to edit a model should not be able to trigger its save-related
signals.

To resolve this issue, the permission handling code of the Django admin
interface has been changed. Now, if a user has only the "view" permission for a
parent model, the entire displayed form will not be editable, even if the user
has permission to edit models included in inlines.

This is a backwards-incompatible change, and the Django security team is aware
that some users of Django were depending on the ability to allow editing of
inlines in the admin form of an otherwise view-only parent model.

Given the complexity of the Django admin, and in-particular the permissions
related checks, it is the view of the Django security team that this change was
necessary: that it is not currently feasible to maintain the existing behavior
whilst escaping the potential privilege escalation in a way that would avoid a
recurrence of similar issues in the future, and that would be compatible with
Django's *safe by default* philosophy.

For the time being, developers whose applications are affected by this change
should replace the use of inlines in read-only parents with custom forms and
views that explicitly implement the desired functionality. In the longer term,
adding a documented, supported, and properly-tested mechanism for
partially-editable multi-model forms to the admin interface may occur in Django
itself.

Thank you to Shen Ying for reporting this issue.

Affected supported versions
===========================

* Django master branch
* Django 3.0 (which will be released in a separate blog post later today)
* Django 2.2
* Django 2.1

Resolution
==========

Patches to resolve the issue have been applied to Django's master branch and
the 3.0, 2.2, and 2.1 release branches. The patches may be obtained from the following changesets:

* On the `master branch <https://github.com/django/django/commit/11c5e0609bcc0db93809de2a08e0dc3d70b393e4>`__
* On the `3.0 release branch <https://github.com/django/django/commit/092cd66cf3c3e175acce698d6ca2012068d878fa>`__
* On the `2.2 release branch <https://github.com/django/django/commit/36f580a17f0b3cb087deadf3b65eea024f479c21>`__
* On the `2.1 release branch <https://github.com/django/django/commit/103ebe2b5ff1b2614b85a52c239f471904d26244>`__

The following releases have been issued:

* Django 2.2.8 (`download Django 2.2.8 <https://www.djangoproject.com/m/releases/2.2/Django-2.2.8.tar.gz>`_ | `2.2.8 checksums <https://www.djangoproject.com/m/pgp/Django-2.2.8.checksum.txt>`_)
* Django 2.1.15 (`download Django 2.1.15 <https://www.djangoproject.com/m/releases/2.1/Django-2.1.15.tar.gz>`_ | `2.1.15 checksums <https://www.djangoproject.com/m/pgp/Django-2.1.15.checksum.txt>`_)

The PGP key ID used for these releases is Carlton Gibson: E17DF5C82B4F9D00.
Comment 1 Larry the Git Cow gentoo-dev 2020-03-06 14:38:55 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6d0858ec7469d1327e9fad71108a9a637469851e

commit 6d0858ec7469d1327e9fad71108a9a637469851e
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2020-03-06 14:13:35 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2020-03-06 14:38:30 +0000

    dev-python/django: Remove vulnerable (drop to ~arch)
    
    Bug: https://bugs.gentoo.org/692384
    Bug: https://bugs.gentoo.org/701744
    Bug: https://bugs.gentoo.org/706204
    Bug: https://bugs.gentoo.org/707998
    Bug: https://bugs.gentoo.org/711522
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 dev-python/django/Manifest            |  4 --
 dev-python/django/django-2.1.8.ebuild | 88 ---------------------------------
 dev-python/django/django-2.1.9.ebuild | 88 ---------------------------------
 dev-python/django/django-2.2.1.ebuild | 91 -----------------------------------
 dev-python/django/django-2.2.2.ebuild | 91 -----------------------------------
 5 files changed, 362 deletions(-)
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2020-03-29 00:05:10 UTC
Tree is clean.
Comment 3 Yury German Gentoo Infrastructure gentoo-dev 2020-04-08 04:45:21 UTC
Arches and Maintainer(s), Thank you for your work.

Added to an existing GLSA Request.
Comment 4 GLSAMaker/CVETool Bot gentoo-dev 2020-04-30 23:32:24 UTC
This issue was resolved and addressed in
 GLSA 202004-17 at https://security.gentoo.org/glsa/202004-17
by GLSA coordinator Thomas Deutschmann (whissi).