VariantDraft

CWE-486Comparison of Classes by Name

Category: other

Description

The product compares classes by name, which can cause it to use the wrong class when multiple classes can have the same name. If the decision to trust the methods and data of an object is based on the name of a class, it is possible for malicious users to send objects of the same name as trusted classes and thereby gain the trust afforded to known classes and types.

Common consequences· 1

  • Integrity / Confidentiality / Availability — Execute Unauthorized Code or Commands
    If a product relies solely on the name of an object to determine identity, it may execute the incorrect or unintended code.

Potential mitigations· 1

  • [Implementation]Use class equivalency to determine type. Rather than use the class name to determine if an object is of a given type, use the getClass() method, and == operator.

References

  1. https://cwe.mitre.org/data/definitions/486.html

Related by meaning· 6

Nearest entities by semantic similarity across the cs-graph corpus.

CWE
Deserialization of Untrusted Data
CWE
Authentication Bypass by Alternate Name
CWE
Improper Control of Resource Identifiers ('Resource Injection')
CWE
Improper Neutralization of Data within XPath Expressions ('XPath Injection')
CWE
Improper Neutralization
CWE
Improper Verification of Source of a Communication Channel
Sourced from MITRE CWE 4.20. Curated for EU compliance use cases by Adam Lundqvist, Founder at SQUR.