Vulnerabilities in pkg:npm/@web3-react/eip1193

PACKAGE
Advisory Identifier: GHSA-8pf3-6fgr-3g3g
Advisory Summary

CVE-2023-30543 is a MODERATE (CVSS 5.2) `chainid` may be outdated if vulnerability (CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')) affecting @web3 react/coinbase wallet libraries in the npm ecosystem. The issue involves `chainid` may be outdated if user changes chains as part of connection in @web3-react. Remediation is available by upgrading affected packages to version 8.0.35-beta.0, 8.0.27-beta, 8.0.30-beta.0, 8.0.37-beta.0.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/@web3-react/eip1193

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/@web3-react/eip1193. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-8pf3-6fgr-3g3g CVE-2023-30543 MODERATE `chainId` may be outdated if user changes chains as part of connection in @web3-react

CVE-2023-30543 at a Glance

CVE Identifier CVE-2023-30543
GHSA Identifier GHSA-8pf3-6fgr-3g3g
Severity MODERATE
CVSS v3.1 Base Score 5.2
CWE Classification CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
Affected Product @web3 react/coinbase wallet
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 5.2

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:U/C:N/I:H/A:L).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required High (PR:H)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity High (I:H)
Availability Low (A:L)

How to Fix CVE-2023-30543

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

@web3-react/coinbase-wallet fixed: 8.0.35-beta.0
npm install @web3-react/coinbase-wallet@8.0.35-beta.0
@web3-react/eip1193 fixed: 8.0.27-beta
npm install @web3-react/eip1193@8.0.27-beta
@web3-react/metamask fixed: 8.0.30-beta.0
npm install @web3-react/metamask@8.0.30-beta.0
@web3-react/walletconnect fixed: 8.0.37-beta.0
npm install @web3-react/walletconnect@8.0.37-beta.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 @web3-react/coinbase-wallet

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2023-30543, inspect your project dependencies using npm:

npm ls @web3-react/coinbase-wallet

Analyze the terminal output to locate any version of @web3 react/coinbase wallet in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 8.0.35-beta.0), your application is affected.

Note: The npm ls @web3-react/coinbase-wallet 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 CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition'), where the product contains a concurrent code sequence that requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence operating concurrently. In @web3 react/coinbase wallet, 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 `chainId` may be outdated if the user changes chains as part of the connection flow. This means that the value of `chainId` returned by `useWeb3React()` may be incorrect. In an application, this means that any data derived from `chainId` could be incorrect. For example, if a swapping application derives a wrapped token contract address from the `chainId` *and* a user has changed chains as part of their connection flow the application could cause the user to send funds to the incorrect address when wrapping. This is a common approach when using other foundational libraries like [`ethers`](https://github.com/ethers-io/ethers.js), and most users of v8 will want to upgrade past the affected versions. ### Patches Patched in https://github.com/Uniswap/web3-react/pull/749. Users of web3-react@8.0.x-beta.0 should upgrade to at least: - @web3-react/coinbase-wallet@^8.0.35-beta.0 - @web3-react/eip1193@^8.0.27-beta.0 - @web3-react/metamask@^8.0.30-beta.0 - @web3-react/walletconnect@^8.0.37-beta.0 ### Workarounds N/A ### References N/A

CVE-2023-30543 Affected @web3 react/coinbase wallet Versions

4 component(s)
Fixed Versions:
8.0.35-beta.08.0.27-beta8.0.30-beta.08.0.37-beta.0
Product / Package Ecosystem Affected Versions Fixed Version
@web3-react/coinbase-wallet
npm
≥ 6.0.0
< 8.0.35-beta.0
8.0.35-beta.0
@web3-react/eip1193
npm
≥ 6.0.0
< 8.0.27-beta
8.0.27-beta
@web3-react/metamask
npm
≥ 6.0.0
< 8.0.30-beta.0
8.0.30-beta.0
@web3-react/walletconnect
npm
≥ 6.0.0
< 8.0.37-beta.0
8.0.37-beta.0

