CWE-638: Not Using Complete Mediation
The product does not perform access checks on a resource every time the resource is accessed by an entity, which can create resultant weaknesses if that entity's rights or privileges change over time.
Last updated
Overview
CWE-638 (Not Using Complete Mediation) is a class-level software weakness catalogued by MITRE in the Common Weakness Enumeration (CWE). It describes a recurring type of mistake that can lead to exploitable security vulnerabilities.
Real-world CVEs
1 recorded CVEs are caused by CWE-638 (Not Using Complete Mediation). The highest-severity and most recent are shown first.
Common consequences
What can happen when CWE-638 is exploited.
Gain Privileges or Assume Identity, Execute Unauthorized Code or Commands, Bypass Protection Mechanism, Read Application Data, Other
Affects: Integrity, Confidentiality, Availability, Access Control, Other
A user might retain access to a critical resource even after privileges have been revoked, possibly allowing access to privileged functionality or sensitive information, depending on the role of the resource.
How it happens
When it is introduced
Typically introduced during these phases of the software lifecycle.
How to prevent it
Practical mitigations for CWE-638, grouped by where in the lifecycle they apply.
Invalidate cached privileges, file handles or descriptors, or other access credentials whenever identities, processes, policies, roles, capabilities or permissions change. Perform complete authentication checks before accepting, caching and reusing data, dynamic content and code (scripts). Avoid caching access control decisions as much as possible.
Identify all possible code paths that might access sensitive resources. If possible, create and use a single interface that performs the access checks, and develop code standards that require use of this interface.
Code examples
Illustrative examples from MITRE showing how the weakness appears in code.
When executable library files are used on web servers, which is common in PHP applications, the developer might perform an access check in any user-facing executable, and omit the access check from the library file itself. By directly requesting the library file (CWE-425), an attacker can bypass this access check.
When a developer begins to implement input validation for a web application, often the validation is performed in each area of the code that uses externally-controlled input. In complex applications with many inputs, the developer often misses a parameter here or a cookie there. One frequently-applied solution is to centralize all input validation, store these validated inputs in a separate data structure, and require that all access of those inputs must be through that data structure. An alternate approach would be to use an external input validation framework such as Struts, which performs the validation before the inputs are ever processed by the code.
Illustrative examples
Real CVEs that MITRE cites as examples of this weakness.
- CVE-2007-0408 — Server does not properly validate client certificates when reusing cached connections.
Terminology & mappings
Mapped taxonomies
- Software Fault Patterns: Race Condition Window (SFP20)
Attack patterns
CAPEC attack patterns that exploit this weakness.
Frequently asked questions
Common questions about CWE-638.
- What is CWE-638?
- The product does not perform access checks on a resource every time the resource is accessed by an entity, which can create resultant weaknesses if that entity's rights or privileges change over time.
- What CVEs are caused by CWE-638?
- 1 recorded CVEs are attributed to CWE-638, including CVE-2024-56512.
- How do you prevent CWE-638?
- Invalidate cached privileges, file handles or descriptors, or other access credentials whenever identities, processes, policies, roles, capabilities or permissions change. Perform complete authentication checks before accepting, caching and reusing data, dynamic content and code (scripts). Avoid caching access control decisions as much as possible.
- What are the consequences of CWE-638?
- Exploiting CWE-638 can lead to: Gain Privileges or Assume Identity, Execute Unauthorized Code or Commands, Bypass Protection Mechanism, Read Application Data, Other.
- Is CWE-638 actively exploited?
- 1 recorded CVEs are caused by CWE-638; none are currently in CISA's KEV catalog of actively exploited flaws.
References
- MITRE CWE definition (CWE-638) (opens in a new tab)
- CWE-638 vulnerabilities on NVD (opens in a new tab)
- Learn: What is a CWE?
Weakness data is sourced from the MITRE CWE catalog (v4.20). CVE associations are aggregated and kept current by RadicalNotion.AI.
Stay ahead of CWE-638
Get alerted the moment a new CWE-638 vulnerability affects your stack, with AI-written analysis, severity context, and remediation guidance.