alpine 3.6
access weakness #319


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.

 			return 0;
		log_sys_error("unlink", control);
		return -1;

	return 1;

static int _create_control(const char *control, uint32_t major, uint32_t minor)
	int ret;
	mode_t old_umask;

	 * Return if the control already exists with intended major/minor
	 * or there's an error unlinking an apparently incorrect one.
	ret = _control_exists(control, major, minor);
	if (ret == -1)
		return 0;	/* Failed to unlink existing incorrect node */
	if (ret)
		return 1;	/* Already exists and correct */

	(void) dm_prepare_selinux_context(dm_dir(), S_IFDIR);
	old_umask = umask(DM_DEV_DIR_UMASK);
	ret = dm_create_dir(dm_dir());
	(void) dm_prepare_selinux_context(NULL, 0);

	if (!ret)
		return 0;

	log_verbose("Creating device %s (%u, %u)", control, major, minor);

	(void) dm_prepare_selinux_context(control, S_IFCHR);
	old_umask = umask(DM_CONTROL_NODE_UMASK);
	if (mknod(control, S_IFCHR | S_IRUSR | S_IWUSR,
		  MKDEV((dev_t)major, (dev_t)minor)) < 0)  {
		log_sys_error("mknod", control);
		(void) dm_prepare_selinux_context(NULL, 0);
		return 0;
	(void) dm_prepare_selinux_context(NULL, 0);

	return 1;


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.