Summary
Discourse incorrectly exposed information about private topics, categories, posts, and hidden tags by redirecting permalinks to URLs containing sensitive slugs, even when the requesting user lacked access.
This behavior could leak private topic titles or other sensitive identifiers through redirect Location headers and 404 page search boxes whenever permalinks to restricted resources were requested.
Affected context
The issue appears in Discourse deployments where permalinks are configured to point at resources that may be access-restricted, such as private topics, restricted categories, individual posts, or hidden tags.
When a user without sufficient permissions followed such a permalink, the application still generated a redirect URL incorporating the underlying resource slug, and the resulting 404 page surfaced that slug through its search box.
This affects environments where slug values encode meaningful, potentially sensitive information like topic titles, internal project names, or other confidential descriptors.
Exploit preconditions
- Attack surface: HTTP(S) interface for Discourse permalinks and redirected endpoints.
- Required access: Ability to issue requests to the Discourse instance (e.g., as an unauthenticated or low-privileged user); no special privileges are required beyond network access.
- Trigger point: Requesting a permalink that points to a private topic, restricted category, specific post, or hidden tag.
- Why exploitation is possible: The redirect logic and 404 handling construct and expose slugs derived from restricted resources before fully enforcing authorization and before redacting sensitive components from the generated URL and UI.
Why this happens
This vulnerability stems from authorization-aware resources leaking metadata through surrounding control flows, rather than the main content payload.
The permalink handler and error-page rendering logic used underlying resource identifiers (slugs) to build redirect URLs and page content without first ensuring that the requester is permitted to know those identifiers.
This pattern maps to CWE-200: Exposure of Sensitive Information to an Unauthorized Actor, where access control is applied to primary content but not consistently applied to derived metadata such as slugs, titles, or search hints.
Potential impact
- Unauthorized disclosure of private topic titles or partial titles embedded in slugs.
- Exposure of internal project names, client names, or other sensitive descriptors encoded in topic/category/tag slugs.
- Leakage of the existence and naming of hidden tags or restricted categories, aiding reconnaissance by attackers.
- Potential correlation of users or teams with specific sensitive topics inferred from slug naming conventions.
General mitigation guidance
Effective mitigation centers on ensuring that authorization checks cover all resource-derived metadata, not just the main content body:
- Perform permission checks before constructing redirect targets that reference restricted resources, and avoid including sensitive slugs in URLs or headers when access is denied.
- Design slug-generation schemes so they do not encode sensitive information directly (e.g., use opaque identifiers or neutral naming where confidentiality matters).
- For 404 and search-related pages, ensure that any pre-filled queries or suggestions do not include information based on resources the user is not authorized to view.
- Apply a "fail closed" approach in routing and permalink resolution, returning generic error responses when permission checks are inconclusive or fail.
- Regularly review URL, header, and UI metadata for inadvertent leaks of titles, identifiers, or classification details about protected resources.
How teams detect issues like this
Organizations can identify similar information exposure issues using a combination of testing and code-level review:
- Static analysis and code review:
- Look for routing, permalink, and redirect handlers that access resource titles or slugs before running authorization checks.
- Flag code paths that build user-visible URLs, Location headers, or search defaults from resources without guarding them with permission checks.
- Review error handlers (404, 403, generic errors) for inclusion of resource-derived metadata.
- Dynamic testing and QA:
- Create test users with varying permission levels and attempt to access permalinks for private or restricted resources, observing redirect URLs, headers, and error pages.
- Add automated tests that validate that slugs or titles for private resources never appear in responses, logs, or client-side scripts for unauthorized users.
- Policy and tooling:
- Introduce secure coding guidelines for URL and slug handling around access-controlled resources.
- Optionally employ automated review tools or custom linting rules that highlight uses of title/slug fields in routing code without adjacent authorization checks.

