Expand description

This module implements a check for CWE-243: Creation of chroot Jail Without Changing Working Directory.

Creating a chroot Jail without changing the working directory afterwards does not prevent access to files outside of the jail.

See https://cwe.mitre.org/data/definitions/243.html for detailed a description.

How the check works

According to http://www.unixwiz.net/techtips/chroot-practices.html, there are several ways to achieve the safe creation of a chroot jail. One can either call chdir after chroot or, if chdir is called before chroot, drop priviledges after the chroot call. The functions used to drop priviledges are configurable in config.json. We check whether each function that calls chroot is using one of these safe call sequences to create the chroot jail. If not, a warning is emitted.

False Positives

None known.

False Negatives

We do not check whether the parameters to chdir, chroot and the priviledge dropping functions are suitable to create a safe chroot jail.

Structs

  • The configuration struct contains the list of functions that are assumed to be used to correctly drop priviledges after a chroot call.

Statics

Functions