Saltcorn: Open Redirect in `POST /auth/login` due to incomplete `is_relative_url` validation (backslash bypass)
Date: 2026-04
Affected: npm/@saltcorn/server, npm/@saltcorn/server, npm/@saltcorn/server
Attack vector: other
Category: vulnerability-disclosure
Severity: Medium
CVE: CVE-2026-42259
CWE: CWE-601

### Summary Saltcorn validates the post-login `dest` parameter with a string check that only blocks `:/` and `//`. Because all WHATWG-compliant browsers normalise backslashes (`\`) to forward slashes (`/`) for special schemes, a payload such as `/\evil.com/path` slips through `is_relative_url()`, is emitted unchanged in the HTTP `Location` header, and causes the browser to navigate cross-origin to an attacker-controlled domain. The bug is reachable on a default install and only requires a victim who can be tricked into logging in via a crafted Saltcorn URL. ### Details Vulnerable function: `packages/server/routes/utils.js:393-395` ```js const is_relative_url = (url) => { return typeof url === "string" && !url.includes(":/") && !url.includes("//"); }; ``` The function's intent is to allow only same-origin redirects, but the allow-list only checks for two literal substrings. It does not handle: - backslash characters, which WHATWG URL parsing (used by every modern browser) treats as forward slashes for the special schemes `http`, `https`, `ftp`, `ws`, `wss`. A URL parser fed `/\evil.com/path` with a base of `http://victim/` resolves to `http://evil.com/path`. - non-`http(s):` schemes that do not contain `:/`. The strings `javascript:alert(1)`, `data:text/html,...`, `vbscript:...` all pass. Vulnerable callsite: `packages/server/auth/routes.js:1371-1376` ```js } else if ( (req.body || {}).dest && is_relative_url(decodeURIComponent((req.body || {}).dest)) ) { res.redi


Mitigations:

Architectural layers (MAESTRO):