589
CWE-243: Creation of chroot Jail Without Changing Working Directory
Weakness ID : 243
Structure : Simple
Abstraction : Variant
Description
The product 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.
Extended Description
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.
Relationships
The table(s) below shows the weaknesses and high level categories that are related to this
weakness. These relationships are defined as ChildOf, ParentOf, MemberOr and give insight to
similar items that may exist at higher and lower levels of abstraction. In addition, relationships such
as PeerOf and CanAlsoBe are defined to show similar weaknesses that may want to be explored.
Relevant to the view "Research Concepts" (CWE-1000)
Nature Type ID Name Page
ChildOf 573 Improper Following of Specification by Caller 1298
ChildOf 669 Incorrect Resource Transfer Between Spheres 1471
Relevant to the view "Architectural Concepts" (CWE-1008)
Nature Type ID Name Page
MemberOf 1015 Limit Access 2430
Relevant to the view "Software Development" (CWE-699)
Nature Type ID Name Page
MemberOf 265 Privilege Issues 2316
Weakness Ordinalities
Resultant :
Applicable Platforms
Language : C (Prevalence = Undetermined)
Language : C++ (Prevalence = Undetermined)
Operating_System : Unix (Prevalence = Undetermined)
Background Details
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.
Likelihood Of Exploit
High
Common Consequences
CWE Version 4.14
CWE-243: Creation of chroot Jail Without Changing Working Directory
CWE-243: Creation of chroot Jail Without Changing Working Directory