GHSA-whpx-q3rq-w8jc: Ses Hardening Of TypedArrays With Non-canonical Vulnerability

LOW
Published
Advisory Summary

GHSA-whpx-q3rq-w8jc is a LOW hardening of typedarrays with non-canonical vulnerability (General Security Weakness) affecting Ses libraries in the npm ecosystem. The issue involves hardening of typedarrays with non-canonical numeric property names in ses. Remediation is available by upgrading affected packages to version 0.16.0.

GHSA-whpx-q3rq-w8jc at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-whpx-q3rq-w8jc
Severity LOW
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product Ses
Package Ecosystem npm
Published Date
Last Updated

How to Fix GHSA-whpx-q3rq-w8jc

To remediate this vulnerability, upgrade all affected Ses dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

ses fixed: 0.16.0
npm install ses@0.16.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls ses

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-whpx-q3rq-w8jc, inspect your project dependencies using npm:

npm ls ses

Analyze the terminal output to locate any version of Ses in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.16.0), your application is affected.

Note: The npm ls ses command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under General Security Weakness. In Ses, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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: * Email us at [security@agoric.com](mailto:security@agoric.com)

GHSA-whpx-q3rq-w8jc Affected Ses Versions

1 component(s)
Fixed Versions:
0.16.0
Product / Package Ecosystem Affected Versions Fixed Version
ses
npm
< 0.16.0
0.16.0

References

Frequently Asked Questions

What is GHSA-whpx-q3rq-w8jc?
GHSA-whpx-q3rq-w8jc is a security vulnerability in Ses involving Hardening of TypedArrays with non-canonical numeric property names in SES under General Security Weakness.
Which Ses versions are affected?
Affected versions include releases prior to 0.16.0 across affected packages: ses.
What version fixes GHSA-whpx-q3rq-w8jc?
Upgrading to 0.16.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is ses affected?
Yes, ses is affected in releases prior to 0.16.0. Upgrade your dependency to 0.16.0 or later.
What CWE is associated with GHSA-whpx-q3rq-w8jc?
GHSA-whpx-q3rq-w8jc is classified under General Security Weakness.
How can I check npm dependencies for GHSA-whpx-q3rq-w8jc?
Run the dependency tree command: 'npm ls ses'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-whpx-q3rq-w8jc",
  "modified" : "2022-10-20T18:38:35Z",
  "published" : "2022-10-20T18:38:35Z",
  "aliases" : [ ],
  "summary" : "Hardening of TypedArrays with non-canonical numeric property names in SES",
  "details" : "### Impact\n_What kind of vulnerability is it? Who is impacted?_\n\nIn 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.\n\nDue 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.\n\nAny 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.\n\nUnlike 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.\n\n### Patches\n_Has the problem been patched? What versions should users upgrade to?_\n\nSES 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.\n\n### Workarounds\n_Is there a way for users to fix or remediate the vulnerability without upgrading?_\n\nUsers 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.\n\n### References\n_Are there any links users can visit to find out more?_\n\nNot at this time.\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Email us at [security@agoric.com](mailto:security@agoric.com)\n",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "ses"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.16.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/endojs/endo/security/advisories/GHSA-whpx-q3rq-w8jc"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/endojs/endo/commit/88cab0be4cf816dc578f2ff441fd9bcda0aa5cf5"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/endojs/endo"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-10-20T18:38:35Z",
    "nvd_published_at" : null
  }
}