alpine 3.7
crypto weakness #294

4

Weakness Breakdown


Definition:

This weakness involves creating non-standard or non-tested algorithms, using weak algorithms or applying cryptographic algorithms incorrectly. Algorithms that were once considered safe are commonly later found to be unsafe, as the algorithms were broken.

Warning code(s):

The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment.

File Name:

mkinitfs/src/mkinitfs-3.2.0/nlplug-findfs.c

Context:

The highlighted line of code below is the trigger point of this particular Alpine 3.7 crypto weakness.

 	notify_main(c);
	return NULL;
}

static void start_thread(struct ueventconf *conf, void *(*thread_main)(void *))
{
	pthread_t tid;
	pthread_attr_t attr;

	pthread_attr_init(&attr);
	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
	if (pthread_create(&tid, &attr, thread_main, conf) != 0)
		err(1, "failed to create thread");
	pthread_attr_destroy(&attr);
}

static void start_cryptsetup(struct ueventconf *conf)
{
	if(conf->crypt.header.devnode[0] != '\0') {
		dbg("starting cryptsetup %s -> %s (header: %s)",
		    conf->crypt.data.devnode, conf->crypt.data.name,
		    conf->crypt.header.devnode);
	} else {
		dbg("starting cryptsetup %s -> %s", conf->crypt.data.devnode,
		    conf->crypt.data.name);
	}
	load_kmod("dm-crypt", NULL, 0);
	conf->cryptsetup_running = 1;
	conf->running_threads = 1;
	start_thread(conf, cryptsetup_thread);
}

static int is_mounted(const char *devnode) {
	char line[PATH_MAX];
	FILE *f = fopen("/proc/mounts", "r");
	int r = 0;
	if (f == NULL)
		return 0;
	while (fgets(line, sizeof(line), f) != NULL) {
		strtok(line, " ");
		if (strcmp(devnode, line) == 0) {
			r = 1;
			break;
		}
	}
	fclose(f);
	return r;
}

struct recurse_opts { 

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.