Skip to content

Weak PBKDF2 Iteration Count #84

@aleister1102

Description

@aleister1102

Summary

The gokey utility uses an inadequately low iteration count (4,096) for PBKDF2-HMAC-SHA256 when deriving the master encryption key for "seed files". This significantly weakens the cryptographic protection described in the documentation, allowing an attacker who obtains a user's seed file to perform high-speed offline brute-force attacks to recover the master password and all derived secrets.

Details

gokey is a vaultless password manager that can optionally use a "seed file" as an entropy source. According to the README.md, it is "reasonably safe to store/backup seed files to a third party location" because the data is encrypted with the user's master password.

The encryption key (masterkey) used to protect the seed file is derived in csprng.go using the passKey function:

func passKey(password, realm string) []byte {
	return pbkdf2.Key([]byte(password), []byte(realm), 4096, 32, sha256.New)
}

The iteration count is hardcoded to 4096. This value is drastically below modern security guidelines (e.g., OWASP recommends at least 600,000 iterations for PBKDF2-HMAC-SHA256). Since the 12-byte salt is stored as a plaintext prefix in the seed file, there is no effective salt secret, and the low work-factor makes the master password vulnerable to GPU-accelerated brute-forcing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions