alpine 3.6
access weakness #217


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.

   int fd;
  char path[_POSIX_PATH_MAX];
  mode_t omask;

  omask = umask (mh_umask (dest));
    snprintf (path, _POSIX_PATH_MAX, "%s/.mutt-%s-%d-%d",
	      dest->path, NONULL (Hostname), (int) getpid (), Counter++);
    if ((fd = open (path, O_WRONLY | O_EXCL | O_CREAT, 0666)) == -1)
      if (errno != EEXIST)
	mutt_perror (path);
	umask (omask);
	return -1;
      *tgt = safe_strdup (path);
  umask (omask);

  if ((*fp = fdopen (fd, "w")) == NULL)
    FREE (tgt);		/* __FREE_CHECKED__ */
    close (fd);
    unlink (path);
    return (-1);

  return 0;

static void mhs_write_one_sequence (FILE * fp, struct mh_sequences *mhs,
				    short f, const char *tag)
  int i;
  int first, last;
  fprintf (fp, "%s:", tag);

  first = -1;
  last = -1;

  for (i = 0; i <= mhs->max; i++)
    if ((mhs_check (mhs, i) & f)) 

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.