Recently, a serious security vulnerability has been discovered in the popular community discussion platform –– Discourse. CVE-2022-39241 outlines the potential for a malicious admin to perform port enumeration on local and internal network hosts as well as hosts on the Internet. The latest stable, beta, and test-passed versions have been patched to address this issue, but users operating earlier versions should still pay heed to this concern.
Vulnerability Details
This security vulnerability could allow a malicious Discourse admin to exploit the platform's webhook callback feature by submitting a crafted webhook endpoint URL that initiates unwanted network scans in the form of port enumeration. By bypassing the standard IP blocking mechanism, the attacker could potentially access private IP addresses and resources, posing a significant risk for your community and network.
The code snippet below illustrates how a webhook URL could potentially be crafted to exploit this vulnerability (with /any_path and port_number being variables):
def malicious_url_generator(target_ip: str, any_path: str, port_number: int) -> str:
base_url = f"http://{target_ip}:{port_number}/{any_path}";
return base_url
Keep in mind: _Do not execute this snippet, nor attempt to use it for malicious purposes._
Available Patches
The Discourse development team has acknowledged this vulnerability and quickly released patches to mitigate the risks. Users operating the most recent stable, beta, and test-passed versions of Discourse should have their installations protected.
For the official announcement regarding this security fix, please check the Discourse blog here.
Workaround for Self-Hosters
In case you are running a self-hosted version of the Discourse platform, there is a temporary workaround that can help protect your installation from this vulnerability. You can utilize the DISCOURSE_BLOCKED_IP_BLOCKS environment variable (which takes precedence over the blocked_ip_blocks setting) to effectively stop webhooks from accessing private IPs. To implement this, follow the steps below:
1. Edit your app.yml file located in the /var/discourse/containers/ directory on your server.
Add a new line with the following content
env:
DISCOURSE_BLOCKED_IP_BLOCKS: '10.../8,172.16../12,192.168../16,127.../8'
Rebuild the Docker container by running the following command
./launcher rebuild app
This workaround will ensure that your Discourse installation is protected from unauthorized webhook access to private IPs until you can safely upgrade to the latest patched version.
Conclusion
The discovery of CVE-2022-39241 highlights the significance of keeping your software platforms up to date and closely monitoring any newly discovered vulnerabilities. Although the development team behind Discourse has moved quickly to address this issue, users should remain vigilant and ensure their systems are appropriately updated.
Remember to always practice safe online habits and be aware of the potential risks in the digital landscape. And, if you haven't already, update your Discourse installation to the latest version to ensure continued protection against this and other known vulnerabilities.
Timeline
Published on: 11/02/2022 17:15:00 UTC
Last modified on: 11/04/2022 15:37:00 UTC