Django Tenants
Monthly
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.
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.