Skip to content
SQL injection Write-up Intermediate

️ Critical Flaw: The “Secret Instruction” Hack in Django OR

Django's ORM accepted internal control keywords such as _connector when developers unpacked raw request parameters into filter calls, letting an attacker change the query logic from AND to OR. This could bypass the owner check and return other users' private documents.

Muhammed Asfan | Cybersecurity Researcher Follow

Published on medium.com

CVE‑2025‑64459 is a critical SQL-injection-class vulnerability arising from a common practice in Django development: accepting arbitrary query parameters and unpacking them directly into QuerySet methods like filter() or exclude().

Muhammed Asfan | Cybersecurity Researcher, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the ORM did not block internal control keywords such as _connector and _negated when they arrived through unpacked user input, so user data was treated as query logic.

Impact

An attacker could read other users' private documents and internal reports, though only applications that unpack raw request parameters into ORM filters are affected.

What the attacker needed

Application unpacks raw request parameters into ORM filters; attacker can send crafted query parameters

The fix

Django should be upgraded to a patched release that rejects these keywords, and applications should allowlist query parameters and build the filter dictionary explicitly instead of unpacking raw input.

How it was found

  1. Find a view that unpacks all request parameters into a filter call alongside an owner check.
  2. Send a broad filter condition such as a title contains match.
  3. Add the internal _connector parameter set to OR.
  4. Receive documents matching the broad condition even when the owner is someone else.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Django is a web framework, and its ORM is the part that turns Python filter calls into database queries. Some developers wrote code that passed every URL parameter straight into that filter, and Django treated special internal names like _connector as instructions rather than as ordinary search values. An attacker could therefore add a parameter that changed the ownership check from 'and' to 'or', so the database returned documents belonging to other people.

What is SQL injection?

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.

Similar reports

View all

Same bug class and techniques, clearest first.

SQL injection

The lesson behind this report.

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.