A software developer discovers that a user feedback form concatenates untrusted input directly into a database query string, allowing arbitrary database command execution. Which of the following is the MOST effective coding practice to mitigate this vulnerability?
- Implement parameterized queries using prepared statementsCevap
- BApply HTML entity output encoding to all web server responses
- CEnforce multi-factor authentication for user login requests
- DConfigure network firewall rules to block inbound database port access
Cevap
Implementing parameterized queries using prepared statements is the most effective mitigation control.
Implementing parameterized queries (prepared statements) guarantees that the database engine treats user input strictly as literal data rather than executable SQL instructions. This prevents SQL injection vulnerabilities regardless of the characters supplied in the web form.
Adım Adım Çözüm
Anahtar Kavram
SQL Injection Remediation via Parameterized Queries