RandomString may have less entropy than expected
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Heat |
Fix Released
|
Medium
|
Zane Bitter | ||
OpenStack Security Advisory |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
When generating a random string, once we have selected from the various required pools, we continue by selecting a pool at random and then selecting a character from that pool at random. This does not take into account the differing sizes of the available pools, nor the fact that the same character could appear in multiple pools. This results in a non-uniform probability distribution of characters.
For example, in the following resource:
type: OS::Heat:
properties:
length: 66
character
- class: lettersdigits
character
- sequence: "*$"
one might reasonably expect to find an average of 3 '*' or '$' characters in the output, but in fact there would be an average of 33.
Since users mostly make use of this feature to generate default passwords for services they are deploying, this would result in the generated passwords having slightly less entropy than expected. Pathological cases where the entropy is massively reduced (like the one above - where it is only 229.5 bits vs. the expected 391 bits) are possible, although it's probably unlikely that users would encounter them by accident.
Fix proposed to branch: master /review. openstack. org/554745
Review: https:/