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.
rpm/src/rpm-4.13.0/sign/rpmgensig.c
The highlighted line of code below is the trigger point of this particular Alpine 3.6 access weakness.
typedef struct sigTarget_s {
FD_t fd;
const char *fileName;
off_t start;
rpm_loff_t size;
} *sigTarget;
/*
* There is no function for creating unique temporary fifos so create
* unique temporary directory and then create fifo in it.
*/
static char *mkTempFifo(void)
{
char *tmppath = NULL, *tmpdir = NULL, *fifofn = NULL;
mode_t mode;
tmppath = rpmExpand("%{_tmppath}", NULL);
if (rpmioMkpath(tmppath, 0755, (uid_t) -1, (gid_t) -1))
goto exit;
tmpdir = rpmGetPath(tmppath, "/rpm-tmp.XXXXXX", NULL);
mode = umask(0077);
tmpdir = mkdtemp(tmpdir);
umask(mode);
if (tmpdir == NULL) {
rpmlog(RPMLOG_ERR, _("error creating temp directory %s: %m\n"),
tmpdir);
tmpdir = _free(tmpdir);
goto exit;
}
fifofn = rpmGetPath(tmpdir, "/fifo", NULL);
if (mkfifo(fifofn, 0600) == -1) {
rpmlog(RPMLOG_ERR, _("error creating fifo %s: %m\n"), fifofn);
fifofn = _free(fifofn);
}
exit:
if (fifofn == NULL && tmpdir != NULL)
unlink(tmpdir);
free(tmppath);
free(tmpdir);
return fifofn;
}
/* Delete fifo and then temporary directory in which it was located */
static int rpmRmTempFifo(const char *fn)