Umask used with chmod-style arguments
Argument to umask
allows external user
too much control
Description
This defect occurs when umask
commands have arguments specified in the
style of arguments to chmod
and provide
possibly unintended permissions. For instance:
The
umask
command provides more permissions to the group than the current user.The
umask
command provides more permissions to other users than the group.
For new files, the umask
argument or the mask value specifies which
permissions not to set, in other words,
which permissions to remove. The mask is bitwise-negated and
then applied to new file permissions. In contrast,
chmod
sets the permissions as you
specify them.
Risk
If you use chmod
-style arguments, you specify opposite permissions of what
you want. This mistake can give external users
unintended read/write access to new files and
folders.
Fix
To fix this defect, perform both of these tasks:
Enable read permission for the user.
Set the mask value so that the user (
u
) has equal or fewer permissions turned off than the group (g
) and the group has equal or fewer permissions turned off than other users (o
), oru <= g <= o
.
You can see the umask value by calling,
umask
umask -S
Examples
Result Information
Group: Security |
Language: C | C++ |
Default: Off |
Command-Line Syntax: BAD_UMASK |
Impact: Low |
Version History
Introduced in R2015b
See Also
Vulnerable permission assignments
| Find defects (-checkers)
Topics
- Interpret Bug Finder Results in Polyspace Desktop User Interface
- Interpret Bug Finder Results in Polyspace Access Web Interface (Polyspace Access)
- Address Results in Polyspace User Interface Through Bug Fixes or Justifications
- Address Results in Polyspace Access Through Bug Fixes or Justifications (Polyspace Access)