On this page
What this issue is
SQL (Structured Query Language) is the language websites use to talk to their database. SQL injection happens when a form field, such as a name, email, search box or coupon code, is pasted directly into a SQL query. An attacker types SQL code instead of normal text, and the database runs it as a command.
Forms are a common target because they take free text from anyone on the internet and often save it to a database. Contact forms, login forms, search boxes, booking forms and checkout fields can all be affected, as can hidden fields and URL parameters.
<?php
$email = $_POST['email'];
$result = $db->query("SELECT * FROM leads WHERE email = '$email'");
// If email is: ' OR '1'='1
// the query now matches every row.Why it costs you leads or sales
A successful attack can expose your leads and customer data, change or delete records, create admin accounts or let an attacker take over the site. That means lost lead data, broken forms, a site taken offline and possible legal duties if personal data leaks, such as breach notification under GDPR.
Search engines and browsers can also flag a hacked site with warnings, and ad platforms can suspend accounts that point to compromised pages. Visitors who see a warning do not fill in your form.
- Visitor submits formField contains SQL code
- Server builds queryInput pasted into SQL string
- Database runs itAttacker's command executes
- Data exposed or changedLeads, users, orders at risk
The break happens at the query step, where input is treated as code.
How to check if your site has it
List every input
Write down each form, search box, login, filter and URL parameter (such as ?id=) that reaches your database.
Look for database errors
On staging, submit a single apostrophe (') in a text field. A raw SQL error message, a blank page or a 500 error suggests the input is not handled safely. A clean response does not prove you are safe.
Run an automated scanner
Use a web vulnerability scanner such as OWASP ZAP against staging. It tries many injection patterns that manual testing misses.
Review the code
Search custom code for queries built with string joining, such as concatenation or variables inside quotes. Each one is a suspect.
Check your plugins
Search the vulnerability databases for your plugins and themes by name and version. Many real-world injections come from outdated third-party code.
Read the logs
Look in server and web application firewall logs for requests containing strings like UNION SELECT, OR 1=1 or sleep(.
How to fix it
The core fix is the same everywhere: keep SQL code and user data separate. A prepared statement sends the query shape first and the values second, so the database never treats a value as a command.
Vulnerable
- Input joined into the SQL string
- Database account can change or drop any table
- Detailed SQL errors shown to visitors
Fixed
- Prepared statements with bound values
- Least-privilege database account
- Generic error message, details only in logs
Update everything
Update WordPress core, plugins and themes under Dashboard > Updates. Remove plugins you do not use or that are no longer maintained.
Use $wpdb->prepare in custom code
Replace any query built with string joining by $wpdb->prepare() with %s and %d placeholders. See the code example below.
Report plugin flaws
If a plugin is vulnerable and has no patch, replace it and tell the author through the plugin's support page.
Switch to parameterized queries
Use PDO or mysqli prepared statements (PHP), or the equivalent in your language: parameterized queries in Node, Python, Java and .NET database drivers.
Validate input
Check type, length and format on the server, for example an integer for IDs and an allowlist for sort columns. Validation is a second layer, not a replacement for prepared statements.
Limit database permissions
Give the web app's database user only the rights it needs (usually SELECT, INSERT, UPDATE on specific tables). Never use the root or admin account.
Hide error details
Turn off display of database errors in production and log them privately.
Check what you control
Shopify runs the database layer, so injection risk sits mainly in third-party apps and custom apps that use their own databases. Review installed apps and remove ones you do not use.
Contact app developers
If an app that takes form input stores data on its own server, ask the developer how they prevent injection and whether they have been security reviewed.
Check your integrations
Webflow hosts the forms and database for you. Review any custom backend, serverless function or third-party form handler that receives submissions, and apply parameterized queries there.
Review Velo code
Standard Wix forms are handled by Wix. If you use Velo (Wix's code feature) with an external database or custom backend, use parameterized queries there and validate input.
<?php
$stmt = $pdo->prepare('SELECT * FROM leads WHERE email = :email');
$stmt->execute([':email' => $_POST['email']]);
$rows = $stmt->fetchAll();<?php
global $wpdb;
$email = sanitize_email( $_POST['email'] ?? '' );
$row = $wpdb->get_row(
$wpdb->prepare(
"SELECT * FROM {$wpdb->prefix}leads WHERE email = %s",
$email
)
);How to confirm it's fixed
- Every query that uses form or URL input now uses prepared statements
- A single apostrophe in each field no longer produces a database error
- A rescan of staging with your vulnerability scanner shows no injection findings
- Production shows a generic error page, not SQL details
- The database user has only the permissions it needs
- Plugins, themes and core are on current versions
- Normal submissions still save correctly, including names like O'Brien
How to prevent it happening again
- Make prepared statements the rule in code review
- Update core, plugins and themes on a schedule
- Remove abandoned plugins
- Run a vulnerability scan after each major release
- Schedule a penetration test for sites that hold sensitive data
- Keep tested, offsite backups so you can recover
- Review web server and WAF logs for injection patterns
How FunnelGuard handles this
This issue is outside what FunnelGuard checks. FunnelGuard is a synthetic monitoring service: a robot visitor runs your real customer journeys, such as lead forms and checkouts, and checks that steps, tracking and lead delivery work. It does not probe your forms for injection flaws.
Questions people ask
What is SQL injection in a form?
SQL injection is an attack where someone types database commands into a form field and the website runs them as part of a query. It happens when the site builds SQL by joining raw input into a string. It can expose, change or delete stored data.
How do I prevent SQL injection in a contact form?
Use prepared statements (parameterized queries) for every database query that includes form input. Add server-side validation, use a database account with minimal permissions and hide detailed error messages. Keep your CMS and plugins updated.
How can I test my website for SQL injection?
On a staging copy you own, submit an apostrophe in each field and look for database errors, then run a scanner such as OWASP ZAP. For sensitive sites, hire a security professional for a penetration test. Never test sites you do not have permission to test.
Is WordPress vulnerable to SQL injection?
WordPress core is regularly patched, but outdated or poorly written plugins and themes are a common source of SQL injection. Keep everything updated, delete unused plugins and use $wpdb->prepare() in any custom code.
Does input validation stop SQL injection?
Not on its own. Validation helps by rejecting unexpected input, but the reliable defence is prepared statements, which keep data and SQL code separate. Use both.
Does a web application firewall fix SQL injection?
A WAF can block many common attack patterns, but it does not remove the vulnerability. Fix the code with parameterized queries and treat the WAF as an extra layer.
Can FunnelGuard detect SQL injection?
No. FunnelGuard checks that your funnels, tracking and lead delivery work, not for security flaws. Use a vulnerability scanner, WAF or penetration test for SQL injection.