Logo
-

Byte Open Security

(ByteOS Network)

Log In

Sign Up

ByteOS

Security
Vulnerability Details
Registries
Custom Views
Weaknesses
Attack Patterns
Filters & Tools
CWE-564:SQL Injection: Hibernate
Weakness ID:564
Version:v4.17
Weakness Name:SQL Injection: Hibernate
Vulnerability Mapping:Allowed
Abstraction:Variant
Structure:Simple
Status:Incomplete
Likelihood of Exploit:
DetailsContent HistoryObserved CVE ExamplesReports
▼Description

Using Hibernate to execute a dynamic SQL statement built with user-controlled input can allow an attacker to modify the statement's meaning or to execute arbitrary SQL commands.

▼Extended Description

▼Alternate Terms
▼Relationships
Relevant to the view"Research Concepts - (1000)"
NatureMappingTypeIDName
ChildOfAllowedB89Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Nature: ChildOf
Mapping: Allowed
Type: Base
ID: 89
Name: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
▼Memberships
NatureMappingTypeIDName
MemberOfProhibitedC990SFP Secondary Cluster: Tainted Input to Command
MemberOfProhibitedC1027OWASP Top Ten 2017 Category A1 - Injection
MemberOfProhibitedC1347OWASP Top Ten 2021 Category A03:2021 - Injection
MemberOfProhibitedC1409Comprehensive Categorization: Injection
Nature: MemberOf
Mapping: Prohibited
Type:Category
ID: 990
Name: SFP Secondary Cluster: Tainted Input to Command
Nature: MemberOf
Mapping: Prohibited
Type:Category
ID: 1027
Name: OWASP Top Ten 2017 Category A1 - Injection
Nature: MemberOf
Mapping: Prohibited
Type:Category
ID: 1347
Name: OWASP Top Ten 2021 Category A03:2021 - Injection
Nature: MemberOf
Mapping: Prohibited
Type:Category
ID: 1409
Name: Comprehensive Categorization: Injection
▼Tags
NatureMappingTypeIDName
MemberOfProhibitedBSBOSS-240Weaknesses in Software Written in SQL
MemberOfProhibitedBSBOSS-272Weaknesses in Database Server
MemberOfProhibitedBSBOSS-318Modify Application Data (impact)
MemberOfProhibitedBSBOSS-328Read Application Data (impact)
Nature: MemberOf
Mapping: Prohibited
Type:BOSSView
ID: BOSS-240
Name: Weaknesses in Software Written in SQL
Nature: MemberOf
Mapping: Prohibited
Type:BOSSView
ID: BOSS-272
Name: Weaknesses in Database Server
Nature: MemberOf
Mapping: Prohibited
Type:BOSSView
ID: BOSS-318
Name: Modify Application Data (impact)
Nature: MemberOf
Mapping: Prohibited
Type:BOSSView
ID: BOSS-328
Name: Read Application Data (impact)
▼Relevant To View
Relevant to the view"OWASP Top Ten (2021) - (1344)"
NatureMappingTypeIDName
MemberOfProhibitedC1347OWASP Top Ten 2021 Category A03:2021 - Injection
Nature: MemberOf
Mapping: Prohibited
Type: Category
ID: 1347
Name: OWASP Top Ten 2021 Category A03:2021 - Injection
Relevant to the view"Software Fault Pattern (SFP) Clusters - (888)"
NatureMappingTypeIDName
MemberOfProhibitedC990SFP Secondary Cluster: Tainted Input to Command
Nature: MemberOf
Mapping: Prohibited
Type: Category
ID: 990
Name: SFP Secondary Cluster: Tainted Input to Command
▼Background Detail

▼Common Consequences
ScopeLikelihoodImpactNote
ConfidentialityIntegrityN/ARead Application DataModify Application Data
N/A
Scope: Confidentiality, Integrity
Likelihood: N/A
Impact: Read Application Data, Modify Application Data
Note:
N/A
▼Potential Mitigations
Phase:Requirements
Mitigation ID:
Strategy:
Effectiveness:
Description:

A non-SQL style database which is not subject to this flaw may be chosen.

Note:


Phase:Architecture and Design
Mitigation ID:
Strategy:
Effectiveness:
Description:

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.

Note:


Phase:Architecture and Design
Mitigation ID: MIT-15
Strategy:
Effectiveness:
Description:

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.

Note:


Phase:Implementation
Mitigation ID:
Strategy:
Effectiveness:
Description:

Implement SQL strings using prepared statements that bind variables. Prepared statements that do not bind variables can be vulnerable to attack.

Note:


Phase:Implementation
Mitigation ID:
Strategy:
Effectiveness:
Description:

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.

Note:

▼Modes Of Introduction
Phase: Architecture and Design
Note:

N/A

Phase: Implementation
Note:

N/A

▼Applicable Platforms
Languages
Class: SQL(Often Prevalence)
Technology
Class: Database Server(Undetermined Prevalence)
▼Demonstrative Examples
Example 1

The following code excerpt uses Hibernate's HQL syntax to build a dynamic query that's vulnerable to SQL injection.

Language: ( code)
N/A

Language: Java(Bad code)
String street = getStreetFromUser(); Query query = session.createQuery("from Address a where a.street='" + street + "'");

▼Observed Examples
ReferenceDescription
▼Affected Resources
    ▼Functional Areas
      ▼Weakness Ordinalities
      OrdinalityDescription
      ▼Detection Methods
      ▼Vulnerability Mapping Notes
      Usage:Allowed
      Reason:Acceptable-Use
      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.

      Suggestions:
      ▼Notes
      ▼Taxonomy Mappings
      Taxonomy NameEntry IDFitEntry Name
      Software Fault PatternsSFP24N/ATainted input to command
      Taxonomy Name: Software Fault Patterns
      Entry ID: SFP24
      Fit: N/A
      Entry Name: Tainted input to command
      ▼Related Attack Patterns
      IDName
      CAPEC-109
      Object Relational Mapping Injection
      ID: CAPEC-109
      Name: Object Relational Mapping Injection
      ▼References
      Details not found