Skip to main content

django-tenants CVE-2026-130082

| EUVDEUVD-2026-126711 HIGH
SQL Injection (CWE-89)
2026-11-16 VulnCheck GHSA-pg64-4qv2-75g5
8.7
CVSS 4.0 · Vendor: VulnCheck
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Register tenant via sign-up with crafted schema_name
  2. Delivery
    Embed quote/semicolon characters in name
  3. Exploit
    Name interpolated into SET search_path on each request
  4. Execution
    Append foreign schema or run stacked SQL
  5. Impact
    Read other tenants' data or execute SQL as DB user

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Parameterized queries, prepared statements
MITRE ATT&CK

2 techniques across 2 tactics: Initial Access, Persistence

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

The application must allow an untrusted user to set or influence a tenant's schema_name without applying its own sanitisation - typically a self-service sign-up flow that derives the schema name from a user-supplied subdomain or organisation name and relies solely on django-tenants to validate it. The affected component is the PostgreSQL backend in versions >= 3.4.8 through <= 4.0.0, where the loosened validator (^(?!pg_).{1,63}$) accepts quote characters that reach SET search_path (fired on nearly every tenant request and during first migration with automatic schema creation) and CREATE/DROP/ALTER SCHEMA statements. LIMITING factors: deployments where only trusted administrators create tenants, or where the application generates/slugifies the name (e.g. slugify() or an ^[a-z0-9_-]+$ check), are NOT affected; exploitation requires the PR:L ability to register or influence a tenant and does not require the tenant schema to exist first for the search_path path. Impact scales with the database role's privileges - from cross-tenant read/write up to full database control, and command execution on the host if the role is a superuser.

Impact

This is a genuine high-severity SQL injection (CWE-89) with strong severity signals but a meaningful exploitability gate. Both the input CVSS 4.0 vector (8.7: AV:N/AC:L/AT:N/PR:L/UI:N, VC/VI/VA:H) and the GHSA's CVSS 3.1 score (8.8: AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H) agree: network-reachable, low complexity, low privileges, no user interaction, full confidentiality/integrity/availability impact on the database. No CISA KEV listing and no EPSS score are provided, and no public exploit is referenced, so there is no evidence of active or at-scale exploitation; the vuln.today Decision label is 'this_week' (not act_now/emergency), consistent with a serious but not actively-exploited flaw. The key tempering factor is PR:L plus a configuration precondition: exploitation only applies where the application lets an untrusted user set or influence a tenant's schema_name without its own sanitisation. Where that condition holds (self-service tenant sign-up deriving the schema from a subdomain or org name), the real-world severity matches the score, because the SET search_path path fires on essentially every request and psycopg permits stacked statements; where tenants are created only by trusted admins or the app slugifies names, the flaw is not reachable. Conclusion: treat as a real priority (prompt patching) for multi-tenant SaaS using django-tenants with user-influenced schema names, rather than a high-CVSS-but-low-real-risk item - but note the auth and configuration dependency when prioritising.

Exploit ScenarioDerived

An attacker registers a tenant through a self-service sign-up flow that derives the PostgreSQL schema_name from user-supplied input (e.g. a subdomain or organisation name) and relies on django-tenants to validate it. They supply a schema_name containing a single quote or other quote/semicolon characters, which django-tenants (3.4.8-4.0.0) interpolates unescaped into SET search_path (and CREATE/DROP/ALTER SCHEMA) statements, appending another tenant's schema to the search path or running stacked SQL as the application's database role. No public exploit is identified at time of analysis, though the patch commit's test cases demonstrate working injection payloads such as "tenant1', 'public" and 'tenant1"; CREATE SCHEMA "injected'.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.3% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Nov 16, 2026

