Explore our new Cybersecurity Terms Glossary, explained by our experts.

View the Glossary View the Glossary
PRIVIA

Cybersecurity Terms Glossary

What Is SQL Injection?

SQL injection is a web application vulnerability in which untrusted input is inserted into a database query, letting attackers read, change, or delete data they should never reach.

Illustration for the cybersecurity term SQL Injection
Home / Blog / Cybersecurity Terms / What Is SQL Injection?
17 November 2026

What Is SQL Injection?

What Is SQL Injection?

SQL injection (SQLi) is a vulnerability that occurs when an application builds a database query by combining fixed SQL code with input supplied by a user, without handling that input safely. An attacker can then craft input that changes the meaning of the query, allowing them to read data they should not see, modify or delete records, bypass logins, and in some cases take control of the database server.

It is one of the oldest web vulnerabilities, first described publicly in the late 1990s, and it is still found regularly in penetration tests. Injection remains a category in the OWASP Top 10, the most widely used list of web application risks.

How SQL Injection Works

Consider a login form that builds its query like this:

SELECT * FROM users WHERE username = 'input' AND password = 'input'

If the application inserts the username directly, an attacker can enter a value such as admin' --, which closes the quoted string and turns the rest of the query into a comment. The password check disappears, and the attacker logs in as the administrator without knowing the password.

The same principle applies anywhere user input reaches a query: search boxes, URL parameters, cookies, HTTP headers, and API requests.

Types of SQL Injection

Automated tools such as sqlmap can detect and exploit these flaws quickly, which means even low-skilled attackers can abuse them.

Real-World Impact

SQL injection has caused some of the UK’s most notable breaches. In October 2015, attackers used SQL injection against legacy web pages at TalkTalk, accessing personal data of around 157,000 customers. The Information Commissioner’s Office fined the company £400,000, criticising its failure to fix a vulnerability that was easy to prevent. In May 2023, the Cl0p group exploited a SQL injection vulnerability in the MOVEit Transfer file transfer software (CVE-2023-34362), stealing data from hundreds of organisations worldwide. In the UK, staff data at British Airways, the BBC, and Boots was exposed through their payroll provider.

How to Prevent SQL Injection

The fix is well established:

A web application firewall can block many common SQL injection attempts and provide temporary protection, but it should never replace fixing the code.

Finding SQL Injection

Code review and static analysis tools can find unsafe query construction during development, especially when built into secure software development pipelines. Dynamic scanners and manual penetration testing find vulnerabilities in running applications, including complex blind and second-order cases that automated tools miss.

At Privia Security, our Web Application Security Services test your applications and APIs for SQL injection and other injection flaws, with clear remediation guidance for your developers.

FAQ – Frequently Asked Questions

Is SQL Injection Still a Problem Today?

Yes. Although modern frameworks make it easier to avoid, SQL injection still appears in legacy code, custom queries, reporting features, and third-party products. The MOVEit Transfer breach in 2023, which affected hundreds of organisations, was caused by a SQL injection vulnerability. It remains a standard part of every web application penetration test.

Does Input Validation Prevent SQL Injection?

Input validation helps, but it should not be relied on alone, because attackers are skilled at finding inputs that slip past filters. The reliable defence is parameterised queries, which keep code and data separate regardless of what the input contains. Validation, least privilege, and a web application firewall then add extra layers.

Are NoSQL Databases Immune to Injection?

No. NoSQL databases such as MongoDB do not use SQL, but they can still suffer from NoSQL injection when applications build queries from untrusted input, for example by accepting query operators inside JSON requests. The same principles apply: avoid building queries from raw input, validate data types, and use safe query APIs.

Related Terms

You May Be Interested In These

Why Are Default Passwords a Security Risk?

Cybersecurity Terms

17 November 2026

Why Are Default Passwords a Security Risk?

Read More
What Is Reverse Engineering?

Cybersecurity Terms

17 November 2026

What Is Reverse Engineering?

Read More