This vulnerability occurs when a program incorrectly uses the `umask()` system call with an argument formatted for `chmod()`, leading to unintended and overly permissive file permissions.
The `umask()` function sets a process's file mode creation mask, which restricts permissions on newly created files. However, developers sometimes mistakenly pass it an octal value (like 0644 or 0777) intended for `chmod()`, which sets permissions directly. Since `umask()` interprets its argument as a mask that *blocks* permissions, this inversion results in files being created with far more access than intended, potentially exposing sensitive data. For example, passing `umask(0)` (a common `chmod`-style intent to grant all permissions) actually creates a mask of zero, meaning no permissions are blocked. This causes new files to be created with full read, write, and execute access for all users. The core issue is a semantic confusion between a mask that subtracts permissions (`umask`) and a mode that adds them (`chmod`), a mistake that directly weakens file system security.
Impact: Read Files or DirectoriesModify Files or DirectoriesBypass Protection Mechanism