cve.bz

CAPEC-66

SQL Injection

High severityHigh likelihoodStandard pattern

This attack exploits target software that constructs SQL statements based on user input. An attacker crafts input strings so that when the target software constructs SQL statements based on the input, the resulting SQL statement performs actions other than those the application intended. SQL Injection results from failure of the application to appropriately validate input.

On this page

When specially crafted user-controlled input consisting of SQL syntax is used without proper validation as part of SQL queries, it is possible to glean information from the database in ways not envisaged during application design. Depending upon the database and the design of the application, it may also be possible to leverage injection to have the database execute system-related commands of the attackers' choice. SQL Injection enables an attacker to interact directly to the database, thus bypassing the application completely. Successful injection can cause information disclosure as well as ability to add or modify data in the database.

Ask an AI about this attack pattern

Show the promptExplain the attack pattern CAPEC-66: SQL Injection: how it unfolds, what it needs and how to prevent and detect it in my systems. Use https://capec.mitre.org/data/definitions/66.html and https://cve.bz/cve/capec/66?via=ask-ai-copy, which lists recent CVEs with the weaknesses it exploits. Cite the sources.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this attack pattern's id and public links.

How the attack unfolds

  1. Explore

    The attacker looks for a way in.

    1. [Survey application] The attacker first takes an inventory of the functionality exposed by the application.

      2 techniques
      • Spider web sites for all available links
      • Sniff network communications with application using a utility such as WireShark.
  2. Experiment

    They probe what they found.

    1. [Determine user-controllable input susceptible to injection] Determine the user-controllable input susceptible to injection. For each user-controllable input that the attacker suspects is vulnerable to SQL injection, attempt to inject characters that have special meaning in SQL (such as a single quote character, a double quote character, two hyphens, a parenthesis, etc.). The goal is to create a SQL query with an invalid syntax.

      4 techniques
      • Use web browser to inject input through text fields or through HTTP GET parameters.
      • Use a web application debugging tool such as Tamper Data, TamperIE, WebScarab,etc. to modify HTTP POST parameters, hidden fields, non-freeform fields, etc.
      • Use network-level packet injection tools such as netcat to inject input
      • Use modified client (modified by reverse engineering) to inject input.
    2. [Experiment with SQL Injection vulnerabilities] After determining that a given input is vulnerable to SQL Injection, hypothesize what the underlying query looks like. Iteratively try to add logic to the query to extract information from the database, or to modify or delete information in the database.

      4 techniques
      • Use public resources such as "SQL Injection Cheat Sheet" at http://ferruh.mavituna.com/makale/sql-injection-cheatsheet/, and try different approaches for adding logic to SQL queries.
      • Add logic to query, and use detailed error messages from the server to debug the query. For example, if adding a single quote to a query causes an error message, try : "' OR 1=1; --", or something else that would syntactically complete a hypothesized query. Iteratively refine the query.
      • Use "Blind SQL Injection" techniques to extract information about the database schema.
      • If a denial of service attack is the goal, try stacking queries. This does not work on all platforms (most notably, it does not work on Oracle or MySQL). Examples of inputs to try include: "'; DROP TABLE SYSOBJECTS; --" and "'); DROP TABLE SYSOBJECTS; --". These particular queries will likely not work because the SYSOBJECTS table is generally protected.
  3. Exploit

    They carry out the attack.

    1. [Exploit SQL Injection vulnerability] After refining and adding various logic to SQL queries, craft and execute the underlying SQL query that will be used to attack the target system. The goal is to reveal, modify, and/or delete database data, using the knowledge obtained in the previous step. This could entail crafting and executing multiple SQL queries if a denial of service attack is the intent.

      1 technique
      • Craft and Execute underlying SQL query

Prerequisites

  • SQL queries used by the application to store, retrieve or modify data.

  • User-controllable input that is not properly validated by the application as part of SQL queries.

Skills required

  • Low skill

    It is fairly simple for someone with basic SQL knowledge to perform SQL injection, in general. In certain instances, however, specific knowledge of the database employed may be required.

Resources required

  • None: No specialized resources are required to execute this type of attack.

Signs of an attack

  • Too many false or invalid queries to the database, especially those caused by malformed input.

Consequences

What a successful attack can lead to
ImpactAffectsNote
Modify DataIntegrity
Read DataConfidentiality
Execute Unauthorized CommandsConfidentiality, Integrity, AvailabilityRun Arbitrary Code
Gain PrivilegesConfidentiality, Access Control, Authorization

