T09 · Insecure Skill Coding Practices
- Location
SKILL.md:205- Finding
Passphrases Generated with a Predictable Non-Cryptographic PRNG
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 205-222
Vulnerability Type: Use of a predictable pseudo-random number generator for security-sensitive credentials
Risk Level: Highbash generate_passphrase() { local count=${1:-4} local separator=${2:--} local passphrase="" for i in $(seq 1 "$count"); do word="${WORD_LIST[$((RANDOM % ${#WORD_LIST[@]}))]}" if [ -z "$passphrase" ]; then passphrase="$word" else passphrase="${passphrase}${separator}${word}" fi done passphrase="${passphrase}${separator}$((RANDOM % 100))" echo "$passphrase" }Technical Analysis
The Bash implementation uses
$RANDOMto select every word and the numeric suffix. Bash$RANDOMis a small-state, non-cryptographic pseudo-random number generator and is unsuitable for password or passphrase generation. Its outputs may be predictable when an attacker can observe related outputs or infer the process state.The expressions using the modulo operator also introduce selection bias when the number of possible
$RANDOMvalues is not evenly divisible by the word-list size or by 100. This further weakens the distribution of generated credentials.Attack Path
- A user invokes the documented Bash passphrase generator and uses its output as an account credential.
- An attacker learns that the credential was generated by this Skill, and therefore knows the fixed word list and output format.
- The attacker observes one or more related generator outputs, estimates the generator state, or enumerates the comparatively small output space.
- The attacker generates likely candidate passphrases and attempts them against the target account or a captured password hash.
- If authentication lacks strong rate limiting, or if the attacker has an offline verifier, the credential may be recovered.
Impact Assessment
Successfu ...[truncated 422 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove the Bash
$RANDOMimplementation from all security-sensitive credential workflows. - Use Python's
secretsmodule or an equivalent operating-system-backed cryptographic random source. - Use unbiased selection such as
secrets.choice(word_list)rather than modulo reduction. - Generate numeric components with
secrets.randbelow()if they are necessary. - Add statistical and functional tests that verify selections use an approved cryptographic random source.
- Clearly state that previously generated Bash passphrases should be replaced if they protect sensitive accounts.
- Remove the Bash
