CWEweakness
CWE-642 External Control of Critical State Data
High
Official page ↗
- Abstraction
- Class
- Structure
- Simple
- Status
- Draft
- Likelihood of exploit
- High
- Languages
- Not Language-Specific
- CWE version
- 5.0
Description
The product stores security-critical state information about its users, or the product itself, in a location that is accessible to unauthorized actors.
Extended description
If an attacker can modify the state information without detection, then it could be used to perform unauthorized actions or access unexpected resources, since the application programmer does not expect that the state can be changed.
State information can be stored in various locations such as a cookie, in a hidden web form field, input parameter or argument, an environment variable, a database record, within a settings file, etc. All of these locations have the potential to be modified by an attacker. When this state information is used to control security or determine resource usage, then it may create a vulnerability. For example, an application may perform authentication, then save the state in an "authenticated=true" cookie. An attacker may simply create this cookie in order to bypass the authentication.
Common consequences
• Access Control: Bypass Protection Mechanism, Gain Privileges or Assume Identity — An attacker could potentially modify the state in malicious ways. If the state is related to the privileges or level of authentication that the user has, then state modification might allow the user to bypass authentication or elevate privileges.
• Confidentiality: Read Application Data — The state variables may contain sensitive information that should not be known by the client.
• Availability: DoS: Crash, Exit, or Restart — By modifying state variables, the attacker could violate the application's expectations for the contents of the state, leading to a denial of service due to an unexpected error condition.
Potential mitigations
• [Architecture and Design] Understand all the potential locations that are accessible to attackers. For example, some programmers assume that cookies and hidden form fields cannot be modified by an attacker, or they may not consider that environment variables can be modified before a privileged program is invoked.
• [Architecture and Design] Store state information and sensitive data on the server side only.
Ensure that the system definitively and unambiguously keeps track of its own state and user state and has rules defined for legitimate state transitions. Do not allow any application user to affect state directly in any way other than through legitimate actions leading to state transitions.
If information must be stored on the client, do not do so without encryption and integrity checking, or otherwise having a mechanism on the server side to catch tampering. Use a message authentication code (MAC) algorithm, such as Hash Message Authentication Code (HMAC) [REF-529]. Apply this against the state or sensitive data that has to be exposed, which can guarantee the integrity of the data - i.e., that the data has not been modified. Ensure that a strong hash function is used (CWE-328).
• [Architecture and Design] Store state information on the server side only. Ensure that the system definitively and unambiguously keeps track of its own state and user state and has rules defined for legitimate state transitions. Do not allow any application user to affect state directly in any way other than through legitimate actions leading to state transitions.
• [Architecture and Design] Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid [REF-1482].
With a stateless protocol such as HTTP, use some frameworks can maintain the state for you.
Examples include ASP.NET View State and the OWASP ESAPI Session Management feature.
Be careful of language features that provide state support, since these might be provided as a convenience to the programmer and may not be considering security.
• [Architecture and Design] 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.
• [Operation, Implementation] When using PHP, configure the application so that it does not use register_globals. During implementation, develop the application so that it does not rely on this feature, but be wary of implementing a register_globals emulation that is subject to weaknesses such as CWE-95, CWE-621, and similar issues.
Detection methods
• Automated Static Analysis: Automated 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.)
• Fuzzing: Use dynamic tools and techniques that
interact with the product using large test suites with
many diverse inputs, such as fuzz testing (fuzzing),
robustness testing, and fault injection. The product's
operation may slow down, but it should not become
unstable, crash, or generate incorrect
results.
• Manual Dynamic Analysis: Use tools and techniques that require manual (human) analysis, such as penetration testing, threat modeling, and interactive tools that allow the tester to record and modify an active session. These may be more effective than strictly automated techniques. This is especially the case with weaknesses that are related to design and business rules.
Observed examples
• CVE-2005-2428: Mail client stores password hashes for unrelated accounts in a hidden form field.
• CVE-2008-0306: Privileged program trusts user-specified environment variable to modify critical configuration settings.
• CVE-1999-0073: Telnet daemon allows remote clients to specify critical environment variables for the server, leading to code execution.
• CVE-2007-4432: Untrusted search path vulnerability through modified LD_LIBRARY_PATH environment variable.
• CVE-2006-7191: Untrusted search path vulnerability through modified LD_LIBRARY_PATH environment variable.
• CVE-2008-5738: Calendar application allows bypass of authentication by setting a certain cookie value to 1.
• CVE-2008-5642: Setting of a language preference in a cookie enables path traversal attack.
• CVE-2008-5125: Application allows admin privileges by setting a cookie value to "admin."
• CVE-2008-5065: Application allows admin privileges by setting a cookie value to "admin."
• CVE-2008-4752: Application allows admin privileges by setting a cookie value to "admin."
• CVE-2000-0102: Shopping cart allows price modification via hidden form field.
• CVE-2000-0253: Shopping cart allows price modification via hidden form field.
• CVE-2008-1319: Server allows client to specify the search path, which can be modified to point to a program that the client has uploaded.
Related
Attack pattern · CAPEC (2)
Observed example · CVE (13)
- CVE-2008-5738 Nodstrum MySQL Calendar 1.1 and 1.2 allows remote attackers to bypass authentication and gain administrative access by setting the… vulnerability
- CVE-2008-5642 Directory traversal vulnerability in admin/login.php in CMS Made Simple 1.4.1 allows remote attackers to read arbitrary files via a .. vulnerability
- CVE-2008-5125 admin.php in CCleague Pro 1.2 allows remote attackers to bypass authentication by setting the type cookie value to admin. vulnerability
- CVE-2008-5065 TlGuestBook 1.2 allows remote attackers to bypass authentication and gain administrative access by setting the tlGuestBook_login cookie to… vulnerability
- CVE-2008-4752 TlNews 2.2 allows remote attackers to bypass authentication and gain administrative access by setting the tlNews_login cookie to admin. vulnerability
- CVE-2008-1319 Untrusted search path and argument injection vulnerability in the VersantD service in Versant Object Database 7.0.1.3 and earlier, as used… vulnerability
- CVE-2008-0306 sdbstarter in SAP MaxDB 7.6.0.37, and possibly other versions, allows local users to execute arbitrary commands by using unspecified… vulnerability
- CVE-2007-4432 Untrusted search path vulnerability in the wrapper scripts for the (1) rug, (2) zen-updater, (3) zen-installer, and (4) zen-remover… vulnerability
- CVE-2006-7191 Untrusted search path vulnerability in lamdaemon.pl in LDAP Account Manager (LAM) before 1.0.0 allows local users to gain privileges via a… vulnerability
- CVE-2005-2428 Lotus Domino R5 and R6 WebMail, with "Generate HTML for all fields" enabled, stores sensitive data from names.nsf in hidden form fields,… vulnerability
- CVE-2000-0253 The dansie shopping cart application cart.pl allows remote attackers to modify sensitive purchase information via hidden form fields. vulnerability
- CVE-2000-0102 The SalesCart shopping cart application allows remote users to modify sensitive purchase information via hidden form fields. vulnerability
- CVE-1999-0073 Telnet allows a remote client to specify environment variables including LD_LIBRARY_PATH, allowing an attacker to bypass the normal system… vulnerability
Child of · CWE (1)
- CWE-668 Exposure of Resource to Wrong Sphere weakness
Referenced by CAPEC · weakness (2)
Referenced by CVE · weakness (21)
- CVE-2026-50053 A request attribute override vulnerability in Zimbra Collaboration Suite (ZCS) allows unauthenticated requests to /h/* to populate servlet… vulnerability
- CVE-2026-65352 An information disclosure issue was addressed with improved state management. vulnerability
- CVE-2026-65355 An information disclosure issue was addressed with improved state management. vulnerability
- CVE-2026-84518 This issue was addressed through improved state management. vulnerability
- CVE-2026-78655 Punk::Plugin::TOTP versions before 0.05 for Perl allow the second-factor attempt limit to be reset by replaying an earlier session cookie… vulnerability
- CVE-2026-29146 Padding Oracle vulnerability in Apache Tomcat's EncryptInterceptor with default configuration. vulnerability
- CVE-2025-26787 An error in the SignServer container startup logic was found in Keyfactor SignServer versions prior to 7.2. vulnerability
- CVE-2025-49090 The Matrix specification before 1.16 (i.e., with a room version before 12 and State Resolution before 2.1) has deficient state resolution. vulnerability
- CVE-2024-58265 The snow crate before 0.9.5 for Rust, when stateful TransportState is used, allows incrementing a nonce and thereby denying message… vulnerability
- CVE-2025-54566 hw/pci/pcie_sriov.c in QEMU through 10.0.3 has a migration state inconsistency, a related issue to CVE-2024-26327. vulnerability
- CVE-2024-8754 An issue has been discovered in GitLab EE/CE affecting all versions from 16.9.7 prior to 17.1.7, 17.2 prior to 17.2.5, and 17.3 prior to… vulnerability
- CVE-2024-22387 External Control of Critical State Data (CWE-642) in the Controller 6000 and Controller 7000 diagnostic web interface allows an… vulnerability
- CVE-2023-0575 External Control of Critical State Data, Improper Control of Generation of Code ('Code Injection') vulnerability in YugaByte, Inc. vulnerability
- CVE-2022-32859 A logic issue was addressed with improved state management. vulnerability
- CVE-2022-22154 In a Junos Fusion scenario an External Control of Critical State Data vulnerability in the Satellite Device (SD) control state machine of… vulnerability
- CVE-2020-27872 This vulnerability allows network-adjacent attackers to bypass authentication on affected installations of NETGEAR R7450 1.2.0.62_1.0.1… vulnerability
- CVE-2020-26186 Dell Inspiron 5675 BIOS versions prior to 1.4.1 contain a UEFI BIOS RuntimeServices overwrite vulnerability. vulnerability
- CVE-2020-1976 A denial-of-service (DoS) vulnerability in Palo Alto Networks GlobalProtect software running on Mac OS allows authenticated local users to… vulnerability
- CVE-2019-9496 An invalid authentication sequence could result in the hostapd process terminating due to missing state validation steps when processing… vulnerability
- CVE-2018-15382 A vulnerability in Cisco HyperFlex Software could allow an unauthenticated, remote attacker to generate valid, signed session tokens. vulnerability
- CVE-2017-0928 html-janitor node module suffers from an External Control of Critical State Data vulnerability via user-control of the '_sanitized'… vulnerability
Referenced by CWE · child of (5)
- CWE-15 External Control of System or Configuration Setting weakness
- CWE-426 Untrusted Search Path weakness
- CWE-472 External Control of Assumed-Immutable Web Parameter weakness
- CWE-565 Reliance on Cookies without Validation and Integrity Checking weakness
- CWE-73 External Control of File Name or Path weakness
Referenced by CWE · has member (1)
- CWE-884 CWE Cross-section view
Referenced by CWE · requires (1)
- CWE-352 Cross-Site Request Forgery weakness