CVE-2024-45747 is a high-severity (CVSS 7.2) remote code execution vulnerability in org.geoserver:gs-main. A fix is available for org.geoserver:gs-main — see the affected versions and patch details below.
GeoServer has a Server-Side Template Injection (SSTI) vulnerability in processing FreeMarker templates
Real-World Exposure
org.geoserver:gs-main☕org.geoserver:gs-wms☕org.geoserver.web:gs-web-appReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects Maven packages — download data is not available via public APIs for these ecosystems.
Description
Summary
A server-side template injection (SSTI) vulnerability exist that allows an authenticated administrator to upload FreeMarker templates containing malicious content that can execute OS commands and read from or write to arbitrary files on the server. These FreeMarker templates are used in a plain GeoServer instance (no extension or community modules) for WMS GetFeatureInfo HTML and JSON and WMS GetMap KML and GeoRSS output formats.
Details
The org.geoserver.template.TemplateUtils.getSafeConfiguration() method attempts to block access to the class freemarker.template.utility.Execute but it is still possible to gain access to it and other sensitive functionality by chaining a specific sequence of method calls.
Impact
This vulnerability can lead to executing arbitrary code and reading and writing arbitrary files.
Resolution
GeoServer 2.27.0 addresses this vulnerability with several new application properties:
GEOSERVER_FREEMARKER_BLOCK_LISTGEOSERVER_FREEMARKER_ALLOW_LISTGEOSERVER_FREEMARKER_API_EXPOSED
These application properties default to restricting the objects template authors can access, and limit access to "getter" methods used to access object properties.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| ☕Maven | org.geoserver:gs-main | all versions | 2.27.0org.geoserver:gs-main:2.27.0 |
| ☕Maven | org.geoserver:gs-wms | all versions | 2.27.0org.geoserver:gs-wms:2.27.0 |
| ☕Maven | org.geoserver.web:gs-web-app | all versions | 2.27.0org.geoserver.web:gs-web-app:2.27.0 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for org.geoserver:gs-main, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update org.geoserver:gs-main to 2.27.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2024-45747 is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
Frequently Asked Questions
Is CVE-2024-45747 in your dependencies?
Find it across Maven, including transitive dependencies.