A web form escapes input and stores it safely, but a nightly report job later concatenates the stored value into a SQL statement, and attacker-supplied commands run. Which fix best addresses the root cause?
Show the answer
Correct answerC. Use parameterized queries in the report job
AWhy not this: A WAF only inspects traffic to the form; the stored value reaches the database later, from the job.
BWhy not this: HTML encoding protects browser output; it does nothing for SQL built inside the job.
CWhy this is right: Binding stored values as parameters keeps them as data, fixing the flaw where the SQL is built.
DWhy not this: Entry-point validation can be bypassed and leaves the vulnerable concatenation in the report job untouched.
This is second-order injection: stored data is trusted later and concatenated into SQL. Parameterized queries at the point of use keep data separate from code. Validation or a WAF at the form does not protect the report job's vulnerable query.