alpine 3.8
crypto weakness #2

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:

innoextract/src/innoextract-1.7/src/crypto/arc4.cpp

Context:

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

 	for(size_t i = 0; i < sizeof(state); i++) {
		j = (j + state[i] + boost::uint8_t(key[i % length])) % sizeof(state);
		std::swap(state[i], state[j]);
	}
	
}

void arc4::update() {
	
	a = (a + 1) % sizeof(state);
	b = (b + state[a]) % sizeof(state);
	
	std::swap(state[a], state[b]);
	
}

void arc4::discard(size_t length) {
	
	for(size_t i = 0; i < length; i++) {
		update();
	}
	
}

void arc4::crypt(const char * in, char * out, size_t length) {
	
	for(size_t i = 0; i < length; i++) {
		update();
		out[i] = char(state[size_t(state[a] + state[b]) % sizeof(state)] ^ boost::uint8_t(in[i]));
	}
	
}

} // namespace crypto 

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.