Summary
Nhost's auth service OAuth callback flow previously embedded refresh tokens directly in the redirect URL as query parameters.
This design can expose tokens through browser history, server and proxy logs, and HTTP Referer headers, allowing an attacker with access to those logs to potentially hijack user sessions.
Affected context
This vulnerability affects applications using Nhost's auth service OAuth provider callback flow in versions prior to 0.48.0.
The issue arises when refresh tokens are delivered to the client as URL query parameters on redirect after OAuth login.
Any environment where URLs are recorded or propagated—such as browser history, reverse proxies, CDNs, analytics systems, or application logs—can persist these tokens beyond their intended use.
While the refresh tokens are one-time use and leaks are limited to infrastructure under the application developer's control or integrated services, those systems often grant broad access to operations or third-party staff.
Exploit preconditions
- Attack surface: Logs, monitoring systems, analytics tools, browser history, and any infrastructure that records full request URLs or Referer headers.
- Required access: Ability to read URLs or logs from:
- End-user browsers (e.g., local or shared machines, malware, or shoulder surfing)
- Web server access logs, proxy/CDN logs, APM/monitoring tools, or analytics platforms
- Third-party services where full URLs or Referer headers are stored
- Trigger point: Completion of the OAuth provider callback flow where the user is redirected with a refresh token included in the URL query string.
- Why exploitation is possible: Refresh tokens, which should remain confidential and never appear in URLs, are treated as normal query parameters, making them automatically recorded and propagated across infrastructure, violating secure token handling practices.
Why this happens
The underlying bug is an insecure design in how sensitive tokens are transported from the auth service to the client during OAuth callbacks.
Instead of using secure channels like HTTP-only cookies, POST bodies, or dedicated token endpoints, the implementation injects the refresh token into the redirect URL as a query parameter.
This maps to:
- CWE-598: Information Exposure Through Query Strings in GET Request, because secret-bearing tokens are placed in URL query strings that infrastructure routinely logs and forwards.
- CWE-200: Exposure of Sensitive Information to an Unauthorized Actor, because entities with access to logs or browser history may obtain tokens they were not intended to see.
Abstractly, the insecure pattern is "treating URLs as private channels and placing high-value credentials in them," ignoring the fact that URLs are widely replicated and observable across the request lifecycle.
Potential impact
- Attackers with access to application, proxy, CDN, or analytics logs may obtain refresh tokens and can attempt to exchange them for new access tokens.
- Compromise of individual user sessions through token replay or unauthorized token exchange.
- Escalation from operational access (e.g., log or monitoring access) to effective application-level access on behalf of users.
- Increased blast radius if logs are aggregated or shared with third parties (e.g., observability providers, consultants).
- Potential regulatory and privacy implications if logs containing tokens are retained or transferred improperly.
General mitigation guidance
Effective mitigation focuses on eliminating tokens from URLs and treating tokens as high-sensitivity secrets throughout the auth flow.
Recommended design patterns include:
- Using HTTP-only, secure cookies to deliver and store refresh tokens instead of embedding them in URLs or client-side storage.
- Returning tokens via POST responses, token endpoints, or backchannel communication rather than as query parameters or fragments.
- Implementing token binding and strict scoping, ensuring refresh tokens are short-lived, one-time use, and limited in scope.
- Applying log hygiene across services: avoid logging full URLs when they may contain sensitive values, or systematically redact query parameters that could hold secrets.
- Restricting infrastructure and third-party services from accessing raw tokens wherever possible, and limiting operational personnel access to logs containing sensitive data.
- Designing the OAuth redirect flow so that the client receives only opaque, low-sensitivity identifiers, with actual token handling performed server-side.
How teams detect issues like this
Organizations can detect and monitor for similar vulnerabilities using a combination of code and configuration review, plus runtime analysis:
- Static analysis and code review:
- Search for auth or token-related code that constructs URLs with
refresh_token,access_token, or similar parameters in the query string. - Flag patterns where secret values are concatenated into redirect URLs or passed to
Locationheaders. - Review OAuth callback handlers for any use of GET parameters to deliver secrets to clients.
- Configuration and policy enforcement:
- Implement secure coding guidelines that forbid secrets in URLs, enforced via linting rules or pre-commit hooks.
- Define logging policies that redact or avoid logging full query strings for security-sensitive endpoints.
- Runtime and log analysis:
- Scan web server, proxy, and CDN logs for query parameters such as
token,refresh_token,auth, orsessionto identify inadvertent leaks. - Use DLP (Data Loss Prevention) or custom scripts to detect token-like patterns in log streams and observability data.
- Automated tooling:
- Integrate SAST/DAST tools that can flag sensitive data in URLs or respond headers, and incorporate them into CI/CD pipelines.

