Command Injection in Django

How Command Injection Manifests in Django

Command injection in Django applications typically occurs when user input is passed directly to system calls without proper sanitization. Django's architecture creates several unique attack vectors that developers must understand.

The most common pattern involves using Python's subprocess module within Django views or management commands. Developers often write code like:

 

Related CWEs: inputValidation

CWE IDNameSeverity
CWE-20Improper Input Validation HIGH
CWE-22Path Traversal HIGH
CWE-74Injection CRITICAL
CWE-77Command Injection CRITICAL
CWE-78OS Command Injection CRITICAL
CWE-79Cross-site Scripting (XSS) HIGH
CWE-89SQL Injection CRITICAL
CWE-90LDAP Injection HIGH
CWE-91XML Injection HIGH
CWE-94Code Injection CRITICAL