# CVE-2023-30543: `chainId` may be outdated if user changes chains as part of connection in @web3-react

> Outdated chainId during connection flow may cause applications to send funds to incorrect addresses, requiring users to upgrade the library.

- **Severity:** Medium 5.2 (`CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:U/C:N/I:H/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** An administrator
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 17 Apr 2023
- **Updated:** 5 Feb 2025
- **Also known as:** GHSA-8pf3-6fgr-3g3g

## What is CVE-2023-30543?

CVE-2023-30543 is a medium-severity vulnerability in Uniswap web3-react, published on 17 Apr 2023. An attacker needs administrator access to exploit it, and only if a user opens a file or follows a link.

### Official description

@web3-react is a framework for building Ethereum Apps . In affected versions the `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 issue has been addressed in PR #749 and is available in updated npm artifacts. There are no known workarounds for this issue. Users are advised to upgrade.

Weakness: CWE-362 (Concurrent Execution using Shared Resource with Improper Synchronization)

## Which versions are affected by CVE-2023-30543?

8 open source packages ship an affected version, including @web3-react/coinbase-wallet, @web3-react/eip1193 and @web3-react/metamask. It affects 4 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `@web3-react/coinbase-wallet` | npm | From 6.0.0 | 8.0.35-beta.0 |
| `@web3-react/coinbase-wallet` | npm | From 6.0.0 | 8.0.35-beta.0 |
| `@web3-react/eip1193` | npm | From 6.0.0 | 8.0.27-beta |
| `@web3-react/eip1193` | npm | From 6.0.0 | 8.0.27-beta |
| `@web3-react/metamask` | npm | From 6.0.0 | 8.0.30-beta.0 |
| `@web3-react/metamask` | npm | From 6.0.0 | 8.0.30-beta.0 |
| `@web3-react/walletconnect` | npm | From 6.0.0 | 8.0.37-beta.0 |
| `@web3-react/walletconnect` | npm | From 6.0.0 | 8.0.37-beta.0 |

Products: Uniswap Web3-React Coinbase-Wallet, Uniswap Web3-React Eip1193, Uniswap Web3-React Metamask, Uniswap Web3-React Walletconnect.

## How do I fix CVE-2023-30543?

Upgrade @web3-react/coinbase-wallet to 8.0.35-beta.0 or later.

## Is CVE-2023-30543 being exploited?

There is no known exploitation of CVE-2023-30543 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-30543 and fix it if it is affected.

What it is: CVE-2023-30543 is a medium-severity vulnerability in Uniswap web3-react, published on 17 Apr 2023. An attacker needs administrator access to exploit it, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2023-30543 in the wild and no public exploit code.

Affected packages and fixed versions:
- @web3-react/coinbase-wallet (npm): affected from 6.0.0; fixed in 8.0.35-beta.0
- @web3-react/coinbase-wallet (npm): affected from 6.0.0; fixed in 8.0.35-beta.0
- @web3-react/eip1193 (npm): affected from 6.0.0; fixed in 8.0.27-beta
- @web3-react/eip1193 (npm): affected from 6.0.0; fixed in 8.0.27-beta
- @web3-react/metamask (npm): affected from 6.0.0; fixed in 8.0.30-beta.0
- @web3-react/metamask (npm): affected from 6.0.0; fixed in 8.0.30-beta.0
- @web3-react/walletconnect (npm): affected from 6.0.0; fixed in 8.0.37-beta.0
- @web3-react/walletconnect (npm): affected from 6.0.0; fixed in 8.0.37-beta.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2023-30543/ (Markdown: https://insights.sbomify.com/CVE-2023-30543/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2023-30543
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2023-30543
- OSV: https://osv.dev/vulnerability/CVE-2023-30543

---
From sbomify Insights: https://insights.sbomify.com/CVE-2023-30543/
Summaries are generated and may contain mistakes; the official description above is the record.
