Argument to umask allows external user
too much control
This defect occurs when umask commands have arguments specified in the
style of arguments to chmod.
For new files, the umask value specifies which permissions
not to set, in other words,
which permissions to remove. The umask argument is
bitwise-negated and then applied to new file permissions. In
contrast, chmod sets the permissions as you specify them.
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.
Set the umask so that the user (u) has fewer
permissions turned off than the group (g). Set
umask so that the group has fewer permissions turned off than other
users (o), or u <= g <= o.
You can see the umask value by calling,
umaskumask -S| Group: Security |
| Language: C | C++ |
| Default: Off |
Command-Line Syntax: BAD_UMASK |
| Impact: Low |
| CWE ID: 560, 922 |