Skip to content

Explain how unsafe query construction can allow a login bypass, and describe why parameterized queries address the underlying cause.

Answer

When an application combines user input directly with SQL instructions, crafted input may change the condition used to authenticate a user. For example, an always-true condition or a comment marker may alter the logic or ignore part of a statement. Parameterized queries keep input values separate from query instructions, so the database treats the supplied content as data rather than executable query structure.

Explanation

### What a good answer covers - Explain that unsafe construction mixes user input with database instructions. - Describe how altered conditions can change authentication logic. - Identify that a comment marker can cause later query text to be ignored in the simplified example. - Explain that parameterization separates values from instructions and addresses the underlying cause. ### Terms - **SQL**: Structured Query Language, used to create and query relational databases. - **Parameterized query**: a query that passes input values separately from its instructions. - **Authentication**: checking whether a user is who they claim to be. ### Remember A login bypass is possible when input can rewrite the authentication query.

Related Questions

Want to practice more questions like this?

Join myBenkio free and practice past questions for your Nigerian university courses with AI explanations for every answer.

Start Practicing Free