Skip to content

Files

Latest commit

 

History

History
31 lines (20 loc) · 1.1 KB

B103.md

File metadata and controls

31 lines (20 loc) · 1.1 KB

Pattern: Avoid permissive file permissions

Issue: -

Description

This rule looks for the use of chmod and will alert when it is used to set particularly permissive control flags. Discretion should be used when granting write access to files such as configuration files to prevent vulnerabilities including denial of service and remote code execution.

POSIX based operating systems utilize a permissions model to protect access to parts of the file system. This model supports three roles - owner, group and world. Each role may have a combination of read, write or execute flags sets. Python provides chmod to manipulate POSIX style permissions.

Example of insecure code:

os.chmod('/etc/passwd', 07)

Example of secure code:

os.chmod('/etc/passwd', 0664)

Further Reading