alpine 3.6
access weakness #135

1

Weakness Breakdown


Definition:

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:

xdm/src/xdm-1.1.11/xdm/auth.c

Context:

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;
}

int
SaveServerAuthorizations (
    struct display  *d,
    Xauth	    **auths,
    int		    count)
{
    FILE	*auth_file;
    mode_t	mask;
    int		ret;
    int		i;
    const char	dummy_auth[] = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
		               "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;
    }
    else
    {
	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.