Summary
SillyTavern improperly trusts SSO-related HTTP headers (Remote-User and X-Authentik-Username) without confirming that they come from a trusted reverse proxy.
When SSO integration is enabled, any network client that can reach the SillyTavern service directly can forge these headers and log in as any user, including administrators, without knowing their password.
Affected context
This vulnerability affects SillyTavern deployments that:
- Enable SSO integration with Authelia (
sso.autheliaAuth: true) or Authentik (sso.authentikAuth: true) inconfig.yaml - Are reachable directly by clients (e.g., on a LAN, VPN, or exposed to the internet) without being strictly fronted by a trusted reverse proxy that strips/controls identity headers
- Rely on HTTP headers like
Remote-UserorX-Authentik-Usernamefor automatic login instead of an end-to-end validated authentication flow
In such configurations, SillyTavern treats the presence and value of these headers as authoritative proof of user identity, regardless of who sent them.
Exploit preconditions
- Attack surface: HTTP(S) interface of the SillyTavern server.
- Required access: Network-level ability to connect directly to the SillyTavern listening port (e.g., same host, local network, VPN, or exposed public endpoint).
- Configuration requirement:
sso.autheliaAuth: trueorsso.authentikAuth: truemust be enabled inconfig.yaml. - Trigger point: Sending a crafted HTTP request that includes either the
Remote-UserorX-Authentik-Usernameheader with an arbitrary username. - Why exploitation is possible: SillyTavern does not verify that these headers were injected by a trusted reverse proxy; it assumes any provided header is trustworthy and maps directly to an existing user, bypassing password checks and normal authentication controls.
Why this happens
The root cause is improper trust in externally supplied identity headers without enforcing a corresponding trust boundary or origin validation.
When SSO is enabled, SillyTavern treats Remote-User (Authelia) and X-Authentik-Username (Authentik) as authoritative identity assertions. However, it does not:
- Confirm that the request arrived through a specific trusted proxy or network path, or
- Strip or ignore these headers on direct client connections.
This creates an authentication bypass condition where any client can self-assert an identity by setting these headers, mapping to:
- CWE-290: Authentication Bypass by Spoofing – the application accepts spoofed authentication credentials (headers) as if they were genuine.
- CWE-306: Missing Authentication for Critical Function – privileged actions become effectively unauthenticated when an attacker chooses an admin username.
- CWE-346 / CWE-807: Origin and Trust Validation Issues – the system fails to validate that security-relevant information (SSO headers) originates from a trusted component.
Conceptually, the insecure pattern is: treating mutable client-controlled headers as a trustworthy identity mechanism without binding them to a protected channel or trusted component.
Potential impact
- Complete account takeover by logging in as any existing user.
- Administrator impersonation, enabling full control over SillyTavern configuration and data.
- Unauthorized access to conversations, prompts, and potentially sensitive content stored per user.
- Modification or deletion of other users' data, sessions, or settings.
- Use of another user's API keys or model configurations if those are managed through the UI.
- Lateral movement opportunities if SillyTavern ties into other systems or services using shared credentials.
General mitigation guidance
Effective mitigation focuses on enforcing a strict trust boundary around SSO headers and avoiding reliance on client-controlled identity claims:
- Tie SSO headers to a trusted proxy: Ensure that SSO-related headers (
Remote-User,X-Authentik-Username) are only accepted when requests are known to come from a specific reverse proxy (e.g., by checking source IPs,X-Forwarded-Forpatterns, or other deployment-level indicators). - Strip or ignore untrusted identity headers: At the application or proxy layer, remove any identity or SSO headers from requests that come directly from clients, and treat such requests as unauthenticated.
- Prefer robust authentication mechanisms: Where possible, use end-to-end authentication flows (e.g., OAuth/OpenID Connect tokens or session cookies) rather than raw identity headers that can be trivially spoofed.
- Enforce explicit configuration for SSO trust: Make SSO features opt-in and clearly document that they must be used only behind a controlled reverse proxy that owns the authentication process.
- Apply least privilege and separation of roles: Limit admin accounts, segregate instances (e.g., per environment or team), and reduce the impact of any single compromised account.
- Network hardening: Restrict SillyTavern's listening port to trusted networks, and avoid exposing it directly to the internet when header-based SSO is enabled.
How teams detect issues like this
Detection can combine code-centric and deployment-centric approaches:
- Static analysis and code review:
- Flag direct use of headers like
Remote-User,X-Authentik-Username, or similar identity claims without associated checks that confirm a trusted source. - Look for logic that maps header values directly to user sessions or roles without additional authentication or token validation.
- Identify conditional blocks tied to SSO settings that bypass password verification based solely on header presence.
- Configuration and deployment review:
- Audit
config.yamlfor SSO-related settings (sso.autheliaAuth,sso.authentikAuth) and confirm that instances with these options enabled are only reachable behind a vetted reverse proxy. - Review reverse proxy configurations to ensure they:
- Set identity headers exclusively after authenticating clients.
- Strip or overwrite these headers from incoming client requests.
- Runtime and log analysis:
- Monitor authentication logs for unexpected logins from unusual IP ranges or from non-SSO paths.
- Detect patterns where the same client rapidly logs in as multiple distinct usernames, which may indicate header spoofing.
- Policy enforcement and automated checks:
- Integrate security linters or automated review tools into CI pipelines to flag the use of raw identity headers as authentication sources without origin validation.
- Use infrastructure-as-code or configuration scanners to identify instances where SSO is enabled but network exposure does not match the intended trust model.

