Skip to main content
Support
0
Contact us
Nederlands
Deutsch
Español
Dedicated serversFlexible VPSCloud TechnologyColocationChallenges in ITSectorsCareers
Cloud Compute

With Cloud Compute, you have access anytime and anywhere to a portal through which you can configure your entire IT environment from wherever you are in the world.

Cloud Storage

Reliable access to your files, infrastructure, and applications at all times – with no interruptions or delays. At Worldstream, we offer a variety of storage solutions.

Flexible cloud icon
Flexible cloud
Private cloud icon
Private cloud
Bare metal icon
Bare Metal Compute
Hollow cube icon
Object storage
Hollow cube icon
File storage
Block storage icon
Block storage
Backup storage icon
Backup storage
Need support?

With experienced engineers and an average response time track record on 7 minutes, you can expect a solid technical support solution in next to no time.

All Servers

Choose your Dedicated Server now. Custom or Instant Delivery. Powerhouse servers built for your use case.

Use Cases

Whatever your use case, we’re here to help you find the ideal solution.

Deal servers icon
Deals
AMD servers icon
AMD Processors
AI servers icon
Intel Processors
Hollow cube icon
Virtualisation, Containerisation and Orchestration
Hollow cube icon
Websites and Applications
Hollow cube icon
Gaming and Streaming Infrastructure

24/7/365 support with an average response time of just 7 minutes. Thanks to our own data centers, our engineers can go directly to your server for fast, hands-on assistance. Email or call us anytime.

Smart outsourcing

Some IT creates added value, while other types are supportive. Use that as a starting point for outsourcing.

Cost Efficiency

Complete IT packages may seem like the safe option, but when you consider the costs, other choices often make more sense.

IT flexibility & control

Outsourcing doesn’t mean losing control; it actually provides more flexibility and control.

Cloud repatriation

The cloud is not a final destination: You should continuously evaluate and adjust your cloud environment as needs evolve.

Financial services
Logistics & Transportation
Retail & E-commerce
Media & Entertainment
Tech & Software Development
Security
Managed Service Providers
Need support?

With experienced engineers and an average response time track record on 7 minutes, you can expect a solid technical support solution in next to no time.

Chat with usContact us
About WorldstreamAbout the technologyCasesKnowledge base
About usMeet the teamJobsBecome a resellerCertificationsOur data centersOur networkDDoS ProtectionAMD EPYC serversTechnology PartnersOperating SystemsAll casesEasyTerraDutch Drone CompanyPerfGridArticlesFAQNews and BlogsProducts and Services
Contact us

Call +31 (0) 174 – 712 117

Industriestraat 53, Naaldwijk

Nederlands
Deutsch
Español
0
Dedicated serversFlexible VPSCloud TechnologyColocationChallenges in ITSectorsCareersAbout WorldstreamAbout the technologyCasesKnowledge baseMy Worldstream
Contact
Support
NederlandsDeutschEspañol
  1. HomeHome
  2. Knowledge Base
  3. Security
  4. What is SQL injection, and how to protect against it

What is SQL injection, and how to protect against it

Applies to Any application backed by a SQL databaseAudience Developer, technical evaluatorLast reviewed September 2026

Quick answer

SQL injection happens when untrusted input gets pasted directly into a database query as text, letting an attacker change what the query actually does. The standard defence is a parameterised query (also called a prepared statement), which keeps user input as data rather than letting it become part of the query's structure. It's available in essentially every modern database library, and it's the real fix, not just one layer among several.

On this page
  • How SQL injection actually happens
  • A simple illustrative example
  • The real fix: parameterised queries
  • Additional layers, not substitutes

How SQL injection actually happens

A SQL injection vulnerability starts with untrusted input, anything a user can control such as a form field, a URL parameter, or a cookie value, being concatenated directly into a database query as plain text. The application builds the query by joining strings together, sends the result to the database, and the database has no way to tell the difference between "the query the developer intended" and "the query as it now reads after the input was inserted". If that input contains SQL syntax of its own, it can change the meaning of the query entirely. An attacker who finds this can potentially read data they shouldn't see, modify records, or delete them, all through a field that was only ever meant to hold something like a username or a search term.

A simple illustrative example

Imagine a login check that builds its query like this, in plain terms: it takes the username typed into the form and inserts it directly into a string that reads something like "find the user where the username equals" whatever was typed. If a legitimate user types alice, the query ends up asking for the user named alice, which is exactly what was intended. But because the username was inserted as raw text, an attacker can type something that isn't a username at all, a fragment of SQL syntax designed to alter the query's logic, for example something that makes the "where" condition always evaluate as true regardless of what username was expected. The database doesn't see "an unusual username", it sees a modified query, and executes it as written.

Now compare that with a login check that uses a parameterised placeholder for the username instead. The query's structure, "find the user where the username equals a placeholder", is fixed and sent to the database first. The typed username is then supplied separately, as a value to slot into that placeholder, never as text that gets merged into the query itself. Whatever the attacker types is treated purely as the value being searched for, even if it contains characters that would have been dangerous in the concatenated version. The query's logic simply cannot be changed by what arrives in that field, because the database keeps the query's structure and the query's data in two separate channels from the start.

The real fix: parameterised queries

Parameterised queries, also known as prepared statements, are the standard defence, not an optional extra. They work by sending the query's structure to the database separately from the values that fill it in, so user input is always treated as data and never as part of the query's syntax, no matter what characters it contains. This isn't a niche feature: essentially every modern database library and ORM, across essentially every programming language, supports parameterised queries as a normal, idiomatic way to write a query. If a codebase is building queries by concatenating strings with user input anywhere, that's the specific pattern worth finding and replacing.

Additional layers, not substitutes

Parameterised queries are the fix for the injection mechanism itself, but two other practices are worth layering on top, as defence in depth rather than as alternatives:

  • Input validation. Checking that input looks like what it's supposed to be, an email field looks like an email, a numeric ID is actually numeric, catches malformed input early. It's a useful additional check, but it's not a substitute for parameterised queries, since validation logic can be incomplete or bypassed in ways a database driver's own parameter handling won't be.
  • Least-privilege database accounts. The database account an application connects with should only have the permissions that application actually needs. If a web application only ever needs to read and write specific tables, its database credentials shouldn't also carry permission to drop tables or read unrelated ones. This limits the damage if an injection flaw, or any other compromise, does happen, without preventing the flaw itself.

Both are worth doing. Neither replaces fixing the actual query-building pattern that lets injection happen in the first place.

Related articles

  • What is a Web Application Firewall (WAF), and how it differs from a network firewall
  • Hardening a fresh VPS: SSH keys, firewall and Fail2ban
Was this article helpful?

Solid IT. No Surprises

Sparring partner for IT maturity
Eliminating barriers so you can run
Predictable and transparant costs

Contact

  • Industriestraat 53, Naaldwijk
  • Payment Methods
  • Abuse
  • Developers Resources
  • Network Operations Center
  • About us
  • Meet the team
  • Jobs
  • Become a reseller
  • Certifications
  • Our data centers
  • Our network
  • DDoS Protection
  • AMD EPYC servers
  • Technology Partners
  • Operating Systems
  • Overview
  • FAQ
  • Cases
  • News & Blogs
  • Use Cases
Nederlands
Deutsch
Español
Nederlands
Deutsch
Español
  • Legal
  • Disclosure