GHSA-cmr8-5w4c-44v8

Suggest an improvement
Source
https://github.com/advisories/GHSA-cmr8-5w4c-44v8
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2022/09/GHSA-cmr8-5w4c-44v8/GHSA-cmr8-5w4c-44v8.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-cmr8-5w4c-44v8
Aliases
Published
2022-09-20T20:45:10Z
Modified
2023-11-08T04:10:15Z
Severity
  • 7.5 (High) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N CVSS Calculator
Summary
Fastly Compute@Edge JS Runtime has fixed random number seed during compilation
Details

Impact

Math.random and crypto.getRandomValues methods failed to use sufficiently random values. The initial value to seed the CSPRNG (cryptographically secure pseudorandom number generator) was baked-in to the final WebAssembly module meaning the sequence of numbers generated was predictable for that specific WebAssembly module. An attacker with access to that same WebAssembly module that calls the affected methods could use the fixed seed to predict random numbers generated by these functions. This information could be used to bypass cryptographic security controls, for example to disclose sensitive data encrypted by functions that use these generators.

Patches

The problem has been fixed in version 0.5.3.

Corrected Math.random and crypto.getRandomValues methods to always use sufficiently random values. The previous versions would use a CSPRNG (cryptographically secure pseudorandom number generator) which we would seed with a random value. However, due to our use of Wizer, the initial value to seed the CSPRNG was baked-in to the final WebAssembly module meaning the sequence of numbers generated was predictable for that specific WebAssembly module. The new implementations of both Math.random and crypto.getRandomValues do not use a CSPRNG and instead pull random values from WASI (WebAssembly System Interface) libc’s random_get function, which is always a sufficiently random value.

Workarounds

There are no workarounds, you must upgrade to version 0.5.3 or later.

Database specific
{
    "cwe_ids":  [
        "CWE-330",
        "CWE-335"
    ],
    "github_reviewed":  true,
    "github_reviewed_at":  "2022-09-20T20:45:10Z",
    "nvd_published_at":  "2022-09-20T20:15:00Z",
    "severity":  "HIGH"
}
References

Affected packages

npm / @fastly/js-compute

Package

Name
@fastly/js-compute
View open source insights on deps.dev
Purl
pkg:npm/%40fastly/js-compute

Affected ranges

Type
SEMVER
Events
Introduced
0.4.0
Fixed
0.5.3

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2022/09/GHSA-cmr8-5w4c-44v8/GHSA-cmr8-5w4c-44v8.json"