alpine 3.6
access weakness #392


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.

      *p = '\0';

      if (first)
           * POSIX 1003.2:
           * For each dir operand that does not name an existing
           * directory, effects equivalent to those cased by the
           * following command shall occcur:
           * mkdir -p -m $ (umask -S),u+wx $ (dirname dir) &&
           *    mkdir [-m mode] dir
           * We change the user's umask and then restore it,
           * instead of doing chmod's.
          oumask = umask(0);
          numask = oumask & ~(S_IWUSR | S_IXUSR);
          first = 0;

      if (last)

      if (mkdir (path, last ? omode : S_IRWXU | S_IRWXG | S_IRWXO) < 0)
          sverrno = errno;

          if (stat (path, &sb) < 0)
              errno = sverrno;
              retval = FALSE;
          else if (!S_ISDIR (sb.st_mode))
              errno = ENOTDIR;
              retval = FALSE;

      if (!last)
        *p = G_DIR_SEPARATOR;

  if (!first && !last)
    umask (oumask); 

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.