| Impact | Details |
|---|---|
|
Read Application Data; Modify Application Data |
Scope: Confidentiality, Integrity |
| Phase(s) | Mitigation |
|---|---|
|
Requirements |
A non-SQL style database which is not subject to this flaw may be chosen.
|
|
Architecture and Design |
Follow the principle of least privilege when creating user accounts to a SQL 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.
|
|
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 |
Implement SQL strings using prepared statements that bind variables. Prepared statements that do not bind variables can be vulnerable to attack.
|
|
Implementation |
Use vigorous allowlist style checking on any user input that may be used in a SQL command. Rather than escape meta-characters, it is safest to disallow them entirely. Reason: Later use of data that have been entered in the database may neglect to escape meta-characters before use. Narrowly define the set of safe characters based on the expected value of the parameter in the request.
|
| Nature | Type | ID | Name |
|---|---|---|---|
| ChildOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') |
| Nature | Type | ID | Name |
|---|---|---|---|
| ChildOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') |
| Nature | Type | ID | Name |
|---|---|---|---|
| ChildOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') |
| Phase | Note |
|---|---|
| Architecture and Design | |
| Implementation |
SQL (Often Prevalent)
Database Server (Undetermined Prevalence)
Example 1
The following code excerpt uses Hibernate's HQL syntax to build a dynamic query that's vulnerable to SQL injection.
| Nature | Type | ID | Name |
|---|---|---|---|
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 990 | SFP Secondary Cluster: Tainted Input to Command |
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 1027 | OWASP Top Ten 2017 Category A1 - Injection |
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 1347 | OWASP Top Ten 2021 Category A03:2021 - Injection |
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 1409 | Comprehensive Categorization: Injection |
Rationale
This CWE entry is at the Variant level of abstraction, which is a preferred level of abstraction for mapping to the root causes of vulnerabilities.Comments
Carefully read both the name and description to ensure that this mapping is an appropriate fit. Do not try to 'force' a mapping to a lower-level Base/Variant simply to comply with this preferred level of abstraction.| Mapped Taxonomy Name | Node ID | Fit | Mapped Node Name |
|---|---|---|---|
| Software Fault Patterns | SFP24 | Tainted input to command |
| CAPEC-ID | Attack Pattern Name |
|---|---|
| CAPEC-109 | Object Relational Mapping Injection |
| Submissions | ||
|---|---|---|
| Submission Date | Submitter | Organization |
|
2006年07月19日
(CWE Draft 3, 2006年07月19日) |
Anonymous Tool Vendor (under NDA) | |
| Modifications | ||
| Modification Date | Modifier | Organization |
|
2025年04月03日
(CWE 4.17, 2025年04月03日) |
CWE Content Team | MITRE |
| updated Applicable_Platforms | ||
| 2023年06月29日 | CWE Content Team | MITRE |
| updated Mapping_Notes | ||
| 2023年04月27日 | CWE Content Team | MITRE |
| updated Relationships | ||
| 2021年10月28日 | CWE Content Team | MITRE |
| updated Relationships | ||
| 2020年08月20日 | CWE Content Team | MITRE |
| updated Relationships | ||
| 2020年06月25日 | CWE Content Team | MITRE |
| updated Potential_Mitigations | ||
| 2020年02月24日 | CWE Content Team | MITRE |
| updated Relationships | ||
| 2018年03月27日 | CWE Content Team | MITRE |
| updated Relationships | ||
| 2017年11月08日 | CWE Content Team | MITRE |
| updated Taxonomy_Mappings | ||
| 2017年05月03日 | CWE Content Team | MITRE |
| updated Potential_Mitigations | ||
| 2014年07月30日 | CWE Content Team | MITRE |
| updated Relationships, Taxonomy_Mappings | ||
| 2013年07月17日 | CWE Content Team | MITRE |
| updated Relationships | ||
| 2012年10月30日 | CWE Content Team | MITRE |
| updated Potential_Mitigations | ||
| 2012年05月11日 | CWE Content Team | MITRE |
| updated Relationships | ||
| 2011年06月01日 | CWE Content Team | MITRE |
| updated Common_Consequences | ||
| 2010年06月21日 | CWE Content Team | MITRE |
| updated Potential_Mitigations | ||
| 2009年05月27日 | CWE Content Team | MITRE |
| updated Related_Attack_Patterns | ||
| 2008年09月08日 | CWE Content Team | MITRE |
| updated Relationships, Taxonomy_Mappings | ||
| 2008年07月01日 | Eric Dalci | Cigital |
| updated Time_of_Introduction | ||
| 2008年07月01日 | Sean Eidemiller | Cigital |
| added/updated demonstrative examples | ||
Use of the Common Weakness Enumeration (CWE™) and the associated references from this website are subject to the Terms of Use. CWE is sponsored by the U.S. Department of Homeland Security (DHS) Cybersecurity and Infrastructure Security Agency (CISA) and managed by the Homeland Security Systems Engineering and Development Institute (HSSEDI) which is operated by The MITRE Corporation (MITRE). Copyright © 2006–2025, The MITRE Corporation. CWE, CWSS, CWRAF, and the CWE logo are trademarks of The MITRE Corporation.