Skip to content

Security: Bound public KDF parameters to prevent resource exhaustion - #2

Open
mertcano wants to merge 1 commit into
p-11:mainfrom
mertcano:mertcano-patch-1
Open

mertcano wants to merge 1 commit into
p-11:mainfrom
mertcano:mertcano-patch-1

Conversation

@mertcano

Copy link
Copy Markdown

This PR patches a HIGH-severity vulnerability in the Key Derivation Function (KDF) pipeline where unbounded, caller-provided scrypt parameters could lead to CPU and memory resource exhaustion (Denial of Service).

Key Changes:Runtime Parameter Validation: Introduced validateScryptParams to strictly bound and enforce limits on N (must be a power of two between $2^{10}$ and $2^{17}$), r (max 8), and p (max 2) before allocating any work.

Fail-Closed Execution: The boundary now rejects values outside these limits by throwing a typed RangeError before calling scrypt, safely rejecting tampered metadata from persisted vaults.

This PR patches a HIGH-severity vulnerability in the Key Derivation Function (KDF) pipeline where unbounded, caller-provided scrypt parameters could lead to CPU and memory resource exhaustion (Denial of Service).

Key Changes:Runtime Parameter Validation: Introduced validateScryptParams to strictly bound and enforce limits on N (must be a power of two between $2^{10}$ and $2^{17}$), r (max 8), and p (max 2) before allocating any work. 

Fail-Closed Execution: The boundary now rejects values outside these limits by throwing a typed RangeError before calling scrypt, safely rejecting tampered metadata from persisted vaults.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant