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.
Scope | Impact | Likelihood |
---|---|---|
Access Control | Bypass Protection Mechanism, Gain Privileges or Assume Identity Note: 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 Note: The state variables may contain sensitive information that should not be known by the client. | |
Availability | DoS: Crash, Exit, or Restart Note: 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. |
References | Description |
---|---|
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. |
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).
Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid.
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.
CAPEC-ID | Attack Pattern Name |
---|---|
CAPEC-21 | Exploitation of Trusted Identifiers An adversary guesses, obtains, or "rides" a trusted identifier (e.g. session ID, resource ID, cookie, etc.) to perform authorized actions under the guise of an authenticated user or service. |
CAPEC-31 | Accessing/Intercepting/Modifying HTTP Cookies This attack relies on the use of HTTP Cookies to store credentials, state information and other critical data on client systems. There are several different forms of this attack. The first form of this attack involves accessing HTTP Cookies to mine for potentially sensitive data contained therein. The second form involves intercepting this data as it is transmitted from client to server. This intercepted information is then used by the adversary to impersonate the remote user/session. The third form is when the cookie's content is modified by the adversary before it is sent back to the server. Here the adversary seeks to convince the target server to operate on this falsified information. |
Name | Organization | Date | Date release | Version |
---|---|---|---|---|
Evgeny Lebanidze | Cigital | Draft 8 |
Name | Organization | Date | Comment |
---|---|---|---|
Sean Eidemiller | Cigital | added/updated demonstrative examples | |
CWE Content Team | MITRE | updated Common_Consequences, Relationships | |
CWE Content Team | MITRE | updated Description | |
CWE Content Team | MITRE | updated Applicable_Platforms, Common_Consequences, Demonstrative_Examples, Description, Name, Observed_Examples, Potential_Mitigations, References, Relationships, Relevant_Properties, Type | |
CWE Content Team | MITRE | updated Potential_Mitigations | |
CWE Content Team | MITRE | updated Related_Attack_Patterns | |
CWE Content Team | MITRE | updated Potential_Mitigations | |
CWE Content Team | MITRE | updated Potential_Mitigations | |
CWE Content Team | MITRE | updated Common_Consequences | |
CWE Content Team | MITRE | updated Demonstrative_Examples, Potential_Mitigations, References, Relationships | |
CWE Content Team | MITRE | updated Potential_Mitigations | |
CWE Content Team | MITRE | updated Potential_Mitigations | |
CWE Content Team | MITRE | updated Relationships, Taxonomy_Mappings | |
CWE Content Team | MITRE | updated Related_Attack_Patterns, Relationships | |
CWE Content Team | MITRE | updated Applicable_Platforms, Demonstrative_Examples, Enabling_Factors_for_Exploitation, Modes_of_Introduction, References, Relationships, Relevant_Properties | |
CWE Content Team | MITRE | updated Relationships | |
CWE Content Team | MITRE | updated Demonstrative_Examples | |
CWE Content Team | MITRE | updated Demonstrative_Examples | |
CWE Content Team | MITRE | updated Relationships | |
CWE Content Team | MITRE | updated Description, Potential_Mitigations | |
CWE Content Team | MITRE | updated Detection_Factors, Potential_Mitigations, References, Relationships | |
CWE Content Team | MITRE | updated Mapping_Notes |