Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: GSA_kwCzR0hTQS13aHB4LXEzcnEtdzhqY84AAve6

Hardening of TypedArrays with non-canonical numeric property names in SES

Impact

What kind of vulnerability is it? Who is impacted?

In Hardened JavaScript, programs can harden objects to safely share objects with co-tenant programs without risk of these other programs tampering with their API surface. Hardening does not guarantee that objects are pure or immutable, so a hardened Map, for example is superficially tamper-proof, but any party holding a reference to the object can both read and write its contents. Based on this precedent, and because TypedArray instances cannot be frozen with Object.isFrozen, harden does not freeze TypedArrays and instead makes them non-extensible and makes all non-indexed properties non-writable and non-configurable. This is consistent with the treatment of Map because the indexed properties represent mutable content and non-indexed properties represent the API.

Due to a defect in harden, properties that have names that parse as numbers but are not the same as the canonical representation of those numbers, as in "+0" and "" which are both equivalent to their canonical number "0", remain writable after hardening.

Any program treating one of these properties as part of its API and relying on harden to prevent modifications would be vulnerable to an API pollution attack, affecting only instances shared by mutually suspicious parties.

Unlike a Map, a hardened TypedArray can only have numbers for content. Any program that is sharing hardened TypedArrays between co-tentant programs and relying on harden to only allow these programs to communicate exclusively by changing numbers within the bounds of the TypedArray, may inadvertently have arranged for a mechanism for a pair of third-parties to communicate arbitrary objects on these other properties.

Patches

Has the problem been patched? What versions should users upgrade to?

SES version 0.16.0 patches this issue, causing harden to recognize properties with non-canonical numeric representations and ensuring that these properties are non-configurable.

Workarounds

Is there a way for users to fix or remediate the vulnerability without upgrading?

Users should avoid sharing TypedArrays between co-tenant programs and instead create wrapper objects that produce a read-only view of the underlying data. We allow harden to succeed for TypedArrays because the treatment is in fact consistent with the behavior of collections like Map, but all collections shared between co-tentant programs should probably be attenuated to either read- or write-only facets and probably close over only part of the content of the collection. However, the motivation for allowing TypedArrays to be hardened in practice is to allow certain legacy modules to function under Hardened JavaScript with LavaMoat, since they export TypedArrays, even though they would ideally export read-only facets of these.

References

Are there any links users can visit to find out more?

Not at this time.

For more information

If you have any questions or comments about this advisory:

Permalink: https://github.com/advisories/GHSA-whpx-q3rq-w8jc
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS13aHB4LXEzcnEtdzhqY84AAve6
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Low
Classification: General
Published: over 1 year ago
Updated: over 1 year ago


Identifiers: GHSA-whpx-q3rq-w8jc
References: Repository: https://github.com/endojs/endo
Blast Radius: 0.0

Affected Packages

npm:ses
Dependent packages: 304
Dependent repositories: 6,629
Downloads: 101,534 last month
Affected Version Ranges: < 0.16.0
Fixed in: 0.16.0
All affected versions: 0.0.0, 0.0.1, 0.1.2, 0.1.3, 0.2.0, 0.3.0, 0.4.0, 0.5.0, 0.5.1, 0.5.2, 0.5.3, 0.6.0, 0.6.1, 0.6.2, 0.6.3, 0.6.4, 0.6.5, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.7.4, 0.7.5, 0.7.6, 0.7.7, 0.8.0, 0.9.0, 0.9.1, 0.10.0, 0.10.1, 0.10.2, 0.10.3, 0.10.4, 0.11.0, 0.11.1, 0.12.0, 0.12.1, 0.12.2, 0.12.3, 0.12.4, 0.12.5, 0.12.6, 0.12.7, 0.13.0, 0.13.1, 0.13.2, 0.13.3, 0.13.4, 0.13.5, 0.14.0, 0.14.1, 0.14.2, 0.14.3, 0.14.4, 0.14.5, 0.15.0, 0.15.1, 0.15.2, 0.15.3, 0.15.4, 0.15.5, 0.15.6, 0.15.7, 0.15.8, 0.15.9, 0.15.10, 0.15.11, 0.15.12, 0.15.13, 0.15.14, 0.15.15, 0.15.16, 0.15.17, 0.15.18, 0.15.19, 0.15.20, 0.15.21, 0.15.22, 0.15.23, 0.15.24
All unaffected versions: 0.16.0, 0.16.1, 0.17.0, 0.17.1, 0.18.0, 0.18.1, 0.18.2, 0.18.3, 0.18.4, 0.18.5, 0.18.7, 0.18.8, 1.0.0, 1.0.1, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.4.1