alpine 3.6
access weakness #172


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.

   char realpath[MAXPATHLEN];
  mode_t oldumask;

  time (&clock);
  tm = localtime (&clock);

  if (bgp_dump->filename[0] != DIRECTORY_SEP)
      sprintf (fullpath, "%s/%s", vty_get_cwd (), bgp_dump->filename);
      ret = strftime (realpath, MAXPATHLEN, fullpath, tm);
    ret = strftime (realpath, MAXPATHLEN, bgp_dump->filename, tm);

  if (ret == 0)
      zlog_warn ("bgp_dump_open_file: strftime error");
      return NULL;

  if (bgp_dump->fp)
    fclose (bgp_dump->fp);

  oldumask = umask(0777 & ~LOGFILE_MASK);
  bgp_dump->fp = fopen (realpath, "w");

  if (bgp_dump->fp == NULL)
      zlog_warn ("bgp_dump_open_file: %s: %s", realpath, strerror (errno));
      return NULL;

  return bgp_dump->fp;

static int
bgp_dump_interval_add (struct bgp_dump *bgp_dump, int interval)
  int secs_into_day;
  time_t t;
  struct tm *tm;

  if (interval > 0)
      /* Periodic dump every interval seconds */
      if ((interval < 86400) && ((86400 % interval) == 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.