CWE-843: Access of Resource Using Incompatible Type

What is CWE-843?

CWE-843 is Access of Resource Using Incompatible Type. The flaw arises when the product allocates or initializes a resource, such as a pointer, object, or variable, with one type and later accesses it using an incompatible type. The database currently holds 234 vulnerabilities mapped to CWE-843 and 2 of them are in the CISA Known Exploited Vulnerabilities catalog.

OWASP Top 10 Rank-
Related CVES (365 days)234
AbstractionBase
Likelihood of exploit-

Vulnerabilities mapped to CWE-843

234 vulnerabilities333% increase year over year

Vulnerabilities in CISA KEV for CWE-843

2 vulnerabilities100% increase year over year

Official definition

ByMitre 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. (Roles: Common-Name, Common-Name)

Detailed description

When the later access type is incompatible with the type used for allocation or initialization, the program may misinterpret the resource's structure, size, or properties. If a memory buffer is accessed through a type larger than the allocated buffer, the access can extend beyond the buffer's bounds. The weakness can occur across different languages and data models, not only in C or C++ code involving casts or unions.

Characteristics

This weakness occurs when the same resource or memory location is interpreted through incompatible types, so the properties expected by the code do not match the actual data. It is often associated with unions and parsing data that contains multiple embedded object types in C, but it is not limited to C or C++; similar problems can arise when an application treats array parameters as scalars or vice versa, or when a language automatically converts a variable while it is accessed as another type. The record identifies C, C++, and Python as applicable languages, with prevalence undetermined.

Common consequences

The immediate result may be a logical error because the resource does not have the expected properties. If an allocated buffer is smaller than the incompatible type used to access it, an attacker may be able to read or modify memory outside the buffer, potentially causing a crash, unauthorized code or command execution, or impacts to confidentiality, integrity, and availability.

ImpactScopeExplanation
Varies by ContextOtherWhen the product accesses the resource using an incompatible type, this could trigger logical errors because the resource does not have expected properties.
Read Memory, Modify Memory, Execute Unauthorized Code or Commands, DoS: Crash, Exit, or RestartAvailability, Integrity, ConfidentialityIf a memory buffer is accessed using an incompatible type, and the allocated buffer is smaller than the type that the code is attempting to access, then an attacker could read or write memory outside the bounds of the buffer, leading to a crash or possibly code execution.

Risk mitigations

The official record does not specify mitigation guidance for this weakness.

Detection methods

Automated static analysis, commonly known as Static Application Security Testing (SAST), can detect some instances by analyzing source code or binary/compiled code without executing it. It typically builds data-flow and control-flow models, then searches for potentially vulnerable patterns connecting sources, where input originates, to sinks, where data interacts with external components or a lower layer such as the operating system. The official record rates this approach as highly effective, but it applies only to some instances of the weakness.

MethodApproachEffectiveness
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.)High

Representative vulnerabilities

The following are representative examples, not an exhaustive list:

  • CVE-2025-32352: Type confusion in a PHP application allows authentication bypass when users have passwords whose MD5 hashes can be interpreted as numbers.
  • CVE-2010-4577: Type confusion in a CSS sequence leads to an out-of-bounds read.
  • CVE-2011-0611: A size inconsistency leads to code execution; the issue was first discovered while it was being actively exploited in the wild.
  • CVE-2010-0258: An improperly parsed file containing records of different types causes a memory location to be interpreted as an unintended object, leading to code execution.
Sources (2)

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.