Django vulnerability classes
Where each class of flaw comes from in a Django codebase: the Django API that takes the untrusted value, a short vulnerable example with its fix, what Django already does for you, and the event es-python reports when request data reaches the operation anyway.
8 classes have a Django page. A class is listed only where it arises through Django's own API.
Facts about Django are taken from the Django documentation; each page cites the sections it used.
-
SQL injection in Django
Django's ORM binds every value for you, so SQL injection in a Django project comes from the handful of APIs that accept SQL text, and from request keys that are allowed to choose column names.
-
Command injection in Django
Django never runs a shell for you, so command injection in a Django project is always application code calling subprocess or os.system(), usually in a place that was written for an operator and later became reachable from a request.
-
Code injection in Django
Django is built on dotted-path strings and attribute names, so code injection in a Django project is less often a literal eval() and more often a request value used where the framework expects a name.
-
Server-side template injection (SSTI) in Django
Django templates loaded by name from disk are developer code; template injection starts when a view compiles a string that a user wrote, most often an email or notification template stored in the database.
-
Insecure deserialization in Django
A typical Django view never calls pickle.loads(), yet pickle is running under most Django sites, in the cache framework and sometimes in the task queue, so the question is who can write to those stores.
-
Path traversal in Django
Django's storage API handles upload names for you, so path traversal in a Django project usually comes from a download or export view that builds a filesystem path by hand and returns it with FileResponse.
-
Server-side request forgery (SSRF) in Django
In Django the URL that causes an SSRF has usually passed form validation, because Django's URL validation answers "is this a URL" and was never meant to answer "is this a safe place for my server to connect to".
-
Regular expression denial of service (ReDoS) in Django
Django runs developer-written regular expressions against attacker-chosen strings on every request, in URL routing and in validation, so one pattern with nested repetition can let a single request hold a worker for seconds.
See these flows in your own Django application
es-python runs your existing code unchanged and reports untrusted data that reaches one of these operations, with the path it took. A live demo walks through it on a real application.