Cybersecurity

SQL injection

An attack that sneaks database commands into a form or URL to read, change or delete data.

By Nick Irmo · Updated

What SQL injection means

SQL injection can expose customer records or take over a site. It happens when code passes user input straight to the database. Modern frameworks, careful plugin choices, updates and a WAF prevent most cases.

Why it matters for your website

A successful attack can expose customer records, wipe content or give an attacker admin access, which can lead to legal trouble and lost trust. Since it often targets everyday forms and search boxes, any site with a database can be at risk.

Example

A hypothetical custom-built booking site plugs search box text straight into a database query, and an attacker types commands that dump the customer list.

Tips

  • Make sure developers use parameterized queries or prepared statements.
  • Keep your CMS, plugins and frameworks updated to get security fixes.
  • Give the website's database user only the permissions it really needs.

Common mistakes

  • Trusting that hiding a form or adding front-end checks blocks attacks.
  • Running old custom code that nobody has reviewed for security in years.

Questions about SQL injection

What is SQL injection?
An attack that sneaks database commands into a form or URL to read, change or delete data.
How do I know if my site is vulnerable to SQL injection?
A vulnerability scan or a security review by a developer can test your forms and URLs. Old custom code and outdated plugins are the most common weak spots.
Can a web application firewall stop SQL injection?
A WAF can block many common attempts and adds useful protection. It is not a replacement for writing secure code, since attackers sometimes find ways around filters.

Learn more

Tell us what the site needs to do.

Share a few details and a budget range. We reply within one business day with a plan, a platform recommendation and a fixed quote.