Use of Weak Hash Affecting crypto-es package, versions <2.1.0


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.15% (53rd percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Use of Weak Hash vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-CRYPTOES-6032390
  • published25 Oct 2023
  • disclosed23 Oct 2023
  • creditThomas Shadwell

Introduced: 23 Oct 2023

CVE-2023-46133  (opens in a new tab)
CWE-328  (opens in a new tab)

How to fix?

Upgrade crypto-es to version 2.1.0 or higher.

Overview

crypto-es is a cryptography algorithms library compatible with ES6 and TypeScript.

Affected versions of this package are vulnerable to Use of Weak Hash due to inadequate security settings in the PBKDF2Algo class, which uses insecure SHA1 and has a low iteration count of 1. These insecure settings allow attackers to perform brute-force attacks when PBKDF2Algo is used with the default parameters.

No information is directly exposed when a hash is generated, regardless of whether the PBKDF2 function is in the vulnerable configuration or not. However, it may be possible to recover the original data, more or less easily depending on the configured parameters, using a brute force attack. This is a low impact on the confidentiality of the protected data, which are in a different scope than the vulnerable package.

The attacker similarly may be able to modify some data which is meant to be protected by the vulnerable package - most commonly when it is used for signature verification. This would require a subsequent exploitation, such as forcing a hash collision via length extension attack. The integrity of the data is therefore compromised, but the quantity and targeting of that data is not fully in the attacker's control, yielding a low integrity impact.

Note: This vulnerability is related to https://security.snyk.io/vuln/SNYK-JS-CRYPTOJS-6028119 in crypto-js.

Workaround

This vulnerability can be avoided by setting PBKDF2 to use SHA-256 instead of SHA-1 and increasing the number of iterations to a sufficiently high value depending on the intended use.

See, for example, the OWASP PBKDF2 Cheat Sheet for recommendations.

CVSS Scores

version 3.1