Summary
NocoDB's redirect handling can allow a crafted ncRedirectUrl to bypass scheme validation when it contains an ASCII control character. If a user opens the crafted link, script may run in their browser and expose a session token stored in localStorage, potentially enabling account takeover.
Affected context
The issue is in PageLeavingWarning.vue, where the ncRedirectUrl value is checked and then used in an anchor destination or window.location. It becomes risky when an attacker can persuade a user to open a crafted link and control-character handling allows the redirect scheme check to be bypassed.
Exploit preconditions
- Attack surface: A link handled by NocoDB's redirect flow
- Required access: No authentication is required to craft or send the link
- Trigger point: A user opens the crafted link, causing the redirect value to be processed
- Why exploitation is possible: An ASCII control character in the URL scheme can evade validation, allowing an unsafe destination to reach a navigation sink
Why this happens
The application validates a redirect URL without adequately accounting for ASCII control characters and how they are interpreted during URL processing. This can let an attacker bypass the scheme check and supply a script-capable destination to an anchor or window.location. The issue maps to CWE-79: Improper Neutralization of Input During Web Page Generation, a cross-site scripting weakness.
Potential impact
- Script may execute in a user's browser in the context of NocoDB
- Session tokens stored in localStorage could be exposed
- An attacker could use a stolen token to access the victim's account
- Sensitive data or account actions could be affected
General mitigation guidance
Mitigation generally focuses on treating redirect values as untrusted and allowing only explicitly approved destinations.
Common defensive patterns include:
- Prefer relative paths or an allowlist of trusted URL schemes and destinations
- Normalize and reject control characters before validation or use
- Apply consistent validation at the point where a URL is rendered or used for navigation
- Avoid storing sensitive session credentials in browser-accessible storage where feasible
- Limit account and application privileges to reduce the impact of compromised sessions
How teams detect issues like this
- Use static analysis to identify user-controlled data flowing into anchor
hrefattributes or navigation APIs - Review URL validation for control-character handling, normalization, and scheme allowlisting
- Add tests and policy checks that reject unexpected schemes and malformed redirect values
- Monitor for suspicious redirect parameters and unexpected navigation destinations
- Automated security review tools may help identify unsafe input-to-navigation flows

