CWE-843: Access of Resource Using Incompatible Type ('Type Confusion')

What is CWE-843?

MITRE CWE

The product allocates or initializes a resource such as a pointer, object, or variable using one type, but it later accesses that resource using a type that is incompatible with the original type.

Verify to analyze this CWE entry

A short verification protects the official data source and prevents automated AI abuse.

Official definition

MITRE CWE

The product allocates or initializes a resource such as a pointer, object, or variable using one type, but it later accesses that resource using a type that is incompatible with the original type.

When the product accesses the resource using an incompatible type, this could trigger logical errors because the resource does not have expected properties. In languages without memory safety, such as C and C++, type confusion can lead to out-of-bounds memory access. While this weakness is frequently associated with unions when parsing data with many different embedded object types in C, it can be present in any application that can interpret the same variable or memory location in multiple ways. This weakness is not unique to C and C++. For example, errors in PHP applications can be triggered by providing array parameters when scalars are expected, or vice versa. Languages such as Perl, which perform automatic conversion of a variable of one type when it is accessed as if it were another type, can also contain these issues.

Detailed description

CyStack is analyzing this CWE entry. The page will update automatically when the bilingual analysis is ready.

Characteristics

CyStack is analyzing this CWE entry. The page will update automatically when the bilingual analysis is ready.
  • Object Type Confusion

Modes of introduction

  • Implementation

Common consequences

CyStack is analyzing this CWE entry. The page will update automatically when the bilingual analysis is ready.
  • Availability, Integrity, Confidentiality

    Read Memory, Modify Memory, Execute Unauthorized Code or Commands, DoS: Crash, Exit, or Restart

    When a memory buffer is accessed using the wrong type, it could read or write memory out of the bounds of the buffer, if the allocated buffer is smaller than the type that the code is attempting to access, leading to a crash and possibly code execution.

Mitigations

CyStack is analyzing this CWE entry. The page will update automatically when the bilingual analysis is ready.

Detection methods

CyStack is analyzing this CWE entry. The page will update automatically when the bilingual analysis is ready.
  • Automated Static AnalysisAutomated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)Effectiveness: High

Representative vulnerabilities

CyStack is analyzing this CWE entry. The page will update automatically when the bilingual analysis is ready.

These examples illustrate this CWE entry and are not an exhaustive list of related vulnerabilities.

  • CVE-2025-32352Type confusion in PHP app allows authentication bypass when users have passwords whose MD5 hashes can be interpreted as numbers
  • CVE-2010-4577Type confusion in CSS sequence leads to out-of-bounds read.
  • CVE-2011-0611Size inconsistency allows code execution, first discovered when it was actively exploited in-the-wild.
  • CVE-2010-0258Improperly-parsed file containing records of different types leads to code execution when a memory location is interpreted as a different object than intended.

Sources and references

References

CWE™ Program, operated by The MITRE Corporation. Copyright © 2006–2026, The MITRE Corporation. The MITRE Corporation hereby grants you a non-exclusive, royalty-free license to use CWE for research, development, and commercial purposes. CWE Terms of Use.

Learn more

Run an in-depth assessment with complete web risk management

CyStack VulnScan continuously discovers assets, validates vulnerabilities, and helps security teams prioritize remediation across the organization.

Explore CyStack VulnScan
CyStack VulnScan dashboard