CVE-2024-45747: Gs main GeoServer Has A Server-Side Template Vulnerability

HIGH
Advisory Identifier: GHSA-wf6j-gr27-g7ch
CVSS 7.2
CWE-749
Published
Advisory Summary

CVE-2024-45747 is a HIGH (CVSS 7.2) geoserver has a server-side template vulnerability (CWE-749: Exposed Dangerous Method or Function) affecting Gs main libraries in the Maven ecosystem. The issue involves geoserver has a server-side template injection (ssti) vulnerability in processing freemarker templates. Remediation is available by upgrading affected packages to version 2.27.0.

CVE-2024-45747 at a Glance

CVE Identifier CVE-2024-45747
GHSA Identifier GHSA-wf6j-gr27-g7ch
Severity HIGH
CVSS v3.1 Base Score 7.2
CWE Classification CWE-749: Exposed Dangerous Method or Function
Affected Product Gs main
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 7.2

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required High (PR:H)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2024-45747

To remediate this vulnerability, upgrade all affected Gs main dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

org.geoserver:gs-main fixed: 2.27.0
<dependency>
    <groupId>org.geoserver</groupId>
    <artifactId>gs-main</artifactId>
    <version>2.27.0</version>
</dependency>
org.geoserver:gs-wms fixed: 2.27.0
<dependency>
    <groupId>org.geoserver</groupId>
    <artifactId>gs-wms</artifactId>
    <version>2.27.0</version>
</dependency>
org.geoserver.web:gs-web-app fixed: 2.27.0
<dependency>
    <groupId>org.geoserver.web</groupId>
    <artifactId>gs-web-app</artifactId>
    <version>2.27.0</version>
</dependency>
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

mvn dependency:tree -Dincludes=org.geoserver

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2024-45747, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=org.geoserver

Analyze the terminal output to locate any version of Gs main in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.27.0), your application is affected.

Note: The mvn dependency:tree -Dincludes=org.geoserver command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-749: Exposed Dangerous Method or Function, where the product provides an applications programming interface (api) or similar interface for interaction with external actors, but the interface includes a dangerous method or function that is not properly restricted. In Gs main, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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_LIST`` * ``GEOSERVER_FREEMARKER_ALLOW_LIST`` * ``GEOSERVER_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.

CVE-2024-45747 Affected Gs main Versions

3 component(s)
Fixed Versions:
2.27.0
Product / Package Ecosystem Affected Versions Fixed Version
org.geoserver:gs-main
Maven
< 2.27.0
2.27.0
org.geoserver:gs-wms
Maven
< 2.27.0
2.27.0
org.geoserver.web:gs-web-app
Maven
< 2.27.0
2.27.0

References

Frequently Asked Questions

What is CVE-2024-45747?
CVE-2024-45747 is a security vulnerability in Gs main involving GeoServer has a Server-Side Template Injection (SSTI) vulnerability in processing FreeMarker templates under CWE-749: Exposed Dangerous Method or Function.
Which Gs main versions are affected?
Affected versions include releases prior to 2.27.0 across affected packages: org.geoserver:gs-main, org.geoserver:gs-wms, org.geoserver.web:gs-web-app.
What version fixes CVE-2024-45747?
Upgrading to 2.27.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is gs-main affected?
Yes, org.geoserver:gs-main is affected in releases prior to 2.27.0. Upgrade your dependency to 2.27.0 or later.
Is gs-wms affected?
Yes, org.geoserver:gs-wms is affected in releases prior to 2.27.0. Upgrade your dependency to 2.27.0 or later.
What is the CVSS score of CVE-2024-45747?
CVE-2024-45747 has a CVSS v3.1 base score of 7.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2024-45747?
CVE-2024-45747 is classified under CWE-749: Exposed Dangerous Method or Function (The product provides an Applications Programming Interface (API) or similar interface for interaction with external actors, but the interface includes a dangerous method or function that is not properly restricted.).
How can I check Maven dependencies for CVE-2024-45747?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.geoserver'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-wf6j-gr27-g7ch",
  "modified" : "2026-08-19T19:31:54Z",
  "published" : "2026-08-19T19:31:54Z",
  "aliases" : [ "CVE-2024-45747" ],
  "summary" : "GeoServer has a Server-Side Template Injection (SSTI) vulnerability in processing FreeMarker templates",
  "details" : "### Summary\nA 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.\n\n### Details\nThe 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.\n\n### Impact\nThis vulnerability can lead to executing arbitrary code and reading and writing arbitrary files.\n\n### Resolution\nGeoServer 2.27.0 addresses this vulnerability with several new application properties:\n\n* ``GEOSERVER_FREEMARKER_BLOCK_LIST``\n* ``GEOSERVER_FREEMARKER_ALLOW_LIST``\n* ``GEOSERVER_FREEMARKER_API_EXPOSED``\n\nThese application properties default to restricting the objects template authors can access, and limit access to \"getter\" methods used to access object properties.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.geoserver:gs-main"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.27.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.geoserver:gs-wms"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.27.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.geoserver.web:gs-web-app"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.27.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/geoserver/geoserver/security/advisories/GHSA-wf6j-gr27-g7ch"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/geoserver/geoserver/pull/8164"
  }, {
    "type" : "WEB",
    "url" : "https://docs.geoserver.org/latest/en/user/tutorials/GetFeatureInfo/html/#accessing-instance-methods"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/geoserver/geoserver"
  }, {
    "type" : "WEB",
    "url" : "https://osgeo-org.atlassian.net/browse/GEOS-11645"
  }, {
    "type" : "WEB",
    "url" : "https://osgeo-org.atlassian.net/browse/GEOS-11777"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-749" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-08-19T19:31:54Z",
    "nvd_published_at" : null
  }
}