alpine 3.6
access weakness #135


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.


    (void) unlink (d->authFile);
    *file = fopen (d->authFile, "w");
    return TRUE;

SaveServerAuthorizations (
    struct display  *d,
    Xauth	    **auths,
    int		    count)
    FILE	*auth_file;
    mode_t	mask;
    int		ret;
    int		i;
		               "XXXXXXXXXXXXXXXXX"; /* 64 "X"s */
    int		err = 0;

    mask = umask (0077);
    ret = MakeServerAuthFile(d, &auth_file);
    umask (mask);
    if (!ret)
	return FALSE;
    if (!auth_file) {
	LogError ("cannot open server authorization file %s: %s\n",
		  d->authFile, _SysErrorMsg (errno));
	ret = FALSE;
	Debug ("File: %s auth: %p\n", d->authFile, auths);
	ret = TRUE;
	if (count == 0)
		 * This is a crude hack to determine whether we really can
		 * write to the auth file even if we don't have real data
		 * to write right now.

		 * Write garbage data to file to provoke ENOSPC and other
		 * errors.
		(void) fprintf (auth_file, "%s", dummy_auth);
		(void) fflush (auth_file); 

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.