# Is SQL injection 1 or 1 '=' 1?

Since 1 always equals 1, all rows are retrieved. While this injection may occasionally result in a successful login, one must consider the developer's perspective. If a developer expects only one matching row for valid credentials, they would code the login check accordingly.

Bron: [Avoid “OR 1=1” in SQL Injections - TCM Security](https://tcm-sec.com/avoid-or-1-equals-1-in-sql-injections/#:~:text=Since%201%20always%20equals%201,code%20the%20login%20check%20accordingly.)

Onderwerp: [Techniek & internet](https://1001vragen.nl/onderwerp/techniek-en-internet)
Toegevoegd: 2024-04-17
Webpagina: https://1001vragen.nl/vraag/is-sql-injection-1-or-1-1

## What is or 1 1 in SQL?

When you use 1=1 as the condition, it essentially means where true . Since the equality condition 1=1 is always true, the WHERE clause does not filter out any records. In other words, it returns all the records from the table without any filtering.

Bron: [Why Use 'WHERE 1=1' in SQL Queries? - PushMetrics](https://pushmetrics.io/blog/why-use-where-1-1-in-sql-queries-exploring-the-surprising-benefits-of-a-seemingly-redundant-clause/#:~:text=When%20you%20use%201%3D1,the%20table%20without%20any%20filtering.)

## What is the rule for SQL injection?

To detect SQL injection attacks, this rule uses a scoring system that analyzes the inputs in the application. The scoring system works by grouping and assigning a score to the common characters and strings used in SQL injection attacks.

Bron: [Understanding the Generic SQL Injection Prevention rule](https://success.trendmicro.com/dcx/s/solution/1098159-understanding-the-generic-sql-injection-prevention-rule?language=en_US&sfdcIFrameOrigin=null#:~:text=To%20detect%20SQL%20injection%20attacks,used%20in%20SQL%20injection%20attacks.)

## What characters are used in SQL injection?

Bron: [Validate All Input](https://learn.microsoft.com/en-us/sql/relational-databases/security/sql-injection?view=sql-server-ver16)

## How is SQL injection identified?

Testers find a SQL injection vulnerability if the application uses user input to create SQL queries without proper input validation. Successful exploitation of this class of vulnerability allows an unauthorized user to access or manipulate data in the database, which if you didn't know already is quite bad.

Bron: [Testing for SQL Injection - WSTG - Latest | OWASP Foundation](https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/07-Input_Validation_Testing/05-Testing_for_SQL_Injection#:~:text=Testers%20find%20a%20SQL%20injection,know%20already%20is%20quite%20bad.)

## Verwante vragen

- [Is SQL injection still possible?](https://1001vragen.nl/vraag/is-sql-injection-still-possible.md)
- [Wat kun je doen met SQL?](https://1001vragen.nl/vraag/wat-kun-je-doen-met-sql.md)
- [Wat betekent 1 1 in SQL?](https://1001vragen.nl/vraag/wat-betekent-1-1-in-sql.md)
- [Is SQL_Latin1_General_CP1_CI_AS case sensitive?](https://1001vragen.nl/vraag/is-sql-latin1-general-cp1-ci-as-case-sensitive.md)
- [Is <> and != the same in SQL?](https://1001vragen.nl/vraag/is-and-the-same-in-sql.md)
- [Is any SQL case sensitive?](https://1001vragen.nl/vraag/is-any-sql-case-sensitive.md)
- [Wat is de UNION-functie in SQL?](https://1001vragen.nl/vraag/wat-is-de-union-functie-in-sql.md)
- [Hoe combineer je twee SELECT-query's in SQL met verschillende kolommen?](https://1001vragen.nl/vraag/hoe-combineer-je-twee-select-query-s-in-sql-met-verschillende-kolommen.md)
- [Hoe gebruik je UNION en UNION ALL in SQL?](https://1001vragen.nl/vraag/hoe-gebruik-je-union-en-union-all-in-sql.md)
- [Wat doet UNION SELECT in SQL?](https://1001vragen.nl/vraag/wat-doet-union-select-in-sql.md)
