Executive brief
browserify-sign is a JavaScript library used to create and verify cryptographic signatures. A flaw in its DSA signature verification allows attackers to forge valid signatures that pass verification with any public key, potentially enabling unauthorized authentication or data tampering in applications relying on this library for cryptographic validation.
Technical details
The vulnerability is an improper verification of cryptographic signatures (CWE-347) in the dsaVerify function. The checkValue function performs an incorrect upper bound check on DSA signature parameters r and s, failing to properly validate that they fall within the required interval [1, q-1]. Specifically, an attacker can set s equal to q (instead of ensuring s < q), which bypasses the check due to a logic error in the comparison operation. An attacker with network access can craft malicious signatures (r, s) = (1, q) that will be accepted as valid for any DSA public key, enabling signature forgery. The vulnerability affects all code paths using DSA verification on untrusted signatures. A patch was released in version 4.2.2.
Affected products
- browserify browserify-sign >=2.6.0, <=4.2.1
Timeline
- 2023-10-26: disclosed
- 2023-10-26: patched: version 4.2.2