Which is the recommended defense against SQL Injection? Group of answer choices…
- User
Which is the recommended defense against SQL Injection? Group of answer choices
Plaintext passwords
Direct SQL concatenation
Input validation and stored procedures
Disable SQL
Assistant
The correct answer is: Input validation and stored procedures
This is the recommended defense against SQL injection because:
-
Input validation ensures that user inputs are checked for malicious content before being processed. This includes:
- Validating data types
- Checking input length
- Filtering special characters
- Using whitelists for acceptable inputs
-
Stored procedures provide additional protection by:
- Separating SQL code from application code
- Parameterizing queries
- Limiting the permissions of the executing code
- Reducing the attack surface
The other options are incorrect:
-
Plaintext passwords: This is a security vulnerability, not a defense. Passwords should always be hashed and salted.
-
Direct SQL concatenation: This is actually the primary cause of SQL injection vulnerabilities, where user input is directly concatenated into SQL strings.
-
: This isn't practical for database-driven applications that require SQL to function.
-