VYPR
High severityNVD Advisory· Published Jul 1, 2024· Updated Nov 4, 2025

Classpath resource disclosure in GWC Web Resource API on Windows / Tomcat

CVE-2024-24749

Description

GeoServer is an open source server that allows users to share and edit geospatial data. Prior to versions 2.23.5 and 2.24.3, if GeoServer is deployed in the Windows operating system using an Apache Tomcat web application server, it is possible to bypass existing input validation in the GeoWebCache ByteStreamController class and read arbitrary classpath resources with specific file name extensions. If GeoServer is also deployed as a web archive using the data directory embedded in the geoserver.war file (rather than an external data directory), it will likely be possible to read specific resources to gain administrator privileges. However, it is very unlikely that production environments will be using the embedded data directory since, depending on how GeoServer is deployed, it will be erased and re-installed (which would also reset to the default password) either every time the server restarts or every time a new GeoServer WAR is installed and is therefore difficult to maintain. An external data directory will always be used if GeoServer is running in standalone mode (via an installer or a binary). Versions 2.23.5 and 2.24.3 contain a patch for the issue. Some workarounds are available. One may change from a Windows environment to a Linux environment; or change from Apache Tomcat to Jetty application server. One may also disable anonymous access to the embeded GeoWebCache administration and status pages.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
org.geoserver.web:gs-web-appMaven
< 2.23.52.23.5
org.geoserver.web:gs-web-appMaven
>= 2.24.0, < 2.24.32.24.3
org.geoserver:gs-gwcMaven
< 2.23.52.23.5
org.geoserver:gs-gwcMaven
>= 2.24.0, < 2.24.32.24.3

Affected products

1

Patches

1
c7f76bd8a1d6

[GWC-1210] Improve input validation in ByteStreamController (#1211)

https://github.com/GeoWebCache/geowebcacheSteve IkeokaFeb 2, 2024via ghsa
2 files changed · +29 14
  • geowebcache/rest/src/main/java/org/geowebcache/rest/controller/ByteStreamController.java+13 14 modified
    @@ -15,9 +15,9 @@
      */
     package org.geowebcache.rest.controller;
     
    +import java.io.File;
     import java.io.IOException;
     import java.io.InputStream;
    -import java.io.UnsupportedEncodingException;
     import java.net.URL;
     import java.net.URLDecoder;
     import java.util.List;
    @@ -79,22 +79,21 @@ protected URL getResource(String path) {
     
         // "gwc/rest/web/openlayers3/ol.js" -> openlayers3/ol.js
         // "/rest/web/openlayers3/ol.js" -> openlayers3/ol.js
    -    String getFileName(HttpServletRequest request) {
    -        String path = request.getPathInfo();
    -        if (path.indexOf("/rest/web") != 0) {
    -            path = path.substring(path.indexOf("/rest/web"));
    -        }
    -        return path.substring("/rest/web/".length());
    +    String getFileName(HttpServletRequest request) throws IOException {
    +        String path =
    +                URLDecoder.decode(request.getRequestURI(), "UTF-8")
    +                        .substring(request.getContextPath().length())
    +                        .replace(File.separatorChar, '/');
    +        int index = path.indexOf("/rest/web/");
    +        return index < 0 ? null : path.substring(index + "/rest/web/".length());
         }
     
         @RequestMapping(value = "/web/**", method = RequestMethod.GET)
    -    ResponseEntity<?> doGet(HttpServletRequest request, HttpServletResponse response) {
    -        final String filename;
    -        try {
    -            filename = URLDecoder.decode(getFileName(request), "UTF-8");
    -        } catch (UnsupportedEncodingException e1) {
    -            throw new IllegalStateException(
    -                    "Could not decode encoding UTF-8", e1); // Should never happen
    +    ResponseEntity<?> doGet(HttpServletRequest request, HttpServletResponse response)
    +            throws IOException {
    +        final String filename = getFileName(request);
    +        if (filename == null || filename.isEmpty()) {
    +            return new ResponseEntity<>(HttpStatus.NOT_FOUND);
             }
     
             // Just to make sure we don't allow access to arbitrary resources
    
  • geowebcache/rest/src/test/java/org/geowebcache/rest/controller/ByteStreamControllerTest.java+16 0 modified
    @@ -15,10 +15,12 @@
     package org.geowebcache.rest.controller;
     
     import static org.hamcrest.Matchers.startsWith;
    +import static org.junit.Assume.assumeTrue;
     import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
     import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header;
     import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
     
    +import org.apache.commons.lang3.SystemUtils;
     import org.junit.Before;
     import org.junit.Rule;
     import org.junit.Test;
    @@ -100,4 +102,18 @@ public void testBackreference2() throws Exception {
             mockMvc.perform(get("/rest/web/foo/../../../shouldnt/access/test.png"))
                     .andExpect(status().is4xxClientError());
         }
    +
    +    @Test
    +    public void testBackreferenceWindows() throws Exception {
    +        assumeTrue(SystemUtils.IS_OS_WINDOWS);
    +        mockMvc.perform(get("/rest/web/..\\..\\shouldnt/access/test.png"))
    +                .andExpect(status().is4xxClientError());
    +    }
    +
    +    @Test
    +    public void testBackreferenceWindows2() throws Exception {
    +        assumeTrue(SystemUtils.IS_OS_WINDOWS);
    +        mockMvc.perform(get("/rest/web/foo\\..\\..\\..\\shouldnt/access/test.png"))
    +                .andExpect(status().is4xxClientError());
    +    }
     }
    

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

6

News mentions

0

No linked articles in our index yet.