How to fix: SQL Injection (Error-Based)
A form on this page was submitted with a single unescaped quote, and the response contained a recognizable database error message. This shows the input reaches a SQL query without being sanitized or parameterized, the injection point a real SQL injection attack would use.
Why it matters
An attacker who can inject SQL through this input can typically read, modify, or delete data outside what the application intends to expose, and in many configurations can escalate to reading arbitrary tables, bypassing authentication, or in the worst case executing commands on the database host.
This is a confirmed, active finding: the scanner submitted a value designed to break a naively-built SQL query and observed the database's own error output in the live response, not a static pattern match. The active-probing category that produced it is opt-in and off by default, since submitting real requests to a target is a materially different action than reading its responses.
How to fix it
- 1Use parameterized queries / prepared statements everywhere user input reaches a database query. Never build SQL by string concatenation or template interpolation.
- 2If an ORM is in use, avoid its raw-query / `whereRaw`-style escape hatches for anything touching user input.
- 3Apply least-privilege database credentials for the application account, so even a successful injection is limited in blast radius.
- 4Turn off detailed database error messages in production responses; a generic error page removes this exact detection signal from attackers too.
- 5Re-run this scan after the fix to confirm the canary no longer produces a database error.
Code examples
Parameterize, never concatenate
// Bad: user input concatenated straight into the query
const rows = await db.query(`SELECT * FROM users WHERE email = '${email}'`);
// Good: the driver binds the value, never interpolates it into SQL text
const rows = await db.query('SELECT * FROM users WHERE email = $1', [email]);References
Detected automatically by VulnRadar. The check id is sql-injection-error-based, stable across every scan so you can filter or diff on it.
More active probing checks
- CriticalReflected Cross-Site Scripting (XSS)
- CriticalServer-Side Template Injection (SSTI)
- CriticalOS Command Injection
- MediumConfirmed Open Redirect
Questions
- How severe is SQL Injection (Error-Based)?
- VulnRadar rates this critical severity in the active probing category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id sql-injection-error-based, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does SQL Injection (Error-Based) map to?
- It maps to CWE-89. In the OWASP Top 10 it falls under A03:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.