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.
Ensure that umask is given most restrictive possible setting.
quagga/src/quagga-1.2.4/bgpd/bgp_dump.c
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);
}
else
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));
umask(oldumask);
return NULL;
}
umask(oldumask);
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))
{