CWE-732: Incorrect Permission Assignment for Critical Resource
Description
The product specifies permissions for a security-critical resource in a way that allows that resource to be read or modified by unintended actors.
When a resource is given a permission setting that provides access to a wider range of actors than required, it could lead to the exposure of sensitive information, or the modification of that resource by unintended parties. This is especially dangerous when the resource is related to program configuration, execution, or sensitive user data. For example, consider a misconfigured storage account for the cloud that can be read or written by a public or anonymous user.
- Abstraction
- ClassAn abstract weakness, independent of any specific language or technology.
- Likelihood of exploit
- High
- Status
- Draft
Common consequences
- Confidentiality
Read Application Data; Read Files or Directories
An attacker may be able to read sensitive information from the associated resource, such as credentials or configuration information stored in a file.
- Access Control
Gain Privileges or Assume Identity
An attacker may be able to modify critical properties of the associated resource to gain privileges, such as replacing a world-writable executable with a Trojan horse.
- IntegrityOther
Modify Application Data; Other
An attacker may be able to destroy or corrupt critical data in the associated resource, such as deletion of records from a database.
Potential mitigations
- Implementation
When using a critical resource such as a configuration file, check to see if the resource has insecure permissions (such as being modifiable by any regular user), and generate an error or even exit the software if there is a possibility that the resource could have been modified by an unauthorized party.
- Architecture and DesignEffectiveness: Moderate
Divide the software into anonymous, normal, privileged, and administrative areas. Reduce the attack surface by carefully defining distinct user groups, privileges, and/or roles. Map these against data, functionality, and the related resources. Then set the permissions accordingly. This will allow you to maintain more fine-grained control over your resources.
- Architecture and DesignOperationSandbox or JailEffectiveness: Limited
Run the code in a jail or similar sandbox environment that enforces strict boundaries between the process and the operating system. This may effectively restrict which files can be accessed in a particular directory or which commands can be executed by the software. OS-level examples include the Unix chroot jail, AppArmor, and SELinux. In general, managed code may provide some protection. For example, java.io.FilePermission in the Java SecurityManager allows the software to specify restrictions on file operations. This may not be a feasible solution, and it only limits the impact to the...
- ImplementationInstallationEffectiveness: High
During program startup, explicitly set the default permissions or umask to the most restrictive setting possible. Also set the appropriate permissions during program installation. This will prevent you from inheriting insecure permissions from any user who installs or runs the program.
- System ConfigurationEffectiveness: High
For all configuration files, executables, and libraries, make sure that they are only readable and writable by the software's administrator.
- Documentation
Do not suggest insecure configuration changes in documentation, especially if those configurations can extend to resources and other programs that are outside the scope of the application.
- Installation
Do not assume that a system administrator will manually change the configuration to the settings that are recommended in the software's manual.
- OperationSystem ConfigurationEnvironment Hardening
Ensure that the software runs properly under the United States Government Configuration Baseline (USGCB) or an equivalent hardening configuration guide, which many organizations use to limit the attack surface and potential risk of deployed software.
MITRE lists 1 more mitigation on the official entry.
Related weaknesses
Child weaknesses
- CWE-276Incorrect Default Permissions
- CWE-277Insecure Inherited Permissions
- CWE-278Insecure Preserved Inherited Permissions
- CWE-279Incorrect Execution-Assigned Permissions
- CWE-281Improper Preservation of Permissions
- CWE-766Critical Data Element Declared Public
- CWE-1004Sensitive Cookie Without 'HttpOnly' Flag
CAPEC attack patterns that exploit it
- CAPEC-1Accessing Functionality Not Properly Constrained by ACLs
- CAPEC-17Using Malicious Files
- CAPEC-60Reusing Session IDs (aka Session Replay)
- CAPEC-61Session Fixation
- CAPEC-62Cross Site Request Forgery
- CAPEC-122Privilege Abuse
- CAPEC-127Directory Indexing
- CAPEC-180Exploiting Incorrectly Configured Access Control Security Levels
- CAPEC-206Signing Malicious Code
- CAPEC-234Hijacking a privileged process
- CAPEC-642Replace Binaries