alpine 3.6
misc weakness #250

4

Weakness Breakdown


Definition:

The software specifies permissions for a security-critical resource in a way that allows the resource to be read or modified by unintended actors.

Warning code(s):

This function is obsolete and not portable. It was in SUSv2 but removed by POSIX.2. What it does exactly varies considerably between systems, particularly in where its prompt is displayed and where it gets its data.

File Name:

strongswan/src/strongswan-5.5.3/src/swanctl/commands/load_creds.c

Context:

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

 		free(ctx->keys->remove(ctx->keys, id));
	}
	vici_free_res(res);
	return ret;
}

/**
 * Load keys from tokens
 */
static void load_tokens(load_ctx_t *ctx)
{
	enumerator_t *enumerator;
	char *section, *pin = NULL, prompt[128];

	enumerator = ctx->cfg->create_section_enumerator(ctx->cfg, "secrets");
	while (enumerator->enumerate(enumerator, &section))
	{
		if (strpfx(section, "token"))
		{
			if (!ctx->noprompt &&
				!ctx->cfg->get_str(ctx->cfg, "secrets.%s.pin", NULL, section))
			{
#ifdef HAVE_GETPASS
				snprintf(prompt, sizeof(prompt), "PIN for %s: ", section);
				pin = strdupnull(getpass(prompt));
#endif
			}
			load_token(ctx, section, pin);
			if (pin)
			{
				memwipe(pin, strlen(pin));
				free(pin);
				pin = NULL;
			}
		}
	}
	enumerator->destroy(enumerator);
}



/**
 * Load a single secret over VICI
 */
static bool load_secret(load_ctx_t *ctx, char *section)
{
	enumerator_t *enumerator;
	vici_req_t *req;
	vici_res_t *res;
	chunk_t data; 

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.