CWE-732 Class Draft High likelihood

Incorrect Permission Assignment for Critical Resource

This vulnerability occurs when a system grants overly permissive access to a sensitive resource, allowing unauthorized users or processes to read or alter it.

Definition

What is CWE-732?

This vulnerability occurs when a system grants overly permissive access to a sensitive resource, allowing unauthorized users or processes to read or alter it.
This flaw happens when security settings for a critical file, directory, or cloud resource are configured too loosely. Instead of restricting access to only the necessary users or services, the permissions are set to allow a much broader range of actors. This creates an open door for data exposure or unauthorized changes. In practice, this often involves misconfigured file system permissions, database access controls, or cloud storage settings. For instance, a cloud storage container set to 'public read' could leak sensitive data, or a configuration file writable by any system user could be tampered with to alter the program's behavior. The core risk is that the intended security boundary around the resource is incorrectly defined and enforced.
Real-world impact

Real-world CVEs caused by CWE-732

  • Go application for cloud management creates a world-writable sudoers file that allows local attackers to inject sudo rules and escalate privileges to root by winning a race condition.

  • Anti-virus product sets insecure "Everyone: Full Control" permissions for files under the "Program Files" folder, allowing attackers to replace executables with Trojan horses.

  • Product creates directories with 0777 permissions at installation, allowing users to gain privileges and access a socket used for authentication.

  • Photo editor installs a service with an insecure security descriptor, allowing users to stop or start the service, or execute commands as SYSTEM.

  • socket created with insecure permissions

  • Library function copies a file to a new target and uses the source file's permissions for the target, which is incorrect when the source file is a symbolic link, which typically has 0777 permissions.

  • Device driver uses world-writable permissions for a socket file, allowing attackers to inject arbitrary commands.

  • LDAP server stores a cleartext password in a world-readable file.

How attackers exploit it

Step-by-step attacker path

  1. 1

    The following code sets the umask of the process to 0 before creating a file and writing "Hello world" into the file.

  2. 2

    After running this program on a UNIX system, running the "ls -l" command might return the following output:

  3. 3

    The "rw-rw-rw-" string indicates that the owner, group, and world (all users) can read the file and write to it.

  4. 4

    This code creates a home directory for a new user, and makes that user the owner of the directory. If the new directory cannot be owned by the user, the directory is deleted.

  5. 5

    Because the optional "mode" argument is omitted from the call to mkdir(), the directory is created with the default permissions 0777. Simply setting the new user as the owner of the directory does not explicitly change the permissions of the directory, leaving it with the default. This default allows any user to read and write to the directory, allowing an attack on the user's files. The code also fails to change the owner group of the directory, which may result in access by unexpected groups.

Vulnerable code example

Vulnerable C

The following code sets the umask of the process to 0 before creating a file and writing "Hello world" into the file.

Vulnerable C
#define OUTFILE "hello.out"
  umask(0);
  FILE *out;
```
/* Ignore link following (CWE-59) for brevity */* 
  
  out = fopen(OUTFILE, "w");
  if (out) {
  ```
  	fprintf(out, "hello world!\n");
  	fclose(out);
  }
Secure code example

Secure Shell

The command could be modified to disable "Allow Blob Public Access" by setting it to false.

Secure Shell
az storage account update --name <storage-account> --resource-group <resource-group> --allow-blob-public-access false
What changed: the unsafe sink is replaced (or the input is validated/escaped) so the same payload no longer triggers the weakness.
Prevention checklist

How to prevent CWE-732

  • 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) [REF-62], 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 Design 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. [REF-207]
  • Architecture and Design / Operation 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 operating system; the rest of the application may still be subject to compromise. Be careful to avoid CWE-243 and other weaknesses related to jails.
  • Implementation / Installation 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 Configuration 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.
  • Operation / System Configuration Ensure that the software runs properly under the United States Government Configuration Baseline (USGCB) [REF-199] or an equivalent hardening configuration guide, which many organizations use to limit the attack surface and potential risk of deployed software.
Detection signals

How to detect CWE-732

Automated Static Analysis

Automated static analysis may be effective in detecting permission problems for system resources such as files, directories, shared memory, device interfaces, etc. Automated techniques may be able to detect the use of library functions that modify permissions, then analyze function calls for arguments that contain potentially insecure values. However, since the software's intended security policy might allow loose permissions for certain operations (such as publishing a file on a web server), automated static analysis may produce some false positives - i.e., warnings that do not have any security consequences or require any code changes. When custom permissions models are used - such as defining who can read messages in a particular forum in a bulletin board system - these can be difficult to detect using automated static analysis. It may be possible to define custom signatures that identify any custom functions that implement the permission checks and assignments.

