A software development team at a financial services company is building a new customer portal. During a code review, a security architect notices that the developers are using string formatting to construct database queries with data from user-submitted web forms. The architect is concerned about the risk of SQL injection. Which of the following recommendations would be the MOST effective and robust long-term solution to mitigate this specific vulnerability class in the application?
Parameterized queries (also known as prepared statements) are the correct solution because they separate SQL code from data by using placeholders for parameters. This ensures that user input is always treated as data rather than executable code, effectively preventing SQL injection attacks regardless of the input content.
Input sanitization involves filtering or cleaning user input to remove potentially malicious characters. While this can help reduce the risk of SQL injection, it is not as reliable as parameterized queries because sanitization filters can often be bypassed by sophisticated attacks and may not address all possible injection vectors.
Error handling focuses on managing application responses when errors occur. While proper error handling is important for security (preventing information leakage that could aid an attacker), it does not prevent SQL injection attacks from occurring in the first place. It might hide error details from attackers but does not fix the underlying vulnerability.
Secure logging is the practice of properly recording application events without exposing sensitive information. While logging is crucial for security monitoring and incident response, it does not prevent SQL injection attacks. Logging would only record that an attack happened but would not stop it from succeeding.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
Why are parameterized queries considered more secure than input sanitization?
Open an interactive chat with Bash
What is SQL injection and how does it exploit vulnerabilities?
Open an interactive chat with Bash
Can you provide an example of how a parameterized query is implemented?
Open an interactive chat with Bash
ISC2 CISSP
Software Development Security
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .