CVE-2022-39218
JSON

7.5high

Random number seed fixed during compilation

Severity
7.5high CVSS:3.1 by GitHub_M
Exploit likelihood
0.94% (higher than 62% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-cmr8-5w4c-44v8

Description

The JS Compute Runtime for Fastly's Compute@Edge platform provides the environment JavaScript is executed in when using the Compute@Edge JavaScript SDK. In versions prior to 0.5.3, the `Math.random` and `crypto.getRandomValues` methods fail to use sufficiently random values. The initial value to seed the PRNG (pseudorandom number generator) is baked-in to the final WebAssembly module, making the sequence of random values for that specific WebAssembly module predictable. An attacker can use the fixed seed to predict random numbers generated by these functions and bypass cryptographic security controls, for example to disclose sensitive data encrypted by functions that use these generators. The problem has been patched in version 0.5.3. No known workarounds exist.

Affected

Product or packageVersionsReported by
fastly js-compute-runtime< 0.5.3CVE List
@fastly/js-compute (npm)from 0.4.0 before 0.5.3GitHub Advisory Database
fastly js-computebefore 0.5.3NVD

All scores

GitHub_M7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
GitHub7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
NVD7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

Classification

CWE-330CWE-335

SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial.

What each source says

CVE List

The JS Compute Runtime for Fastly's Compute@Edge platform provides the environment JavaScript is executed in when using the Compute@Edge JavaScript SDK. In versions prior to 0.5.3, the `Math.random` and `crypto.getRandomValues` methods fail to use sufficiently random values. The initial value to seed the PRNG (pseudorandom number generator) is baked-in to the final WebAssembly module, making the sequence of random values for that specific WebAssembly module predictable. An attacker can use the fixed seed to predict random numbers generated by these functions and bypass cryptographic security controls, for example to disclose sensitive data encrypted by functions that use these generators. The problem has been patched in version 0.5.3. No known workarounds exist.

GitHub Advisory Database
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.

NVD (es)

El JS Compute Runtime para la plataforma Compute@Edge de Fastly proporciona el entorno en el que se ejecuta JavaScript cuando se usa el SDK de JavaScript de Compute@Edge. En versiones anteriores a 0.5.3, los métodos "Math.random" y "crypto.getRandomValues" no usan valores suficientemente aleatorios. El valor inicial para sembrar el PRNG (generador de números pseudoaleatorios) está incorporado en el módulo final de WebAssembly, haciendo que la secuencia de valores aleatorios para ese módulo específico de WebAssembly sea predecible. Un atacante puede usar la semilla fija para predecir los números aleatorios generados por estas funciones y omitir los controles de seguridad criptográficos, por ejemplo para divulgar datos confidenciales cifrados por las funciones que usan estos generadores. El problema ha sido parcheado en versión 0.5.3. No se presentan mitigaciones conocidas

References

Sources

SourceRecordLicence
CVE ListCVE-2022-39218 changed 2025-04-23CVE Terms of Use
GitHub Advisory DatabaseGHSA-cmr8-5w4c-44v8 changed 2023-11-08CC-BY-4.0
NVDCVE-2022-39218 changed 2026-06-17Public domain