alpine 3.6
access weakness #332

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:

lvm2/src/LVM2.2.02.168/scripts/lvm2_activation_generator_systemd_red_hat.c

Context:

The highlighted line of code below is the trigger point of this particular Alpine 3.6 access weakness.

 
	kmsg_fd = open(KMSG_DEV_PATH, O_WRONLY|O_NOCTTY);

	if (argc != 4) {
		kmsg(LOG_ERR, "LVM: Incorrect number of arguments for activation generator.\n");
		r = EXIT_FAILURE; goto out;
	}

	/* If lvmetad used, rely on autoactivation instead of direct activation. */
	lvm_get_use_lvmetad_and_lvmpolld(&use_lvmetad, &use_lvmpolld);
	if (use_lvmetad)
		goto out;

	dir = argv[1];

	/* mark lvm2-activation.*.service as world-accessible */
	old_mask = umask(0022);

	sysinit_needed = !use_lvmpolld;

	if (!generate_unit(dir, UNIT_EARLY, sysinit_needed) ||
	    !generate_unit(dir, UNIT_MAIN, sysinit_needed) ||
	    !generate_unit(dir, UNIT_NET, sysinit_needed))
		r = EXIT_FAILURE;
	umask(old_mask);
out:
	if (r)
		kmsg(LOG_ERR, "LVM: Activation generator failed.\n");
	if (kmsg_fd != -1)
		(void) close(kmsg_fd);
	return r;
} 

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.