What is CWE-639?
CWE-639 is Authorization Bypass Through User-Controlled Key. The flaw arises when the system fails to prevent a user from accessing another user's data or record by modifying the key value that identifies the requested data.
CWE-639 is Authorization Bypass Through User-Controlled Key. The flaw arises when the system fails to prevent a user from accessing another user's data or record by modifying the key value that identifies the requested data.
No vulnerability data for CWE-639
No vulnerability data in CISA KEV for CWE-639
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
Retrieval of a user record occurs in the system based on some key value that is under user control. The key would typically identify a user-related record stored in the system and would be used to lookup that record for presentation to the user. It is likely that an attacker would have to be an authenticated user in the system. However, the authorization process would not properly check the data access operation to ensure that the authenticated user performing the operation has sufficient entitlements to perform the requested data access, hence bypassing any other authorization checks present in the system.
For example, attackers can look at places where user specific data is retrieved (e.g. search screens) and determine whether the key for the item being looked up is controllable externally. The key may be a hidden field in the HTML form field, might be passed as a URL parameter or as an unencrypted cookie variable, then in each of these cases it will be possible to tamper with the key value.
One manifestation of this weakness is when a system uses sequential or otherwise easily-guessable session IDs that would allow one user to easily switch to another user's session and read/modify their data.
The application retrieves a user-related record using a key that is under user control. Although the requester may be authenticated, the authorization process does not properly verify that this user is entitled to access the specific record, allowing the lookup operation to bypass other authorization checks.
The key may be exposed in an HTML form field, a URL parameter, or an unencrypted cookie variable, all of which can be tampered with. If the server accepts the changed value without binding the record to the current user, the attacker may access another user's data. A related manifestation uses sequential or otherwise predictable session identifiers, allowing one user to switch to another user's session and read or modify its data.
This weakness occurs when record retrieval relies on a user-controlled key and authorization does not confirm access to the particular record identified by that key. The key may be exposed through a hidden HTML form field, URL parameter, or unencrypted cookie, making alteration possible. Sequential or predictable session identifiers can produce a related result by enabling access to another user's session. The weakness is introduced during architecture and design, and its likelihood of exploitation is rated high.
Access-control checks for specific user data or functionality can be bypassed. A user may achieve horizontal privilege escalation by viewing or modifying another user's information. If the user-controlled key represents an administrator-status flag, the same weakness can also enable vertical privilege escalation and administrative access.
| Impact | Scope | Explanation |
|---|---|---|
| Bypass Protection Mechanism | Access Control | Access control checks for specific user data or functionality can be bypassed. |
| Gain Privileges or Assume Identity | Access Control | Horizontal escalation of privilege is possible (one user can view/modify information of another user). |
| Gain Privileges or Assume Identity | Access Control | Vertical escalation of privilege is possible if the user-controlled key is actually a flag that indicates administrator status, allowing the attacker to gain administrative access. |
Apply authorization checks to every data access operation, verifying that the requesting user has sufficient privilege for the specific record being requested. Do not allow users to externally control the key used to look up another user's record, or ensure that tampering is detected. Encryption can make other valid key values more difficult to guess, while associating a digital signature with the key allows the server to verify that it has not been modified.
Automated static analysis, commonly called Static Application Security Testing (SAST), can find some instances by analyzing source or binary code without executing the application. It typically builds data-flow and control-flow models and searches for potentially vulnerable patterns connecting input sources with sinks where data interacts with external components or lower layers. This approach does not guarantee detection of every instance because it is limited to weaknesses whose relevant flows and patterns can be inferred from the analyzed code.
| Method | Approach | Effectiveness |
|---|---|---|
| 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.) | High |
Representative examples, not an exhaustive list, include CVE-2021-36539. An educational application failed to restrict file IDs to a particular user, allowing an attacker to brute-force guess IDs and demonstrating an IDOR-style access control failure.
Below are representative vulnerabilities related to this CWE, prioritized by severity.
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.
CyStack VulnScan continuously discovers assets, validates vulnerabilities, and helps security teams prioritize remediation across the organization.
Review CyStack's security rating and practical recommendations for websites and edge assets.
Explore cybersecurity research from our team of security specialists.
Browse practical cybersecurity knowledge across CyStack's articles and guides.
en