CVE-2024-45747: GeoServer FreeMarker Template Injection Vulnerability
Summary
CVE-2024-45747: GeoServer has a Server-Side Template Injection (SSTI) vulnerability in processing FreeMarker templates. Affects org.geoserver:gs-main versions < 2.27.0. Fixed in 2.27.0. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
GeoServer is an open-source server designed for sharing geospatial data. It allows users to publish and edit geospatial data and provides various services such as WMS (Web Map Service) and WFS (Web Feature Service). The software is widely used in the geospatial community for its flexibility and extensibility. However, it has been found to have a critical vulnerability related to the processing of FreeMarker templates, which could potentially allow unauthorized access to sensitive system functionalities.
Vulnerability Detail
A server-side template injection (SSTI) vulnerability exists in GeoServer that allows an authenticated administrator to upload FreeMarker templates containing malicious content. This vulnerability can lead to the execution of arbitrary OS commands and unauthorized reading from or writing to arbitrary files on the server. The issue arises from the org.geoserver.template.TemplateUtils.getSafeConfiguration() method, which attempts to restrict access to certain functionalities but can still be bypassed through specific method call sequences.
How To Fix
Minimum fixed version
2.27.0
This is the first release that contains the fix.
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, restrict access to the GeoServer instance to trusted administrators only and avoid uploading unverified FreeMarker templates until the patch can be applied.
Conclusion
The GeoServer FreeMarker Template Injection vulnerability (CVE-2024-45747) poses a significant risk to systems using affected versions. It is crucial to update to version 2.27.0 or later to mitigate this risk. Users should also consider using tools like Vulert to monitor for vulnerabilities in their applications.
See every vulnerability recorded for org.geoserver:gs-main →
FAQ
The CVSS score of this vulnerability is 7.2, indicating a high severity level.
Any GeoServer instance running versions prior to 2.27.0 is affected, particularly those allowing FreeMarker template uploads.
Exploitation of this vulnerability can lead to arbitrary code execution, unauthorized file access, and potential system compromise.
You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.
If an immediate update is not possible, ensure that access to the GeoServer is restricted to trusted users and monitor for any suspicious activity.
Related vulnerabilities
Recent vulnerabilities recorded for org.geoserver:gs-main.