Summary
A stored cross-site scripting (XSS) flaw in the Anchorr web dashboard's User Mapping dropdown lets any unprivileged Discord guild member inject JavaScript that runs in the Anchorr admin's browser.
When combined with the unauthenticated /api/config endpoint that exposes configuration secrets, an attacker can use this XSS to steal all tokens and API keys stored in Anchorr without logging into the dashboard.
Affected context
This vulnerability appears in Anchorr deployments that:
- Expose the web dashboard to at least one administrative user with a browser session
- Are connected to a Discord guild where unprivileged members can interact with Anchorr
- Render Discord-controlled data in the User Mapping dropdown without proper output encoding or sanitization
The risk materializes when an Anchorr admin opens the dashboard page containing the malicious User Mapping entry, causing the attacker's JavaScript to execute in the admin's browser context.
Exploit preconditions
- Attack surface: Anchorr web dashboard and Discord integration within the configured guild.
- Required access: Any unprivileged Discord user account in the guild linked to the Anchorr instance; no direct Anchorr authentication required.
- Trigger point: The Anchorr admin (or another privileged dashboard user) views the User Mapping dropdown in the web interface where the attacker-controlled value is rendered.
- Why exploitation is possible: User-supplied Discord data is stored and later rendered into the dashboard's HTML without context-appropriate output encoding, sanitization, or CSP controls, allowing persistent JavaScript injection that runs with the admin's browser privileges. The browser can then call the unprotected
/api/configendpoint and read sensitive configuration values returned in plaintext.
Why this happens
The core issue is a classic stored XSS pattern: untrusted, attacker-controlled content originating from Discord is persisted and later injected into an HTML context in the Anchorr dashboard without proper escaping or sanitization.
From a bug-class perspective (CWE-79), the application treats data that should be handled as plain text as if it were safe HTML/JavaScript. When the admin's browser renders the User Mapping dropdown, the injected script runs with full access to the dashboard's DOM, cookies (if accessible), and same-origin APIs. This is compounded by an information exposure condition (CWE-200) in which the /api/config endpoint returns all secrets in cleartext to any caller that can reach it. Together, these behaviors form a powerful XSS + secret-disclosure chain.
Potential impact
- Theft of all secrets stored in Anchorr (e.g., DISCORD_TOKEN, JELLYFIN_API_KEY, JELLYSEERR_API_KEY, JWT_SECRET, WEBHOOK_SECRET, bcrypt password hashes).
- Hijacking of Anchorr's Discord bot via stolen DISCORD_TOKEN, enabling impersonation and further abuse in the guild.
- Unauthorized access to associated services (e.g., Jellyfin/Jellyseerr) using exfiltrated API keys.
- Creation of persistent backdoors, rogue webhooks, or malicious automations using stolen secrets.
- Impersonation of Anchorr admins or users where JWTs or derived credentials are used for authentication.
- Lateral movement into broader infrastructure that trusts the compromised secrets (e.g., CI/CD, notification channels).
General mitigation guidance
Effective mitigation focuses on both eliminating the XSS sink and constraining access to sensitive configuration data.
For the stored XSS vector:
- Apply strict, context-aware output encoding whenever rendering user- or Discord-supplied values into HTML, attributes, JavaScript, or URLs.
- Centralize templating and avoid mixing raw string concatenation with HTML generation; prefer templating engines that auto-escape by default.
- Validate and sanitize fields that should never contain markup or script-like content, rejecting or normalizing unexpected characters or tags.
- Consider enabling a restrictive Content Security Policy (CSP) that disallows inline scripts and limits script sources to trusted origins, reducing the impact of successful injections.
For the secret disclosure aspect:
- Treat configuration and secrets endpoints as highly sensitive; require robust authentication and authorization before returning any configuration data.
- Minimize the breadth of data returned by configuration APIs (principle of least exposure), redacting or omitting secrets where possible.
- Segment responsibilities so that the web dashboard does not need direct access to all plaintext secrets; use scoped tokens or proxy services where appropriate.
General hardening:
- Reduce reliance on long-lived, high-privilege tokens by adopting rotation, scoping, and compartmentalization strategies.
- Run the dashboard with least privileges, and design so that a compromised UI session cannot trivially access full-backend secrets.
How teams detect issues like this
Detection is most effective when combining static analysis, code review discipline, and runtime monitoring:
- Static analysis & linters:
- Enable rules that flag unencoded insertion of user-controlled variables into HTML, attributes, inline JavaScript, or DOM APIs (e.g., innerHTML, dangerouslySetInnerHTML).
- Create custom checks to highlight paths where Discord or external data flows into view templates without passing through encoding/sanitization utilities.
- Scan for APIs that return sensitive configuration values and enforce that they are guarded by authentication and authorization checks.
- Code review practices:
- Require reviewers to trace the origin of any data rendered into templates or UI elements, verifying that it is either trusted or properly encoded.
- Maintain a checklist for UI-related changes that explicitly calls out XSS risk areas (dropdowns, search results, user names, messages, logs).
- Review configuration or admin endpoints to ensure secrets are never returned in plaintext unless absolutely necessary and always behind access control.
- Runtime and operational monitoring:
- Deploy web application firewalls (WAFs) or reverse proxies with rules that detect common XSS payload patterns, understanding they are a backstop, not a primary defense.
- Log and audit access to configuration or secrets endpoints; investigate unusual access patterns, especially those coming from browser contexts.
- Leverage security testing tools (DAST/IAST) in CI/CD to exercise dashboard views and attempt XSS and sensitive data exposure scenarios automatically.

