Book a call Free rebuild
Home/Glossary/Security/SQL Injection

SQL Injection

By Seahawk November 16, 2026

Security glossarySQL injection is an attack that slips database commands into a form field or URL, so a site that trusts the input runs the attacker's commands.

SQL injection is an attack in which someone types database commands into an input the site trusts, such as a search box, a form field, or a URL parameter. If the site pastes that input straight into an SQL query, the database runs the attacker's commands as if they were the site's own.

What it can do

Depending on the query and the database user's rights, an attacker can read data they should not see (customer records, password hashes), change or delete it, or create an administrator account for themselves.

Prevention

The fix is to keep data and code apart: use parameterized queries (prepared statements) so input is always treated as a value, never as part of the command. In WordPress that is $wpdb->prepare(). Validating input and giving the database user only the rights it needs limit the damage if something slips through. On WordPress sites, injection flaws usually come from plugins, which is one more reason to keep them updated.

Source: OWASP: SQL injection, WordPress developer docs: $wpdb::prepare().

WP Services

WordPress services at revolutionary pricing.

Productized WordPress services, from builds to care, delivered by Seahawk and tracked in one app. For the WordPress lovers.