CVE-2026-48158

use-context-selector was vulnerable to malicious code execution via compromised commits

Published Aug 10, 2026 CVSS 4.0 · 9.3 Critical EPSS < 1% KEV · Not listed
Description
use-context-selector is a React useContextSelector hook in userland Between 2026-05-18 15:57:18 and 2026-05-19 15:24:34, the default branch contained malicious commits 9d8481a513b7b0d1c0941b220c69b25de748641b through 6f2dae054ca014068bdbbb4db96006424d674124 that executed remote attacker-controlled code on developer machines during
`npm install`. The commits were removed by force-push, but local clones, forks, and direct-SHA URLs may still contain them, and `npm install` against an affected checkout will still execute the code today. The package was not published to npm. `src/install.js` was added and wired into the `postinstall` script. It fetched a JavaScript payload from an attacker-controlled HTTPS endpoint (configurable via an environment variable), disabled TLS verification, and evaluated the response as code with `require` available. Execution was deliberately skipped on CI and cloud/serverless environments, targeting developer workstations. The second-stage payload was attacker-hosted and cannot be reconstructed. Assume full compromise of anything reachable from a Node process with the user's permissions. Those who ran `npm install` against an affected checkout on a developer machine on or after 2026-05-18 15:57:18 should treat the machine as compromised, rotate every credential the machine could reach, audit account activity** since 2026-05-18 15:57:18, and clean local clones.

Analysis

AI-generated

Technical impact

The vulnerability originates from a temporary addition of a post‑install script in use‑context‑selector’s repository. Between 2026‑05‑18 and 2026‑05‑19 the default branch contained malicious commits that added src/install.js, which the npm post‑install hook ran automatically. That script fetched JavaScript from an attacker‑controlled HTTPS endpoint, disabled TLS verification, and evaluated it using require, allowing an attacker to execute arbitrary code with the same permissions as the user performing npm install. The attack targets developer workstations; if executed on a developer machine, an attacker can obtain all credentials and data accessible to the Node process, essentially satisfying the criteria for remote code execution.

Affected Systems

The affected product is the React use‑context‑selector hook provided by the vendor dai‑shi:use-context-selector. The compromise occurred in a range of commits (9d8481a5‑6f2dae05) added to the default branch during the window of May 18–19, 2026. Since the package was never published to npm, no centralized distribution channel was affected. Anyone who cloned the repository or used a direct‑SHA reference within that period, or who installed the package from a local clone after that window, is at risk. Clones that have been force‑pushed to remove the commits are not compromised, but any local or forked copy that still contains the malicious commits remains vulnerable.

Risk and Exploitability

The CVSS score of 9.3 reflects the severity of execution and the high impact on confidentiality, integrity, and availability of developer machines. There is no EPSS score provided, and the vulnerability is not listed in CISA KEV, indicating it has not yet been observed in the wild, but the exploitation vector is clear: a malicious post‑install script executed during npm install. If a developer uses a checkout that still includes the malicious commits, the attacker’s payload will run automatically, yielding full compromise of that machine. The attacker can also pivot to any systems or services the compromised machine can reach.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Delete any local copies of the repository that still contain the malicious commits or force‑push commits that remove the history.
  • Remove the use‑context‑selector entry from your project’s package.json, delete node_modules where the package is installed, and reinstall dependencies from a known‑clean source (e.g., a fresh clone made after 2026‑05‑19 or an official release that predates the incident).
  • If you still need to use the library, replace it with an official version that omits the post‑install script or remove the dependency entirely.

Generated by OpenCVE AI on August 10, 2026 at 17:51 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
First Time appeared Dai-shi
Dai-shi use-context-selector
Vendors & Products Dai-shi
Dai-shi use-context-selector
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'none', 'Technical Impact': 'total'}, 'version': '2.0.3'}

Type Values Removed Values Added
Description use-context-selector is a React useContextSelector hook in userland Between 2026-05-18 15:57:18 and 2026-05-19 15:24:34, the default branch contained malicious commits 9d8481a513b7b0d1c0941b220c69b25de748641b through 6f2dae054ca014068bdbbb4db96006424d674124 that executed remote attacker-controlled code on developer machines during `npm install`. The commits were removed by force-push, but local clones, forks, and direct-SHA URLs may still contain them, and `npm install` against an affected checkout will still execute the code today. The package was not published to npm. `src/install.js` was added and wired into the `postinstall` script. It fetched a JavaScript payload from an attacker-controlled HTTPS endpoint (configurable via an environment variable), disabled TLS verification, and evaluated the response as code with `require` available. Execution was deliberately skipped on CI and cloud/serverless environments, targeting developer workstations. The second-stage payload was attacker-hosted and cannot be reconstructed. Assume full compromise of anything reachable from a Node process with the user's permissions. Those who ran `npm install` against an affected checkout on a developer machine on or after 2026-05-18 15:57:18 should treat the machine as compromised, rotate every credential the machine could reach, audit account activity** since 2026-05-18 15:57:18, and clean local clones.
Title use-context-selector was vulnerable to malicious code execution via compromised commits
Weaknesses CWE-506
References
Metrics cvssV4_0

{'score': 9.3, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N'}

Weaknesses

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Aug 11, 2026, 1:56 AM
Reserved
May 20, 2026, 11:12 PM
Status
Deferred
Published
Aug 10, 2026, 4:19 PM
Modified
Oct 23, 2026, 8:10 PM