Mitigations

  • Strong input validation - All user-controllable input must be validated and filtered for illegal characters as well as SQL content. Keywords such as UNION, SELECT or INSERT must be filtered in addition to characters such as a single-quote(') or SQL-comments (--) based on the context in which they appear.

  • Use of parameterized queries or stored procedures - Parameterization causes the input to be restricted to certain domains, such as strings or integers, and any input outside such domains is considered invalid and the query fails. Note that SQL Injection is possible even in the presence of stored procedures if the eventual query is constructed dynamically.

  • Use of custom error pages - Attackers can glean information about the nature of queries from descriptive error messages. Input validation must be coupled with customized error pages that inform about an error without disclosing information about the database or application.

Weaknesses it exploits

  • CWE-89 Improper Neutralization of Special Elements used in an SQL Command
  • CWE-1286 Improper Validation of Syntactic Correctness of Input

Recent CVEs with these weaknesses

  1. 9.8CVE-2026-121653

    SQL injection in the Core of Ivanti Endpoint Manager before version 2024 SU8 allows a remote unauthenticated attacker to achieve remote code execution.

  2. 7.7CVE-2026-125759

    Nango before 0.71.3 contains an sql injection vulnerability that allows unauthenticated attackers to execute arbitrary SQL by supplying a crafted task group key to the orchestrator API. Attackers can send a malicious group.key to POST /v1/…

  3. 7.2CVE-2026-12572

    Zoho Corporation ManageEngine DDI Central version below 6201 is vulnerable to SQL injection in HA replication username handling leading to command execution as the PostgreSQL service account.

  4. 8.8CVE-2026-125612

    Improper neutralization of special elements used in an SQL command ('SQL injection') vulnerability in Deltaww DIAEnergie allows SQL Injection. This issue affects DIAEnergie: before 1.11.01.032.

  5. 6.0CVE-2026-125381

    DataRoom through 3.0.0 contains an sql injection vulnerability in MyBatisService.generateSql that allows sharer-role users to inject SQL by supplying crafted dataset parameters. Attackers can send crafted inputParam values to /dataRoom/dat…

  6. 9.3CVE-2026-115934

    An unauthenticated SQL injection can occur on the front end of any site that uses craft.search to perform a search, allowing stacked query execution and enabling escalation to an administrator. Note that this only affects MySQL/MariaDB.…

  7. 4.8CVE-2026-125109

    Rack is a modular Ruby web server interface. From 3.0 until 3.1.23 and 3.2.8, Rack::Request#host_with_port, #base_url, and #url can return an attacker-controlled invalid authority from Host, X-Forwarded-Host, or Forwarded: host= verbatim. …

  8. 4.3CVE-2026-123810

    Dynatrace MCP Server is an MCP server for Dynatrace Observability. Prior to 2.1.1, several read capabilities interpolate caller-controlled values into DQL without sufficient validation or escaping. The src/capabilities/find-monitored-entit…

The newest records naming one of them. Each weakness's page lists them all.

Part of
More specific patterns
  • CAPEC-7 Blind SQL Injection
  • CAPEC-108 Command Line Execution through SQL Injection
  • CAPEC-109 Object Relational Mapping Injection
  • CAPEC-110 SQL Injection through SOAP Parameter Tampering
  • CAPEC-470 Expanding Control over the Operating System from the Database

Examples

With PHP-Nuke versions 7.9 and earlier, an attacker can successfully access and modify data, including sensit…

With PHP-Nuke versions 7.9 and earlier, an attacker can successfully access and modify data, including sensitive contents such as usernames and password hashes, and compromise the application through SQL Injection. The protection mechanism against SQL Injection employs a denylist approach to input validation. However, because of an improper denylist, it is possible to inject content such as "foo'/**/UNION" or "foo UNION/**/" to bypass validation and glean sensitive information from the database. See also: CVE-2006-5525

MITRE's words, unchanged: CAPEC-66 at MITRE. CAPEC is Copyright © 2007–2026, The MITRE Corporation, used under the CAPEC terms of use: “The MITRE Corporation (MITRE) hereby grants you a non-exclusive, royalty-free license to use Common Attack Pattern Enumeration and Classification (CAPEC™) for research, development, and commercial purposes. Any copy you make for such purposes is authorized provided that you reproduce MITRE’s copyright designation and this license in any such copy.” CAPEC and the CAPEC logo are trademarks of The MITRE Corporation. Credits. All attack patterns.