SQL injection in django-tenants 3.4.8 through 4.0.0 lets a low-privileged, authenticated actor (CVSS PR:L) who can register or otherwise influence a tenant's schema_name inject arbitrary SQL into the PostgreSQL statements the library builds. Because a tenant's schema name is string-interpolated into SET search_path - issued on essentially every request served for that tenant - as well as CREATE, DROP and ALTER SCHEMA, a quote character in the name can expose other tenants' tables to unqualified ORM queries or append arbitrary SQL executed as the application's database user, with impact scaling from cross-tenant read/write to full database control (and host command execution if that role is a superuser). Exploitation is gated on the application accepting an untrusted schema name without its own sanitisation; deployments where administrators alone create tenants, or where names are generated or slugified (for example slugify() or an ^[a-z0-9_-]+$ check), are not affected. No public exploit code was identified at time of analysis, and the vendor has released a patch in 4.0.1.

RemediationAI

Vendor-released patch: upgrade to django-tenants 4.0.1 (release tag https://github.com/django-tenants/django-tenants/releases/tag/v4.0.1, fixing commit 46d89c0fccc820f88657e6ec152ba855072571ff), which introduces quote_schema_name() at every SQL sink and tightens the schema-name validator. Before or during the upgrade, audit existing tenant names, because any tenant whose schema_name contains " ' \ ; newline or NUL will now raise a ValidationError when used - the advisory provides a check such as SELECT schema_name FROM <tenant table> WHERE schema_name ~ '[\"''\\;]' OR schema_name ~ '[\r\n]' and notes such names are extremely unusual. If upgrading immediately is not possible, the vendor's stated mitigation is for the application to generate or sanitise schema_name itself, for example restricting it to ^[a-z0-9_-]+, and to audit existing tenant names for quote and semicolon characters; note this only closes the application-side entry point and does not fix the library's interpolated SQL. The vendor's advisory (GHSA-693j-7v9f-x7pw) frames the upgrade as the complete fix.

Affected VersionsENISA

django-tenants 3.4.8 <4.0.1

Affected Packages

euvd django_tenants fix: 4.0.1

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

django-tenants implements schema-based multi-tenancy for Django on PostgreSQL, switching each connection's search_path to route ORM queries into the tenant's schema; the vulnerable component is the PostgreSQL backend (django_tenants/postgresql_backend/base.py) plus the tenant model's schema lifecycle methods. Root cause is CWE-89: schema names were placed into SQL by Python string interpolation rather than identifier quoting/parameterisation. The weakness was introduced in 3.4.8 (commit 02af6fa, 'Allow schema names with special chars'), which replaced the strict validator ^[_a-zA-Z0-9]{1,63}$ with ^(?!pg_).{1,63}$ - the surrounding SQL was already interpolated, and only the old validator kept quote characters away from it. Reachable sinks include _handle_search_path (formatted_search_paths built as '{}' strings, lines 208-213 of v4.0.0) fired on tenant connection switching and during first migration when automatic schema creation is enabled, the CREATE SCHEMA and DROP SCHEMA statements in models.py, and ALTER SCHEMA ... RENAME via schema_rename(). Since psycopg allows multiple statements in a single parameterless execute(), an injected payload can both extend the search path and terminate the statement to run additional SQL as the application's database user. The 4.0.1 fix adds a quote_schema_name() helper that escapes embedded double quotes and quotes the name as a PostgreSQL identifier (Django's connection.ops.quote_name() was insufficient because it does not escape inner double quotes), tightens the validator to reject " ' \ ; line breaks and NUL because the bundled clone_schema() PL/pgSQL function still interpolates the name, and restores the introspection search path verbatim from SHOW search_path instead of rebuilding it from unescaped parts.

Know when PostgreSQL gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (VulnCheck) PRIMARY 8.7 HIGH
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
vuln.today AI 8.8 HIGH

Remote, low-complexity injection; attacker must register or influence a tenant schema name so PR:L; stacked SQL as the DB user yields full C/I/A; scope unchanged as impact stays within the database authorization context.

3.1 AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
4.0 AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N

Primary rating from Vendor (VulnCheck).

CVSS VectorVendor: VulnCheck

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
None
Privileges Required
Low
User Interaction
None
Vulnerable system: Confidentiality
High
Vulnerable system: Integrity
High
Vulnerable system: Availability
High
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

DescriptionCVE.org

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.

Technical POC Analysis

CWE-89.

Full technical POC analysis - root cause, step-by-step exploitation and patch breakdown - is part of the Pro and Business plans.

Executive ViewAI

Why It Matters

CVE-2026-130082 is a high-severity SQL injection in the django-tenants library (versions 3.4.8 through 4.0.0) used by our multi-tenant applications, allowing a low-privileged authenticated user to potentially read or alter other tenants' data and, in the worst case, gain control of the underlying database. Any business unit whose application lets end users influence or register tenant schema names is exposed to cross-tenant data leakage and integrity risk, which carries regulatory, customer-trust, and contractual implications that warrant leadership attention.

Business Impact: High
Compensating Controls

Vendor-released patch: apply the fixed django-tenants version per the vendor advisory. Interim mitigations: enforce slugify() or an ^[a-z0-9_-]+$ validation on schema_name, restrict tenant creation to administrators, and ensure the application database user is not a superuser.

Threat Intelligence Overview

EPSS Score
0.3%
Top 77% exploitable
Prevalence
Low
niche PostgreSQL-only Django multi-tenancy library, limited overall deployment footprint
Social Media
2
Sightings
Data Quality
4 sources
Confidence: Medium

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.3%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Scheduled
Exploitation
None
System Exposure· derived
Open
Automatable
No
Human Impact
High
Technical Impact
Total

Priority Score

44
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +44
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

SQL injection exploits the way applications construct database queries by mixing user input directly into SQL statements.

CVE-2025-1094 HIGH POC
8.1 Feb 13

PostgreSQL libpq functions PQescapeLiteral(), PQescapeIdentifier(), PQescapeString(), and PQescapeStringConn() improperl

CVE-2024-55964 CRITICAL POC
9.8 Mar 26

An issue was discovered in Appsmith before 1.52. Rated critical severity (CVSS 9.8), this vulnerability is remotely expl

CVE-2013-1899 MEDIUM POC
6.5 Apr 04

Argument injection vulnerability in PostgreSQL 9.2.x before 9.2.4, 9.1.x before 9.1.9, and 9.0.x before 9.0.13 allows re

CVE-2026-20253 CRITICAL POC
9.8 Jun 10

Unauthenticated arbitrary file write in Splunk Enterprise (below 10.2.4 and 10.0.7) and Splunk Cloud Platform (below 10.

CVE-2026-9586 CRITICAL POC
9.3 Jul 17

Unauthenticated SQL injection in Sangoma Switchvox SMB Edition 8.3 (build 104997) lets remote attackers execute arbitrar

CVE-2017-7546 CRITICAL
9.8 Aug 16

PostgreSQL versions before 9.2.22, 9.3.18, 9.4.13, 9.5.8 and 9.6.4 are vulnerable to incorrect authentication flaw allow

CVE-2015-1352 MEDIUM POC
5.0 Mar 30

The build_tablename function in pgsql.c in the PostgreSQL (aka pgsql) extension in PHP through 5.6.7 does not validate t

CVE-2024-10553 CRITICAL POC
9.8 Mar 20

A vulnerability in the h2oai/h2o-3 REST API versions 3.46.0.4 allows unauthenticated remote attackers to execute arbitra

CVE-2019-9193 HIGH POC
7.2 Apr 01

In PostgreSQL 9.3 through 11.2, the "COPY TO/FROM PROGRAM" function allows superusers and users in the 'pg_execute_serve

CVE-2026-40887 CRITICAL POC
9.1 Apr 14

Unauthenticated SQL injection in Vendure Shop API allows remote attackers to execute arbitrary SQL commands against the

CVE-2022-24760 CRITICAL POC
10.0 Mar 12

Parse Server is an open source http web server backend. Rated critical severity (CVSS 10.0), this vulnerability is remot

CVE-2025-56157 CRITICAL POC
9.8 Dec 18

Hard-coded default PostgreSQL credentials shipped in the docker-compose.yaml of langgenius Dify through version 1.5.1 al

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy