alpine 3.6
access weakness #472

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:

gradm/src/gradm/gradm_fulllearn.c

Context:

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

 			fprintf(stream, "role_transitions admin shutdown\n");
		}
		allowed_ips = user->allowed_ips;
	} else {
		fprintf(stream, "role %s g\n", group->rolename);
		allowed_ips = group->allowed_ips;
	}

	if (allowed_ips && !(grlearn_options & GR_DONT_LEARN_ALLOWED_IPS))
		traverse_ip_tree(allowed_ips, NULL, &display_only_ip, 0, stream);

	return;
}

void generate_full_learned_acls(FILE *learnlog, FILE *stream)
{
	struct gr_learn_group_node *group, *tmpgroup;
	struct gr_learn_user_node *user, *tmpuser;
	int removed = 0;
	char *current_output_file = NULL;
	int got_users = 0;
	int got_groups = 0;
	FILE *policystream;

	umask(0077);

	if (grlearn_options & GR_SPLIT_ROLES) {
		if (stream) {
			fprintf(stderr, "Error: Output path must be a directory when \"split-roles\" is used in learn_config.\n");
			exit(EXIT_FAILURE);
		}
		current_output_file = (char *)alloca(strlen(output_log) + 16384);
		sprintf(current_output_file, "%s/policy", output_log);
		stream = fopen(current_output_file, "w");
		if (stream == NULL) {
			fprintf(stderr, "Unable to open %s for writing.\n"
					"Error: %s\n", current_output_file, strerror(errno));
			exit(EXIT_FAILURE);
		}
	} else {
		if (stream == NULL) {
			fprintf(stderr, "Error: Output path must be a file when \"split-roles\" is not used in learn_config.\n");
			exit(EXIT_FAILURE);
		}
	}



	output_learn_header(stream);
 

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.