Vulnerability DatabaseGHSA-chpj-828m-9wj6

GHSA-chpj-828m-9wj6: 
JavaScript vulnerability analysis and mitigation

Summary

Karakeep's webhook worker sends a user-configured bearer token in the Authorization header. The shared fetchWithProxy() helper follows redirects manually and reuses the same header set on every hop without comparing origins, so a webhook endpoint that redirects to a different origin causes the bearer token to be forwarded to that origin. For HTTP 307/308, the original POST body is forwarded as well. This is distinct from CVE-2026-45082 (SSRF protection bypass via redirect handling, fixed in 0.32.0): that fix validates redirect destinations but does not bind credentials to an origin. The behaviour is present on current main. Suggested severity: Medium (CVSS 3.1 AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N = 4.8).

Details

Karakeep's webhook worker sends an optional authentication token on each delivery as Authorization: Bearer <token>. The shared HTTP helper fetchWithProxy() in apps/workers/network.ts follows redirects manually. prepareFetchOptions() builds a single baseHeaders object once, and the redirect loop reuses that same object for every subsequent hop. When a redirect changes the destination origin, the helper validates the new destination (SSRF checks) but does not compare origins and does not remove sensitive headers. As a result, a webhook endpoint that returns a redirect to a different origin causes the configured bearer token to be forwarded. For 307/308 the original POST method and JSON body are preserved and forwarded; for 301/302/303 the method is downgraded to GET and the body dropped, but Authorization is still retained. Affected code (commit 75aeaaa4eb71b1d3143d7bdc6b88c66fbcfb5fea):

  • apps/workers/workers/webhookWorker.ts, lines 135–154 — request construction; Authorization: Bearer <token> at line 141, JSON body at 145–152.
  • apps/workers/network.ts:
    • prepareFetchOptions() lines 428–449 — baseHeaders built once (line 444).
    • fetchWithProxy() lines 476–551 — same baseHeaders passed to every hop (line 514); redirect branch 537–546 deletes only content-length (line 545), never Authorization. Root cause: sensitive request headers live in a mutable header object reused across all redirect hops; the redirect handler validates the destination URL but does not enforce an origin-bound credential policy. Recommended fix:
  • Webhook-specific (one line): pass maxRedirects: 0 at the fetchWithProxy call in webhookWorker.ts (line 135) and require the final webhook URL to be configured directly. Confirmed to stop the leak.
  • Defense-in-depth (shared helper): on an origin change, delete Authorization, Proxy-Authorization and Cookie before following the redirect; also strip them on an HTTPS→HTTP downgrade, and drop content-type on the 301/302/303→GET path. Precedent for stripping Authorization on cross-origin redirect: WHATWG Fetch / Node undici do this by default; same bug class fixed in follow-redirects (CVE-2022-0155, CVE-2024-28849) and node-fetch (CVE-2022-0235).

Proof of concept

Reproducible entirely on loopback; no third-party service is contacted. Two local HTTP servers on different ports (= different origins); the first returns a 307 to the second; the second records the Authorization header and body. Configuration detail: Karakeep correctly blocks loopback by default, so for the test only, allow 127.0.0.1 through the internal-host allowlist (mock allowedInternalHostnames = ["127.0.0.1"]). Test (drop into apps/workers as a vitest test, or run standalone against network.ts): import http from "node:http"; import type { AddressInfo } from "node:net"; import { fetchWithProxy } from "./network"; function listen(s: http.Server): Promise<number> { return new Promise((r) => s.listen(0, "127.0.0.1", () => r((s.address() as AddressInfo).port))); } test("cross-origin redirect forwards Authorization header", async () => { let auth: string | undefined, body = ""; const sink = http.createServer((req, res) => { auth = req.headers.authorization; req.on("data", (c) => (body += c.toString())); req.on("end", () => res.writeHead(200).end("ok")); }); const sinkPort = await listen(sink); const redir = http.createServer((_r, res) => { res.writeHead(307, { Location: http://127.0.0.1:${sinkPort}/capture }); res.end(); }); const redirPort = await listen(redir); try { await fetchWithProxy(http://127.0.0.1:${redirPort}/hook, { method: "POST", headers: { "Content-Type": "application/json", Authorization: "Bearer canary-secret" }, body: JSON.stringify({ hello: "world" }), }); expect(auth).toBe("Bearer canary-secret"); // leaks on current code expect(body).toContain("world"); } finally { redir.close(); sink.close(); } }); Observed (Node v24.21.0, commit 75aeaaa4eb71b1d3143d7bdc6b88c66fbcfb5fea): second-origin Authorization: Bearer <canary> second-origin body: {"hello":"world"} pass 1 / fail 0 — Authorization persists across cross-origin 307 redirect With maxRedirects: 0 the redirect is rejected and the second origin receives nothing (fix validated).

Impact

Type: Insertion of Sensitive Information Into Sent Data (CWE-201) / Insufficiently Protected Credentials (CWE-522). Who is impacted: self-hosted Karakeep deployments where a user configures a webhook with a bearer token and the configured receiver can be induced to redirect to an attacker-controlled origin (e.g. an open redirect on the receiver, a compromised receiver, or another attacker-controllable redirect). What the attacker gains: the bearer token configured for that webhook, and with a 307/308 redirect the webhook JSON body (job ID, bookmark ID, user ID, bookmark URL/type, operation). In the common case the token is the receiver's own inbound secret, so a redirect-controlling third party can capture it and have Karakeep forge webhook events to them; where users reuse a real integration/API token (e.g. n8n, Home Assistant), the leak can grant access to that external service. Delivery is retried, so the token may be sent to the redirect target multiple times per event.


Source: NVD

Related JavaScript vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

GHSA-g78f-3cr8-fhw5MEDIUM6.5
  • JavaScript logoJavaScript
  • imapflow
NoYesNov 15, 2026
GHSA-4j79-qhcg-f5wvMEDIUM6.4
  • JavaScript logoJavaScript
  • systeminformation
NoYesNov 15, 2026
GHSA-fcj7-c534-vj7fMEDIUM5.9
  • JavaScript logoJavaScript
  • find-my-way
NoNoNov 15, 2026
GHSA-chpj-828m-9wj6MEDIUM4.8
  • JavaScript logoJavaScript
  • karakeep
NoYesNov 15, 2026
GHSA-xcgp-hwgr-q92jLOW3.5
  • JavaScript logoJavaScript
  • karakeep
NoYesNov 15, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Additional Wiz resources

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management