---
id: "CVE-2026-130082"
page: "https://infrastack.ai/live/CVE-2026-130082"
kind: "vulnerability"
aliases: ["CVE-2026-130082"]
title: "django-tenants: unescaped schema names let attackers inject SQL"
severity: "high"
cvss: 8.8
epss: null
exploited: false
status: "open"
category: "package"
products: []
ecosystems: []
tags: ["django", "django-tenants", "multi-tenant", "package", "postgresql"]
not_affected_if: ["fixed-schema-names", "non-postgresql-backend"]
published_at: "2026-11-16T22:18:24+00:00"
first_seen_at: "2026-11-16T22:39:15+00:00"
updated_at: "2026-11-16T22:40:31+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-130082", "first_seen_at": "2026-11-16T22:39:15+00:00"}]
exploit_sources: []
---

# django-tenants: unescaped schema names let attackers inject SQL

Link for people: https://infrastack.ai/live/CVE-2026-130082 (this .md is for agents)

django-tenants does not escape tenant schema names in its PostgreSQL backend, so the names are pasted straight into SQL statements. An attacker who can choose or influence a schema name can read other tenants' data or run SQL as the application's database user.

_Summary, check and fix written by a model from the sources; labelled as such._

## How to check

- Check the installed version with `pip show django-tenants` and see whether it is at least `4.0.1`.
- Look for places where a tenant schema name comes from user input, such as a subdomain, header or form field, passed to tenant lookup or schema creation code.

## Fix

- django-tenants: move to `4.0.1` or later (the range runs from `3.4.8` before `4.0.1`).

## Timeline

- 2026-11-16T22:39:15+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-130082

## Documents

- [advisory] Vendor advisory: github.com https://github.com/django-tenants/django-tenants/security/advisories/GHSA-693j-7v9f-x7pw
- [advisory] Third-party advisory: www.vulncheck.com https://www.vulncheck.com/advisories/django-tenants-3.4.8-before-4.0.1-sql-injection-via-unescaped-schema-name
- [fix] Patch: github.com https://github.com/django-tenants/django-tenants/commit/46d89c0fccc820f88657e6ec152ba855072571ff
- [fix] Release notes: github.com https://github.com/django-tenants/django-tenants/releases/tag/v4.0.1

## From the sources

django-tenants 3.4.8 before 4.0.1 contains an SQL injection vulnerability in its PostgreSQL backend that allows attackers to inject SQL through unescaped tenant schema names. Attackers who can choose or influence a schema name can supply quote characters that are interpolated into SET search_path and CREATE, DROP or ALTER SCHEMA statements, letting them read other tenants' data or run SQL as the application's database user.

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