References

Frequently Asked Questions

What is CVE-2023-30543?
CVE-2023-30543 is a security vulnerability in @web3 react/coinbase wallet involving `chainId` may be outdated if user changes chains as part of connection in @web3-react under CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition').
Which @web3 react/coinbase wallet versions are affected?
Affected versions include releases prior to 8.0.35-beta.0, 8.0.27-beta, 8.0.30-beta.0, 8.0.37-beta.0 across affected packages: @web3-react/coinbase-wallet, @web3-react/eip1193, @web3-react/metamask, @web3-react/walletconnect.
What version fixes CVE-2023-30543?
Upgrading to 8.0.35-beta.0, 8.0.27-beta, 8.0.30-beta.0, 8.0.37-beta.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @web3-react/coinbase-wallet affected?
Yes, @web3-react/coinbase-wallet is affected in releases prior to 8.0.35-beta.0. Upgrade your dependency to 8.0.35-beta.0 or later.
Is @web3-react/eip1193 affected?
Yes, @web3-react/eip1193 is affected in releases prior to 8.0.27-beta. Upgrade your dependency to 8.0.27-beta or later.
What is the CVSS score of CVE-2023-30543?
CVE-2023-30543 has a CVSS v3.1 base score of 5.2 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:U/C:N/I:H/A:L.
What CWE is associated with CVE-2023-30543?
CVE-2023-30543 is classified under CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition') (The product contains a concurrent code sequence that requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence operating concurrently.).
How can I check npm dependencies for CVE-2023-30543?
Run the dependency tree command: 'npm ls @web3-react/coinbase-wallet'. 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-8pf3-6fgr-3g3g",
  "modified" : "2023-04-18T22:29:53Z",
  "published" : "2023-04-18T22:29:53Z",
  "aliases" : [ "CVE-2023-30543" ],
  "summary" : "`chainId` may be outdated if user changes chains as part of connection in @web3-react",
  "details" : "### Impact\n`chainId` may be outdated if the user changes chains as part of the connection flow. This means that the value of `chainId` returned by `useWeb3React()` may be incorrect. In an application, this means that any data derived from `chainId` could be incorrect.\n\nFor example, if a swapping application derives a wrapped token contract address from the `chainId` *and* a user has changed chains as part of their connection flow the application could cause the user to send funds to the incorrect address when wrapping. This is a common approach when using other foundational libraries like [`ethers`](https://github.com/ethers-io/ethers.js), and most users of v8 will want to upgrade past the affected versions.\n\n### Patches\nPatched in https://github.com/Uniswap/web3-react/pull/749.\nUsers of web3-react@8.0.x-beta.0 should upgrade to at least:\n - @web3-react/coinbase-wallet@^8.0.35-beta.0\n - @web3-react/eip1193@^8.0.27-beta.0\n - @web3-react/metamask@^8.0.30-beta.0\n - @web3-react/walletconnect@^8.0.37-beta.0\n\n### Workarounds\nN/A\n\n### References\nN/A\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:U/C:N/I:H/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@web3-react/coinbase-wallet"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.0.0"
      }, {
        "fixed" : "8.0.35-beta.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@web3-react/eip1193"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.0.0"
      }, {
        "fixed" : "8.0.27-beta"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "< 8.0.27-beta.0"
    }
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@web3-react/metamask"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.0.0"
      }, {
        "fixed" : "8.0.30-beta.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@web3-react/walletconnect"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.0.0"
      }, {
        "fixed" : "8.0.37-beta.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/Uniswap/web3-react/security/advisories/GHSA-8pf3-6fgr-3g3g"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-30543"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Uniswap/web3-react/pull/749"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Uniswap/web3-react"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-362" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-04-18T22:29:53Z",
    "nvd_published_at" : "2023-04-17T22:15:10Z"
  }
}