QuestionQ56

VerifiedNetwork Access Exploitation

While conducting a code audit, you identify a SQL injection vulnerability with the following vulnerable query. What user input could be injected to make the query evaluate as true and return data?

select * from widgets where name = '[user-input]';

Explanation

A single quote can terminate the intended string literal, OR 1=1 creates an always-true predicate, and the SQL -- comment marker suppresses the trailing quote appended by the query construction. This lets the query return rows regardless of the name value. OWASP identifies this pattern as SQL injection and notes that a comment character can remove a trailing single quote left after altering a query.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!