The kind of flaw
Authorization Bypass Through User-Controlled Key CWE-639
By changing a number or name in a request, a user can reach records that belong to someone else.
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.
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.
- How often attackers use it
- High
- Part of the broader weakness
- Incorrect Authorization (CWE-863), Improper Access Control (CWE-284)
- Commonly found in
- Not Language-Specific
What an attacker can do with it
- Access Control: Bypass Protection Mechanism. Access control checks for specific user data or functionality can be bypassed.
- Access Control: Gain Privileges or Assume Identity. Horizontal escalation of privilege is possible (one user can view/modify information of another user).
- Access Control: Gain Privileges or Assume Identity. 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.
How software makers prevent it
- Architecture and Design: For each and every data access, ensure that the user has sufficient privilege to access the record that is being requested.
- Architecture and Design, Implementation: Make sure that the key that is used in the lookup of a specific user's record is not controllable externally by the user or that any tampering can be detected.
- Architecture and Design: Use encryption in order to make it more difficult to guess other legitimate values of the key or associate a digital signature with the key so that the server can verify that there has been no tampering.
Weakness data: MITRE Common Weakness Enumeration.
The kind of flaw
Missing Authorization CWE-862
The software does not check whether the person is allowed to do what they ask.
The product does not perform an authorization check when an actor attempts to access a resource or perform an action.
- How often attackers use it
- High
- Part of the broader weakness
- Improper Authorization (CWE-285), Improper Access Control (CWE-284)
- Commonly found in
- Go, Not Language-Specific
What an attacker can do with it
- Confidentiality: Read Application Data; Read Files or Directories. An attacker could read sensitive data, either by reading the data directly from a data store that is not restricted, or by accessing insufficiently-protected, privileged functionality to read the data.
- Integrity: Modify Application Data; Modify Files or Directories. An attacker could modify sensitive data, either by writing the data directly to a data store that is not restricted, or by accessing insufficiently-protected, privileged functionality to write the data.
- Access Control: Gain Privileges or Assume Identity; Bypass Protection Mechanism. An attacker could gain privileges by modifying or reading critical data directly, or by accessing privileged functionality.
- Availability: DoS: Crash, Exit, or Restart; DoS: Resource Consumption (CPU); DoS: Resource Consumption (Memory); DoS: Resource Consumption (Other). An attacker could gain unauthorized access to resources on the system and excessively consume those resources, leading to a denial of service.
How software makers prevent it
- Architecture and Design: Divide the product into anonymous, normal, privileged, and administrative areas. Reduce the attack surface by carefully mapping roles with data and functionality. Use role-based access control (RBAC) [REF-229] to enforce the roles at the appropriate boundaries. Note that this approach may not protect against horizontal authorization, i.e., it will not protect a user from attacking others with the same role.
- Architecture and Design: Ensure that access control checks are performed related to the business logic. These checks may be different than the access control checks that are applied to more generic resources such as files, connections, processes, memory, and database records. For example, a database may restrict access for medical records to a specific database user, but each record might only be intended to be accessible to the patient and the patient's doctor [REF-7].
- 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. For example, consider using authorization frameworks such as the JAAS Authorization Framework [REF-233] and the OWASP ESAPI Access Control feature [REF-45].
- Architecture and Design: For web applications, make sure that the access control mechanism is enforced correctly at the server side on every page. Users should not be able to access any unauthorized functionality or information by simply requesting direct access to that page. One way to do this is to ensure that all pages containing sensitive information are not cached, and that all such pages restrict access to requests that are accompanied by an active and authenticated session token associated with a user who has the required permissions to access that page.
- System Configuration, Installation: Use the access control capabilities of your operating system and server environment and define your access control lists accordingly. Use a "default deny" policy when defining these ACLs.
Weakness data: MITRE Common Weakness Enumeration.
The kind of flaw
Incorrect Authorization CWE-863
The software checks permissions, but wrongly, so people can do things they should not.
The product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check.
- How often attackers use it
- High
- Part of the broader weakness
- Improper Authorization (CWE-285), Improper Access Control (CWE-284)
- Commonly found in
- Go, Not Language-Specific
What an attacker can do with it
- Confidentiality: Read Application Data; Read Files or Directories. An attacker could bypass intended access restrictions to read sensitive data, either by reading the data directly from a data store that is not correctly restricted, or by accessing insufficiently-protected, privileged functionality to read the data.
- Integrity: Modify Application Data; Modify Files or Directories. An attacker could bypass intended access restrictions to modify sensitive data, either by writing the data directly to a data store that is not correctly restricted, or by accessing insufficiently-protected, privileged functionality to write the data.
- Access Control: Gain Privileges or Assume Identity; Bypass Protection Mechanism. An attacker could bypass intended access restrictions to gain privileges by modifying or reading critical data directly, or by accessing privileged functionality.
- Confidentiality, Integrity, Availability: Execute Unauthorized Code or Commands. An attacker could use elevated privileges to execute unauthorized commands or code.
- Availability: DoS: Crash, Exit, or Restart; DoS: Resource Consumption (CPU); DoS: Resource Consumption (Memory); DoS: Resource Consumption (Other). An attacker could gain unauthorized access to resources on the system and excessively consume those resources, leading to a denial of service.
How software makers prevent it
- Architecture and Design: Divide the product into anonymous, normal, privileged, and administrative areas. Reduce the attack surface by carefully mapping roles with data and functionality. Use role-based access control (RBAC) [REF-229] to enforce the roles at the appropriate boundaries. Note that this approach may not protect against horizontal authorization, i.e., it will not protect a user from attacking others with the same role.
- Architecture and Design: Ensure that access control checks are performed related to the business logic. These checks may be different than the access control checks that are applied to more generic resources such as files, connections, processes, memory, and database records. For example, a database may restrict access for medical records to a specific database user, but each record might only be intended to be accessible to the patient and the patient's doctor [REF-7].
- 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. For example, consider using authorization frameworks such as the JAAS Authorization Framework [REF-233] and the OWASP ESAPI Access Control feature [REF-45].
- Architecture and Design: For web applications, make sure that the access control mechanism is enforced correctly at the server side on every page. Users should not be able to access any unauthorized functionality or information by simply requesting direct access to that page. One way to do this is to ensure that all pages containing sensitive information are not cached, and that all such pages restrict access to requests that are accompanied by an active and authenticated session token associated with a user who has the required permissions to access that page.
- System Configuration, Installation: Use the access control capabilities of your operating system and server environment and define your access control lists accordingly. Use a "default deny" policy when defining these ACLs.
Weakness data: MITRE Common Weakness Enumeration.