CWE-89: Improper Neutralization of Special Elements used in an SQL Command
21548 CVEs have CWE-89 as their primary weakness. 32 of them are in the CISA KEV catalog. The highest EPSS score among them is 99.974%.
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.
Child of CWE-943: Improper Neutralization of Special Elements in Data Query Logic
Mitigations
- Architecture and Design: Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid [REF-1482]. For example, consider using persistence layers such as Hibernate or Enterprise Java Beans, which can provide significant protection against SQL injection if used properly.
- Architecture and Design: If available, use structured mechanisms that automatically enforce the separation between data and code. These mechanisms may be able to provide the relevant quoting, encoding, and validation automatically, instead of relying on the developer to provide this capability at every point where output is generated. Process SQL queries using prepared statements, parameterized queries, or stored procedures. These features should accept parameters or variables and support strong typing. Do not dynamically construct and execute query strings within these features using exec or similar functionality, since this may re-introduce the possibility of SQL injection. [REF-867]
- Architecture and Design Operation: Run your code using the lowest privileges that are required to accomplish the necessary tasks [REF-76]. If possible, create isolated accounts with limited privileges that are only used for a single task. That way, a successful attack will not immediately give the attacker access to the rest of the software or its environment. For example, database applications rarely need to run as the database administrator, especially in day-to-day operations. Specifically, follow the principle of least privilege when creating user accounts to a SQL database. The database users should only have the minimum privileges necessary to use their account. If the requirements of the system indicate that a user can read and modify their own data, then limit their privileges so they cannot read/write others' data. Use the strictest permissions possible on all database objects, such as execute-only for stored procedures.
- Architecture and Design: For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server.
- Implementation: While it is risky to use dynamically-generated query strings, code, or commands that mix control and data together, sometimes it may be unavoidable. Properly quote arguments and escape any special characters within those arguments. The most conservative approach is to escape or filter all characters that do not pass an extremely strict allowlist (such as everything that is not alphanumeric or white space). If some special characters are still needed, such as white space, wrap each argument in quotes after the escaping/filtering step. Be careful of argument injection (CWE-88). Instead of building a new implementation, such features may be available in the database or programming language. For example, the Oracle DBMS_ASSERT package can check or enforce that parameters have certain properties that make them less vulnerable to SQL injection. For MySQL, the mysql_real_escape_string() API function is available in both C and PHP.
- Implementation: Assume all input is malicious. Use an accept known good input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does. When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, boat may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as red or blue. Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However,…
- Architecture and Design: When the set of acceptable objects, such as filenames or URLs, is limited or known, create a mapping from a set of fixed input values (such as numeric IDs) to the actual filenames or URLs, and reject all other inputs.
- Implementation: Ensure that error messages only contain minimal details that are useful to the intended audience and no one else. The messages need to strike the balance between being too cryptic (which can confuse users) or being too detailed (which may reveal more than intended). The messages should not reveal the methods that were used to determine the error. Attackers can use detailed information to refine or optimize their original attack, thereby increasing their chances of success. If errors must be captured in some detail, record them in log messages, but consider what could occur if the log messages can be viewed by attackers. Highly sensitive information such as passwords should never be saved to log files. Avoid inconsistent messaging that might accidentally tip off an attacker about internal state, such as whether a user account exists or not. In the context of SQL Injection, error messages revealing the structure of a SQL query can help attackers tailor successful attack…
- Operation: Use an application firewall that can detect attacks against this weakness. It can be beneficial in cases in which the code cannot be fixed (because it is controlled by a third party), as an emergency prevention measure while more comprehensive software assurance measures are applied, or to provide defense in depth [REF-1481.
- Operation Implementation: When using PHP, configure the application so that it does not use register_globals. During implementation, develop the application so that it does not rely on this feature, but be wary of implementing a register_globals emulation that is subject to weaknesses such as CWE-95, CWE-621, and similar issues.
Observed examples
- CVE-2024-6847: SQL injection in AI chatbot via a conversation message
- CVE-2025-26794: SQL injection in e-mail agent through SQLite integration
- CVE-2023-32530: SQL injection in security product dashboard using crafted certificate fields
- CVE-2021-42258: SQL injection in time and billing software, as exploited in the wild per CISA KEV.
- CVE-2021-27101: SQL injection in file-transfer system via a crafted Host header, as exploited in the wild per CISA KEV.
- CVE-2020-12271: SQL injection in firewall product's admin interface or user portal, as exploited in the wild per CISA KEV.
- CVE-2019-3792: An automation system written in Go contains an API that is vulnerable to SQL injection allowing the attacker to read privileged data.
- CVE-2004-0366: Chain: SQL injection in library intended for database authentication allows SQL injection and authentication bypass.
- CVE-2008-2790: SQL injection through an ID that was supposed to be numeric.
- CVE-2008-2223: SQL injection through an ID that was supposed to be numeric.
- CVE-2007-6602: SQL injection via user name.
- CVE-2008-5817: SQL injection via user name or password fields.
- CVE-2003-0377: SQL injection in security product, using a crafted group name.
- CVE-2008-2380: SQL injection in authentication library.
- CVE-2017-11508: SQL injection in vulnerability management and reporting tool, using a crafted password.
Top released CVEs
KEV first, then the highest EPSS score, the highest CVSS score and the newest.
| CVE | Published | Severity | CVSS | EPSS | Description |
|---|---|---|---|---|---|
| CVE-2024-29824 | 2024-05-31 | CRITICAL | 9.6 | 99.938% | An unspecified SQL Injection vulnerability in Core server of Ivanti EPM 2022 SU5 and prior allows an unauthenticated attacker within the same network to… |
| CVE-2023-34362 | 2023-06-02 | CRITICAL | 9.8 | 99.934% | In Progress MOVEit Transfer before 2021.0.6 (13.0.6), 2021.1.4 (13.1.4), 2022.0.4 (14.0.4), 2022.1.5 (14.1.5), and 2023.0.1 (15.0.1), a SQL injection… |
| CVE-2025-25257 | 2025-07-17 | CRITICAL | 9.6 | 99.921% | An improper neutralization of special elements used in an SQL command ('SQL Injection') vulnerability [CWE-89] vulnerability in Fortinet FortiWeb 7.6.0 through… |
| CVE-2019-7481 | 2019-12-17 | HIGH | 7.5 | 99.906% | Vulnerability in SonicWall SMA100 allow unauthenticated user to gain read-only access to unauthorized resources. This vulnerablity impacted SMA100 version… |
| CVE-2024-9465 | 2024-10-09 | CRITICAL | 9.1 | 99.626% | An SQL injection vulnerability in Palo Alto Networks Expedition allows an unauthenticated attacker to reveal Expedition database contents, such as password… |
| CVE-2026-72898 | 2026-08-10 | CRITICAL | 10.0 | 98.513% | Metabase allows a remote, unauthenticated attacker to inject arbitrary SQL via the '/reset_password' database endpoint and gain administrator access to the… |
| CVE-2023-48788 | 2024-03-12 | CRITICAL | 9.3 | 98.446% | A improper neutralization of special elements used in an sql command ('sql injection') in Fortinet FortiClientEMS version 7.2.0 through 7.2.2, FortiClientEMS… |
| CVE-2026-21643 | 2026-02-06 | CRITICAL | 9.1 | 97.735% | An improper neutralization of special elements used in an sql command ('sql injection') vulnerability in Fortinet FortiClientEMS 7.4.4 may allow an… |
| CVE-2025-57819 | 2025-08-28 | CRITICAL | 9.8 | 95.213% | FreePBX is an open-source web-based graphical user interface. FreePBX 15, 16, and 17 endpoints are vulnerable due to insufficiently sanitized user-supplied… |
| CVE-2019-12989 | 2019-07-16 | CRITICAL | 9.8 | 94.957% | Citrix SD-WAN 10.2.x before 10.2.3 and NetScaler SD-WAN 10.0.x before 10.0.8 allow SQL Injection. |
| CVE-2024-6670 | 2024-08-29 | CRITICAL | 9.8 | 92.907% | In WhatsUp Gold versions released before 2024.0.0, a SQL Injection vulnerability allows an unauthenticated attacker to retrieve the users encrypted password. |
| CVE-2020-17463 | 2020-08-13 | CRITICAL | 9.8 | 89.689% | FUEL CMS 1.4.7 allows SQL Injection via the col parameter to /pages/items, /permissions/items, or /navigation/items. |
| CVE-2026-42208 | 2026-05-08 | CRITICAL | 9.8 | 89.420% | LiteLLM is a proxy server (AI Gateway) to call LLM APIs in OpenAI (or native) format. From version 1.81.16 to before version 1.83.7, a database query used… |
| CVE-2026-9082 | 2026-05-20 | CRITICAL | 9.8 | 89.381% | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') vulnerability in Drupal Drupal core allows SQL Injection. This issue… |
| CVE-2017-18362 | 2019-02-05 | CRITICAL | 9.8 | 86.820% | ConnectWise ManagedITSync integration through 2017 for Kaseya VSA is vulnerable to unauthenticated remote commands that allow full direct access to the Kaseya… |
| CVE-2020-5722 | 2020-03-23 | CRITICAL | 9.8 | 84.287% | The HTTP interface of the Grandstream UCM6200 series is vulnerable to an unauthenticated remote SQL injection via crafted HTTP request. An attacker can use… |
| CVE-2024-43468 | 2024-10-08 | CRITICAL | 9.8 | 80.534% | Microsoft Configuration Manager Remote Code Execution Vulnerability |
| CVE-2021-42258 | 2021-10-22 | CRITICAL | 9.8 | 75.182% | BQE BillQuick Web Suite 2018 through 2021 before 22.0.9.1 allows SQL injection for unauthenticated remote code execution, as exploited in the wild in October… |
| CVE-2018-7841 | 2019-05-22 | CRITICAL | 9.8 | 72.486% | A SQL Injection (CWE-89) vulnerability exists in U.motion Builder software version 1.3.4 which could cause unwanted code execution when an improper set of… |
| CVE-2016-2386 | 2016-02-16 | CRITICAL | 9.8 | 71.522% | SQL injection vulnerability in the UDDI server in SAP NetWeaver J2EE Engine 7.40 allows remote attackers to execute arbitrary SQL commands via unspecified… |
Get more CVE data from the API.
curl 'https://api.contrastcyber.com/cwe_lookup/CWE-89'curl 'https://api.contrastcyber.com/cve_search?cwe_id=CWE-89'
Sources
- Vulnerability data from the National Vulnerability Database (NIST) and the CVE Program. CVE records: Copyright © 1999-2026, The MITRE Corporation, used under the CVE Program Terms of Use. CVE® is a registered trademark of The MITRE Corporation.
- CWE definitions: Copyright © 2006-2026, The MITRE Corporation, used under the CWE Terms of Use. CWE is a trademark of The MITRE Corporation.
- EPSS scores by FIRST.org EPSS, used with attribution.
- KEV catalog and SSVC decisions by CISA.
- Advisory data from the GitHub Advisory Database through OSV.dev (CC BY 4.0).
- Exploit metadata from the Exploit Database (GPL-2.0-only, metadata only).
- Nuclei template names from nuclei-templates (MIT).