CWE-89
SQL injection
Keep values sent to a database separate from the SQL instructions it runs.
What can go wrong
When an application inserts input directly into SQL syntax, the input can change the query. Depending on the database account's permissions, this could expose private records, change data, or delete it.
Check your application
Check which inputs reach the query, which records it can access, and what the application's database account is allowed to do in this deployment.
How to fix it
- Bind data values with the database driver's parameter API or your framework's documented query bindings.
- Map choices such as a sort field to a fixed set of column names in application code.
- Give the application's database account only the permissions its queries require.