Project: Teable (https://github.com/teableio/teable/)
File: apps/nextjs-app/src/features/auth/pages/LoginPage.tsx
Vulnerability Type: DOM Cross-Site Scripting (XSS)
Severity: High (CVSS 3.1 Base Score: 8.2)
Report Date: March 7, 2026
A DOM Cross-Site Scripting (XSS) vulnerability has been discovered in Teable's sign-up/in functionality. The application improperly trusts a URL parameter (redirect) during the sign-in flow. An attacker can craft a malicious link that, when clicked and signed-in by a user, performs a client-side redirect and executes arbitrary JavaScript in the context of their browser. This could lead to session hijacking, credential theft, or unauthorized actions performed on behalf of the victim.
- File:
apps/nextjs-app/src/features/auth/pages/LoginPage.tsx - Specific Lines:
const redirect = decodeURIComponent((router.query.redirect as string) || '');
// [...]
const onSuccess = useCallback(() => {
if (redirect) {
router.push(redirect); // <-- here
} else {
router.push({
pathname: '/space',
query: router.query,
});
}
}, [redirect, router]);As shown, the query.redirect value is taken directly from the browser's URL. The subsequent router.push(redirect) assignment does not block the javascript: protocol, leading to the XSS. This is because router.push passes the URI parameter to window.location. (Note: the NextJS maintainers have decided this is a won't-fix, so the responsibility falls on library users. See this NextJS GitHub issue.)
An attacker can exploit this by tricking a user into clicking a specially crafted link to the Teable login page.
-
Attacker crafts a malicious URL:
http://test.local:3000/auth/login?redirect=javascript:alert(1) http://test.local:3000/auth/login?redirect=javascript:fetch(%27/api/auth/user/me%27).then(r%20=%3E%20r.text()).then(r%20=%3E%20alert(r))A sophisticated payload could hide the JavaScript by inserting extra query parameters or using URL encoding to obfuscate the attack, making the URL appear less suspicious to victims.
-
Victim Action: The victim clicks the link. After they enter their credentials and successfully log in or register, the
router.pushcall is triggered and the XSS payload is run.
Important
It should be noted that the XSS only works on a fresh login, with no prior session. If the victim opens the link with an existing session, the redirect fails as a malformed server-side redirect will occur (server returns 307 redirect with the javascript: URI). Browsers will treat this as a malformed HTTP request and protect the user. While this may appear to lower the severity of the issue, it is still possible to social engineer victims into opening the link and logging in from a private browsing session, leading to a successful attack.
Note
It should also be noted that while the publicly hosted teable app.teable.ai instance is protected by a Cloudflare WAF, it may still expose users to the risk of XSS due to potential WAF bypasses.
XSS executed upon signin:
Sample impact - calling authenticated APIs (payload: javascript:fetch('/api/auth/user/me').then(r => r.text()).then(r => alert(r))):
Note - "network error" when the link is opened by an already-authenticated user:
Base Score: 8.2 (High)
Vector: AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:L/A:N
- Attack Vector (AV): Network (N) – The vulnerability is exploitable remotely over the network via a crafted URL.
- Attack Complexity (AC): Low (L) – The attack does not require complex conditions; the vulnerable code path is easily reached. The attacker only needs to know the correct parameter name (
redirect). - Privileges Required (PR): None (N) – No authentication or privileges are required to trigger the vulnerability. The link can be sent to any user.
- User Interaction (UI): Required (R) – The victim must click on the attacker's malicious link and sign-in from a fresh session.
- Scope (S): Changed (C) – The vulnerable component is the client-side code, but the impact (executing arbitrary script) affects the user's browser session and the data accessible within the Teable application's security context.
- Confidentiality (C): High (H) – Successful exploitation could lead to complete loss of confidentiality. An attacker can call authenticated API endpoints, access sensitive data, and other information stored in the browser's context.
- Integrity (I): Low (L) – An attacker could potentially modify some data or perform actions on behalf of the user.
- Availability (A): None (N) – The attack does not directly impact the availability of the application or its data.
Successful exploitation of this vulnerability has a High impact:
- Credential Theft: A script could present a fake login prompt within the context of the legitimate site to capture the user's credentials.
- Arbitrary Actions: The script could use the victim's active session to make API requests, create, modify, or delete pipelines, or perform any action the victim is authorized to do.
- Internal Network Pivoting: If the Teable instance is within an internal network, the XSS could be used as a foothold to perform attacks against other internal systems from the victim's browser.
To fix this vulnerability, the application must validate and sanitize the redirect parameter before using it for redirection.
Validate the redirect path stays within the same origin and uses a safe scheme. Use the URL constructor to parse the path relative to the current origin and check both the origin and the protocol:
function isValidRedirectPath(path) {
try {
// Parse relative paths correctly by providing the current origin as the base
const url = new URL(path, window.location.origin);
// Ensure the origin matches AND the scheme is either http: or https:
return url.origin === window.location.origin &&
(url.protocol === 'http:' || url.protocol === 'https:');
} catch {
return false;
}
}This validation correctly handles:
- Relative paths like
/dashboard(resolves tohttps://example.com/dashboard) - Absolute paths within the same origin like
https://example.com/pipelines - Blocks dangerous schemes like
javascript:,data:,vbscript:, etc. - Blocks cross-origin redirects
Apply validation before any navigation. If redirect passes validation, it can be safely used; otherwise, fall back to a default safe path like /.
if (query.redirect && isValidRedirectPath(query.redirect)) {
redirectPath = query.redirect;
} else {
redirectPath = '/'; // Safe default
}Note
It is also recommended to review and patch other places where router.push are used with unsanitised user input.
- 2026-03-07: Vulnerability discovered and this report prepared.
- 2026-03-07: Report sent to Teable security contact / maintainers.
- [Pending]: Maintainer acknowledges receipt of the report.
- [Pending]: Maintainer discloses security advisory, e.g. by publishing via GitHub's security advisory program.
A 45-day disclosure deadline is set for April 21, 2026, in accordance with standard coordinated disclosure practice. Details will be published on that date unless a fix is released or the maintainer declines to address the issue before then.