Overview
Direct Answer
SQL injection is a code injection vulnerability that allows attackers to insert malicious SQL statements into input fields of database-driven applications, bypassing authentication or extracting unauthorised data. This occurs when user-supplied input is concatenated directly into SQL queries without proper sanitisation or parameterised preparation.
How It Works
Attackers craft specially formatted input strings containing SQL syntax that, when concatenated into a query, alter the intended logic. For example, entering a username field with ' OR '1'='1 changes a WHERE clause to always evaluate as true, circumventing login checks. The vulnerability exists because the application fails to distinguish between data and executable SQL commands.
Why It Matters
Organisations face significant financial and reputational damage from unauthorised database access, data breaches, and regulatory fines under standards such as GDPR and PCI DSS. Attackers exploit this technique to steal customer records, manipulate transactions, or disable critical systems with minimal technical effort.
Common Applications
This vulnerability affects web applications with login forms, search functionality, and content management systems. Financial services, healthcare platforms, and e-commerce systems remain frequent targets due to the sensitivity of stored information.
Key Considerations
Parameterised queries and prepared statements provide robust mitigation, though defence-in-depth strategies including input validation and least-privilege database accounts remain essential. Legacy applications and rapid development practices increase exposure risk.
More in Cybersecurity
Honeypot
Defensive SecurityA decoy system designed to attract attackers and study their methods while protecting real systems.
Phishing-Resistant Authentication
Identity & AccessAuthentication methods such as FIDO2 passkeys and hardware security keys that are immune to phishing attacks because credentials are cryptographically bound to the legitimate service.
Threat Modelling
Security GovernanceA structured approach for identifying, quantifying, and addressing security threats to a system or application.
Firewall
Network SecurityA network security device that monitors and filters incoming and outgoing network traffic based on security rules.
Attack Vector
Offensive SecurityThe specific path, method, or scenario used by an attacker to gain unauthorised access to a system.
Security Orchestration Automation and Response
Defensive SecurityTechnology that automates security operations by orchestrating tools and processes for incident response.
Encryption
Data ProtectionThe process of converting plaintext data into ciphertext using an algorithm, making it unreadable without the decryption key.
Incident Response Plan
Defensive SecurityA documented set of procedures for detecting, responding to, and recovering from cybersecurity incidents.