/

CVE-2026-91157

Severity:

HIGH RISK

(7.5)

Broken Access Control (CWE-863) in Discourse Uploads

CVE-2026-91157

Deferred

Vulnerability type

Category:

Broken Access Control

CWE:

CWE-200, CWE-863

Impact:

Unauthorized Information Disclosure

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Discourse sites with secure uploads enabled could leave media and attachments publicly accessible after a category became restricted or its permissions changed during a bulk import. Anonymous users may have continued to retrieve these files through short upload URLs, including files associated with deleted topics.

Discourse sites with secure uploads enabled could leave media and attachments publicly accessible after a category became restricted or its permissions changed during a bulk import. Anonymous users may have continued to retrieve these files through short upload URLs, including files associated with deleted topics.

Affected context

The issue occurs in Discourse deployments using secure uploads when upload security metadata is not reconciled after category visibility or permission changes. Files uploaded while a category was public may retain a public accessibility flag, allowing access after the category becomes restricted or its associated topic is deleted.

The issue occurs in Discourse deployments using secure uploads when upload security metadata is not reconciled after category visibility or permission changes. Files uploaded while a category was public may retain a public accessibility flag, allowing access after the category becomes restricted or its associated topic is deleted.

Exploit preconditions

  • Attack surface: Publicly reachable Discourse upload URLs
  • Required access: Knowledge of, or access to, a short upload URL; authenticated access is not necessarily required
  • Trigger point: Retrieval of an upload whose category permissions changed after the file was created
  • Why exploitation is possible: Existing upload metadata can remain more permissive than the current category authorization state
  • Attack surface: Publicly reachable Discourse upload URLs
  • Required access: Knowledge of, or access to, a short upload URL; authenticated access is not necessarily required
  • Trigger point: Retrieval of an upload whose category permissions changed after the file was created
  • Why exploitation is possible: Existing upload metadata can remain more permissive than the current category authorization state

Why this happens

The underlying flaw is an authorization-state synchronization failure. When category visibility or permissions changed, Discourse did not consistently recalculate the access metadata associated with existing uploads, including uploads retained after topic deletion. This maps primarily to CWE-863: Incorrect Authorization, with CWE-200: Exposure of Sensitive Information describing the resulting disclosure when protected content remains publicly reachable.

The underlying flaw is an authorization-state synchronization failure. When category visibility or permissions changed, Discourse did not consistently recalculate the access metadata associated with existing uploads, including uploads retained after topic deletion. This maps primarily to CWE-863: Incorrect Authorization, with CWE-200: Exposure of Sensitive Information describing the resulting disclosure when protected content remains publicly reachable.

Potential impact

  • Anonymous users may access attachments or media intended for restricted categories
  • Sensitive files could be disclosed through previously issued short URLs
  • Deleted-topic uploads may remain reachable after their parent content is removed
  • Organizations could experience privacy violations, data exposure, or compliance impact
  • Anonymous users may access attachments or media intended for restricted categories
  • Sensitive files could be disclosed through previously issued short URLs
  • Deleted-topic uploads may remain reachable after their parent content is removed
  • Organizations could experience privacy violations, data exposure, or compliance impact

General mitigation guidance

Mitigation typically focuses on keeping object-level authorization synchronized with the current resource policy.

Common defensive patterns include:

  • Reconcile upload visibility whenever category permissions or topic ownership changes
  • Evaluate authorization at request time against current category and topic policy
  • Invalidate or rotate public upload URLs when content becomes restricted
  • Apply conservative, private-by-default access settings to newly created uploads
  • Treat bulk imports and permission migrations as security-sensitive operations
  • Use least-privilege service permissions and limit anonymous media access
  • Include deleted-content handling in upload retention and authorization workflows

Mitigation typically focuses on keeping object-level authorization synchronized with the current resource policy.

Common defensive patterns include:

  • Reconcile upload visibility whenever category permissions or topic ownership changes
  • Evaluate authorization at request time against current category and topic policy
  • Invalidate or rotate public upload URLs when content becomes restricted
  • Apply conservative, private-by-default access settings to newly created uploads
  • Treat bulk imports and permission migrations as security-sensitive operations
  • Use least-privilege service permissions and limit anonymous media access
  • Include deleted-content handling in upload retention and authorization workflows

How teams detect issues like this

Organizations can identify similar issues through:

  • Static analysis and code review checks for authorization decisions based only on stale upload metadata
  • Review of permission-change, bulk-import, deletion, and attachment-serving workflows
  • Tests that change category visibility after upload creation and verify access is reevaluated
  • Monitoring for anonymous requests to files associated with restricted or deleted content
  • Policy checks requiring object-level authorization before serving media
  • Automated security testing that compares current resource permissions with effective upload access

Organizations can identify similar issues through:

  • Static analysis and code review checks for authorization decisions based only on stale upload metadata
  • Review of permission-change, bulk-import, deletion, and attachment-serving workflows
  • Tests that change category visibility after upload creation and verify access is reevaluated
  • Monitoring for anonymous requests to files associated with restricted or deleted content
  • Policy checks requiring object-level authorization before serving media
  • Automated security testing that compares current resource permissions with effective upload access

Sources

SourceLink
github.comgithub.com/discourse/discourse/commit/16017732981fdb3ee65d7b3c69c573610bf02aab
github.comgithub.com/discourse/discourse/commit/83f5f9f1df7ddc79ec0950e1b2038ba659635708
github.comgithub.com/discourse/discourse/commit/98f1c021d0e956cded5239a5d8a6afe2b9e1b7e7
github.comgithub.com/discourse/discourse/commit/b2fb98394b2636b29e850f06b0029f8ca8b48458
github.comgithub.com/discourse/discourse/security/advisories/GHSA-298h-xgw6-4pv3

Frequently asked

questions

Yes. An attacker may access affected files remotely if they possess or discover a short upload URL that remains publicly valid.

Not necessarily. The key condition is that the upload retains public accessibility despite the category becoming restricted; anonymous retrieval may therefore be possible.

Reevaluate upload authorization against current category and topic permissions whenever a file is requested, and reconcile or invalidate existing public metadata after policy changes.

Use private-by-default uploads, test permission transitions and bulk imports, monitor anonymous media access, and ensure deletion and permission changes update all related authorization records.

Yes. An attacker may access affected files remotely if they possess or discover a short upload URL that remains publicly valid.

Not necessarily. The key condition is that the upload retains public accessibility despite the category becoming restricted; anonymous retrieval may therefore be possible.

Reevaluate upload authorization against current category and topic permissions whenever a file is requested, and reconcile or invalidate existing public metadata after policy changes.

Use private-by-default uploads, test permission transitions and bulk imports, monitor anonymous media access, and ensure deletion and permission changes update all related authorization records.

Find out what's already
exploitable in your codebase.