Tag Archives: CWE- 243

CWE-243 – Creation of chroot Jail Without Changing Working Directory

Read Time:1 Minute, 2 Second

Description

The program uses the chroot() system call to create a jail, but does not change the working directory afterward. This does not prevent access to files outside of the jail.

Improper use of chroot() may allow attackers to escape from the chroot jail. The chroot() function call does not change the process’s current working directory, so relative paths may still refer to file system resources outside of the chroot jail after chroot() has been called.

The chroot() system call allows a process to change its perception of the root directory of the file system. After properly invoking chroot(), a process cannot access any files outside the directory tree defined by the new root directory. Such an environment is called a chroot jail and is commonly used to prevent the possibility that a processes could be subverted and used to access unauthorized files. For instance, many FTP servers run in chroot jails to prevent an attacker who discovers a new vulnerability in the server from being able to download the password file or other sensitive files on the system.

Modes of Introduction:

– Implementation

 

Likelihood of Exploit: High

 

Related Weaknesses

CWE-573
CWE-669

 

Consequences

Confidentiality: Read Files or Directories

 

Potential Mitigations

CVE References