Skip to Content

CompTIA Security+ (Plus): Which Vulnerability Allows Authentication Bypass with ‘ OR 1=1; — in a Login Form?

Which vulnerability lets attackers bypass authentication by injecting ‘ OR 1=1; — into a login form? Learn how SQL injection works, why it’s dangerous, and how to prevent it—essential for CompTIA Security+ (Plus) SY0-701 exam success.

Table of Contents

Question

A penetration tester enters the following input into a login form: ‘ OR 1=1; —

The application bypasses authentication and grants access. Which vulnerability is present?

A. Command injection
B. LDAP injection
C. SQL injection
D. Cross-site scripting (XSS)
E. IDOR

Answer

C. SQL injection

Explanation

The OR 1=1 condition always evaluates to true, allowing unauthorized access. This is a classic SQL injection attack.

The vulnerability present when a penetration tester enters ‘ OR 1=1; — into a login form and successfully bypasses authentication is SQL injection.

Detailed Explanation:

SQL injection (SQLi) occurs when user input is improperly sanitized and is directly incorporated into a SQL query. This allows attackers to manipulate the query’s logic and interact with the database in unintended ways.

In the example, the input ‘ OR 1=1; — modifies the SQL statement so that the condition always evaluates to true (1=1), and the — sequence comments out the rest of the query. This tricks the application into granting access without valid credentials.

The attack works because the application’s SQL query becomes something like:

SELECT * FROM users WHERE username = '' OR 1=1; -- ' AND password = ''

Here, OR 1=1 always returns true, so the database returns a user record, bypassing authentication entirely.

This vulnerability is severe because it can lead not only to authentication bypass but also to data leakage, modification, or deletion depending on the context and query structure.

Preventing SQL injection requires input validation, using parameterized queries (prepared statements), and minimizing direct user input in SQL statements.

SQL injection allows attackers to manipulate database queries, enabling authentication bypass and potentially exposing or altering sensitive data.

CompTIA Security+ (Plus) SY0-701 certification exam practice question and answer (Q&A) dump with detail explanation and reference available free, helpful to pass the CompTIA Security+ (Plus) SY0-701 exam and earn CompTIA Security+ (Plus) SY0-701 certification.