Threats, Vulnerabilities, and Mitigations

A login form passes the username into a SQL string. Analysts see a payload starting with ' UNION SELECT returning data in the page, and the application account also owns the database. Which action BEST stops this class of attack?

Show the answer

Correct answerC. Use parameterized queries with a least-privilege database account

AWhy not this: Keyword blocklists are bypassed with encoding, case changes and comments, so the flaw remains.

BWhy not this: Output encoding prevents script injection in pages but does not stop altered SQL queries.

CWhy this is right: Separates code from data so injected SQL is never parsed as a command, and limits what the account can reach.

DWhy not this: Session timeouts do not affect how the query is built from untrusted input.

Parameterized queries keep user input as data, never executable SQL, and a least-privilege account limits damage if a flaw remains. Output encoding addresses cross-site scripting, not SQL structure being altered by input.