Automated Dynamic Analysis

Automated dynamic analysis may be effective in detecting permission problems for system resources such as files, directories, shared memory, device interfaces, etc. However, since the software's intended security policy might allow loose permissions for certain operations (such as publishing a file on a web server), automated dynamic analysis may produce some false positives - i.e., warnings that do not have any security consequences or require any code changes. When custom permissions models are used - such as defining who can read messages in a particular forum in a bulletin board system - these can be difficult to detect using automated dynamic analysis. It may be possible to define custom signatures that identify any custom functions that implement the permission checks and assignments.

Manual Analysis

This weakness can be detected using 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.

Manual Static Analysis

Manual static analysis may be effective in detecting the use of custom permissions models and functions. The code could then be examined to identifying usage of the related functions. Then the human analyst could evaluate permission assignments in the context of the intended security model of the software.

Manual Dynamic Analysis

Manual dynamic analysis may be effective in detecting the use of custom permissions models and functions. The program could then be executed with a focus on exercising code paths that are related to the custom permissions. Then the human analyst could evaluate permission assignments in the context of the intended security model of the software.

Fuzzing

Fuzzing is not effective in detecting this weakness.

Plexicus auto-fix

Plexicus auto-detects CWE-732 and opens a fix PR in under 60 seconds.

Codex Remedium scans every commit, identifies this exact weakness, and ships a reviewer-ready pull request with the patch. No tickets. No hand-offs.

Frequently asked questions

Frequently asked questions

What is CWE-732?

This vulnerability occurs when a system grants overly permissive access to a sensitive resource, allowing unauthorized users or processes to read or alter it.

How serious is CWE-732?

MITRE rates the likelihood of exploit as High — this weakness is actively exploited in the wild and should be prioritized for remediation.

What languages or platforms are affected by CWE-732?

MITRE lists the following affected platforms: Not Technology-Specific, Cloud Computing.

How can I prevent CWE-732?

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) [REF-62], 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. 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…

How does Plexicus detect and fix CWE-732?

Plexicus's SAST engine matches the data-flow signature for CWE-732 on every commit. When a match is found, our Codex Remedium agent opens a fix PR with the corrected code, tests, and a one-line summary for the reviewer.

Where can I learn more about CWE-732?

MITRE publishes the canonical definition at https://cwe.mitre.org/data/definitions/732.html. You can also reference OWASP and NIST documentation for adjacent guidance.

Related weaknesses

Weaknesses related to CWE-732

CWE-285 Parent

Improper Authorization

This vulnerability occurs when an application fails to properly verify whether a user has permission to access specific data or perform…

CWE-1230 Sibling

Exposure of Sensitive Information Through Metadata

This vulnerability occurs when an application protects the primary source of sensitive data but fails to secure the metadata derived from…

CWE-1256 Sibling

Improper Restriction of Software Interfaces to Hardware Features

This vulnerability occurs when a system's software interfaces to hardware features—like power, clock, or performance management—are not…

CWE-1297 Sibling

Unprotected Confidential Information on Device is Accessible by OSAT Vendors

This vulnerability occurs when a semiconductor chip does not properly secure sensitive data, making it accessible to third-party…

CWE-1328 Sibling

Security Version Number Mutable to Older Versions

This vulnerability occurs when a hardware system's security version number can be changed, allowing an attacker to downgrade or roll back…

CWE-552 Sibling

Files or Directories Accessible to External Parties

This vulnerability occurs when an application exposes files or directories to users who shouldn't have access to them.

CWE-862 Sibling

Missing Authorization

This vulnerability occurs when an application fails to verify whether a user has permission to access specific data or execute certain…

CWE-863 Sibling

Incorrect Authorization

This vulnerability occurs when an application checks if a user is allowed to perform an action or access data, but the check is flawed or…

CWE-926 Sibling

Improper Export of Android Application Components

This vulnerability occurs when an Android app makes a component (like an Activity, Service, or Content Provider) available to other apps…

Ready when you are

Don't Let Security
Weigh You Down.

Stop choosing between AI velocity and security debt. Plexicus is the only platform that runs Vibe Coding Security and ASPM in parallel — one workflow, every codebase.