alpine 3.6
access weakness #498


Weakness Breakdown


An access weakness occurs when software does not properly implement permissions that could have unintended consequences if exploited by malicious actors. An example of this weakness is when a default username and password are set by the developer but do not get changed by the system administrator.

Warning code(s):

Ensure that umask is given most restrictive possible setting.

File Name:



The highlighted line of code below is the trigger point of this particular Alpine 3.6 access weakness.

static void
dmn_setenvironment(char **argv)
    const char *path = NULL;

    /* Get the environment binary path file. */
    path = env_getpath(*(argv + 0));

    /* Global or local environment binary path file? */
    if (strcmp(path, SBIN_FILE) == 0) {
        /* Set the current working directory to the root directory. */
        if (chdir(DMN_ROOTDIR) < 0) {
            MSG_ERROR("%s", strerror(errno));

        MSG_DEBUG("cwd = %s", DMN_ROOTDIR);
    } else {
        /* No change the current working directory (local directory). */
        MSG_DEBUG("cwd = %s", path);

    /* Set the user file creation mask to zero. */
    MSG_DEBUG("umask = %d", DMN_USERMASK);

 * Redirect the standard input, output and error to /dev/null character device.
static void

    do {
        int fd;

        /* Open the /dev/null character device. */
        if ((fd = open(DMN_NULLDEV, O_RDWR, 0)) < 0)

        /* Redirect the standard input to /dev/null character device. */
        if (dup2(fd, STDIN_FILENO) < 0)

        /* Redirect the standard output to /dev/null character device. */
        if (dup2(fd, STDOUT_FILENO) < 0)

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.