Skip to content

GeoServer Pre-Authentication RCE via WFS and HSQLDB

TL;DR

  • I found unauthenticated remote command execution in GeoServer that works on a default installation.
  • Prefixing the Web Feature Service (WFS) name, as in x/WFS, slips past the admin-only rule for stored queries. GeoServer turns escaped text in a saved query into live xi:include elements, which leaks the files holding the remember-me key and the admin password digest.
  • Those two values forge an administrator cookie without cracking the password. As admin, the attacker points a JDBC user service at an uploaded HSQLDB database, and the bundled driver deserialises a stored value that runs commands.
  • GeoServer 2.27.6 and earlier, 2.28.0 to 2.28.5, and 3.0.0 to 3.0.1 are affected. The fixes are in 2.27.7, 2.28.6 and 3.0.2, and GeoServer lists all five CVEs in the remember-me key advisory.

GeoServer chain from unauthenticated WFS access to command execution, with GeoServer 3.0.2 fixes alongside each stage

Summary

  • Product: GeoServer
  • Vulnerability: Pre-Authentication Remote Command Execution via WFS and HSQLDB
  • Affected Versions: >= 3.0.0, <= 3.0.1, >= 2.28.0, <= 2.28.5, <= 2.27.6
  • Fixed In: 3.0.2, 2.28.6 and 2.27.7
  • CVSS Severity: 9.8 (critical, reporter-assessed)
  • CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
  • Required Privilege: None
  • Reported: August 2, 2026

GeoServer published the chain as five advisories, one per independently fixable step, each scored with GeoServer's own CVSS 4.0 rating unless noted:

IssueRoot causeCVSSAdvisoryCVE
Data-directory path in WFS exceptionAn overlong stored-query ID fails in the filesystem, and the WFS exception returns the full path6.9 (medium)GHSA-4v26-c537-jvxcCVE-2026-129244
service=x/WFS operation-security bypassThe dispatcher strips x/, but service security still matches the rules against x/WFS8.8 (high)GHSA-rv5g-g2r9-58rjCVE-2026-129243
Stored-query XInclude local file readSaved query text is reparsed into XML, then reloaded with XInclude on and a resolver that allows file:8.6 (high, CVSS 3.1)GHSA-39mw-5chv-jh47CVE-2026-120705
Predictable remember-me keyThe cookie signing key is read from the data directory and ships as geoserver9.2 (critical)GHSA-hgm3-wq4h-8vvqCVE-2026-129245
JDBC user-service deserialisationUser and role properties are read with getObject(), so HSQLDB deserialises OTHER values8.6 (high)GHSA-9wf2-fcgq-vxhqCVE-2026-129242

Introduction

[A]I went through the stock GeoServer 3.0.0 distribution, looking for an anonymous request that could read its data directory. GeoServer signs remember-me cookies with the stored password digest from users.xml and a key that ships as geoserver, so reading users.xml would be enough to become an administrator on any install that kept that key.

Stored-query names are cleaned into filenames, and the shipped service rules only let administrators create or delete stored queries. One spelling of the service name could get past those rules.

Root Cause Analysis

A Filename Error Reveals the Data Directory (CVE-2026-129244)

A stored query is a named WFS query saved by GeoServer. GeoServer maps its name to a resource in StoredQueryProvider.java, while toFilename() builds its filename.

public StoredQuery getStoredQuery(String name) {
    // ... default-query handling omitted.

    try {
        Resource res = getResourceByContext(toFilename(name)); // [1] Data-directory lookup.
        // ... ordinary missing-query and parsing logic omitted.
    } catch (Exception e) {
        throw new RuntimeException("Error accessing stored query: " + name, e);
    }
}

private Resource getResourceByContext(String filename) {
    Resource res = storedQueryDirByContext().get(filename);
    if (res.getType() == Type.RESOURCE) { // [2] Filesystem lookup.
        return res;
    }
    // ... workspace fallback omitted.
    return null;
}

// ... stored-query persistence omitted.

String toFilename(String name) {
    // remove any special characters... like ':'
    return name.replaceAll("\\W", "") + ".xml"; // [3] Adds .xml.
}

The storedQuery_id from an anonymous GetFeature request becomes a data-directory lookup at [1], which reaches the filesystem at [2]. The only change made to it is at [3], which strips non-word characters and adds .xml, so nothing limits its length. On a stock data directory, a 4,092-character identifier makes the path longer than Linux allows.

The filesystem resource wrapper catches the resulting I/O error in FileSystemResourceStore.java.

@Override
public Type getType() {
    try {
        BasicFileAttributes attributes =
                java.nio.file.Files.readAttributes(file.toPath(), BasicFileAttributes.class); // [4] Fails on an overlong path.
        // ... normal resource-type handling omitted.
    } catch (NoSuchFileException e) {
        return Type.UNDEFINED;
    } catch (IOException e) {
        throw new IllegalStateException(e); // [5] Preserves the cause.
    }
}

The overlong path makes readAttributes() fail with File name too long at [4], and [5] rethrows that error as the cause of an IllegalStateException. GeoServer's OWS exception builder then turns the whole exception chain into the public response in Ows11Util.java.

StringBuffer sb = new StringBuffer();
OwsUtils.dumpExceptionMessages(exception, sb, true); // [6] Collects nested messages.
e.getExceptionText().add(sb.toString()); // [7] Returns them publicly.

dumpExceptionMessages() at [6] walks every nested cause, so the filesystem message, path included, ends up in the exception text returned at [7]. Cutting the known /wfs/query/<identifier>.xml suffix off that path leaves the data directory.

Anonymous WFS GetFeature request with a 4,092-character storedQuery_id returning a FileSystemException that names /opt/geoserver_data/wfs/query

Two Names for the Same WFS Service (CVE-2026-129243)

The release services.properties protects stored-query creation and deletion.

# services.properties
# If not specified in this file, a service or method will be considered unsecured
# ... unrelated examples omitted.
wfs.DropStoredQuery=ADMIN,GROUP_ADMIN
wfs.CreateStoredQuery=ADMIN,GROUP_ADMIN

Both rules only match a service named wfs.

GeoServer's dispatcher also accepts service identifiers containing a slash. Dispatcher.findService() treats the prefix as path or workspace context.

Service findService(String id, String ver, String namespace) throws ServiceException {
    // ... version and service loading omitted.
    if (id.contains("/")) {
        id = id.substring(id.indexOf("/") + 1); // [8] x/WFS becomes WFS.
    }

    // ... matching setup omitted.
    for (Service sBean : services) {
        if (sBean.getId().equalsIgnoreCase(id)) {
            matches.add(sBean);
        }
    }

For service="x/WFS", the dispatcher strips x/ at [8] and finds the real WFS service. The surrounding service() method attaches that WFS service to the request, but leaves the request's service name as x/WFS.

The security callback in OperationSecurityCallback.java reads that name.

public Operation operationDispatched(Request request, Operation operation) {
    String service = request.getService(); // [9] Still x/WFS.
    String method = request.getRequest();

    List<ServiceAccessRule> rules = dao.getRules();
    ServiceAccessRule bestMatch = null;
    for (ServiceAccessRule rule : rules) {
        if (rule.getService().equals(ServiceAccessRule.ANY)
                || rule.getService().equalsIgnoreCase(service)) { // [10] No wfs match.
            if (rule.getMethod().equals(ServiceAccessRule.ANY)
                    || rule.getMethod().equalsIgnoreCase(method)) {
                bestMatch = rule;
            }
        }
    }

    // if there is a matching rule apply it
    if (bestMatch != null) { // [11] No match, no role check.

The callback still has x/WFS at [9], which never equals wfs at [10]. With no matching rule, [11] skips the role check, so an anonymous user can create and delete stored queries.

XML Text Becomes XML Again (CVE-2026-120705)

XInclude lets an XML document include another resource. The stored-query request carries escaped XInclude elements inside the WFS query text.

<wfs:Query typeNames="">
  &lt;xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
    xmlns="" href="file:///absolute/data/security/config.xml" parse="text"/&gt;
  &lt;xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
    xmlns="" href="file:///absolute/data/security/usergroup/default/users.xml" parse="xml"/&gt;
</wfs:Query>

The request parser decodes &lt; into a literal < character. GeoTools' CopyingHandler.characters() appends that character data directly.

@Override
public void characters(char[] ch, int start, int length) throws SAXException {
    // ... buffer initialisation omitted.
    buffer.append(ch, start, length); // [12] Appends decoded text unescaped.
}

[12] copies the decoded text into the query unescaped, so the stored query text now holds a literal <xi:include .../> string. When GeoServer persists the accepted query, QueryExpressionTextTypeBinding.encode() parses that string again.

QueryExpressionTextType qe = (QueryExpressionTextType) object;
if (!qe.isIsPrivate()) {
    // ... DOM and namespace setup omitted.
    SAXParser saxp = XMLUtils.newSAXParserFactory(null).newSAXParser();
    saxp.parse(new InputSource(new StringReader(qe.getValue())), h); // [13] Reparses text as markup.

    Document d = h.getDocument();
    e.appendChild(document.importNode(d.getDocumentElement(), true));
}

At [13] the literal < becomes markup, so the saved file contains live xi:include elements.

The public DescribeStoredQueries operation loads that file through a fresh parser in StoredQueryProvider.java.

StoredQuery parseStoredQuery(Resource file) throws Exception {
    return parseStoredQuery(file, new Parser(new WFSConfiguration())); // [14] Fresh WFS parser.
}

StoredQuery parseStoredQuery(Resource file, Parser p) throws Exception {
    p.setRootElementType(WFS.StoredQueryDescriptionType);
    try (InputStream fin = file.in()) {
        StoredQueryDescriptionType q = (StoredQueryDescriptionType) p.parse(new BufferedInputStream(fin));
        return createStoredQuery(q, false);
    }
}

[14] creates a new WFS parser for each reload. GeoTools builds its SAX factory in XMLUtils.java with DTD support disabled, and supportDTD() ties XInclude to that flag.

factory.setXIncludeAware(!supportDTD); // [15] XInclude on when DTDs off.

That turns XInclude on at [15], so the reload parser processes the xi:include elements.

During startup, the release web.xml runs GeoserverInitStartupListener before the Spring context loader. The resolver-provider bean doesn't exist yet, so the listener installs NullEntityResolver.INSTANCE in GeoTools' process-wide hints. That resolver advertises access to all protocols and returns null, which directs the parser to open the local file: references normally. DescribeStoredQueries serialises the included content into its public response.

The response contains the active <key> from security/config.xml and the default user service's users.xml, including the administrator's password digest from its password attribute.

Anonymous DescribeStoredQueries response showing the remember-me key and the admin user's password digest from users.xml, with the filter chain folded

GeoServer's remember-me usernames carry the user service name, so the stock administrator is admin@default. RememberMeUserDetailsService.java splits that name, loads the service and returns its user.

@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
    Matcher m = TOKEN_PATTERN.matcher(username);
    // ... invalid-input handling omitted.
    String user = m.group(1).replace("\\@", "@");
    String service = m.group(2);

    try {
        GeoServerUserGroupService ugService = securityManager.loadUserGroupService(service); // [16] Selects user service.
        return new RememberMeUserDetails(ugService.loadUserByUsername(user), service); // [17] Loads its user.
    } catch (IOException e) {
        // ... error handling omitted.
    }
}

default at [16] is the file user service, and the XInclude read already returned its users.xml. XMLUserGroupService passes each password attribute through createUserObject() unchanged, so the user loaded at [17] carries the same digest the attacker already has.

Spring Security 7.0.5 builds the cookie signature in its four-argument implementation.

protected String makeTokenSignature(long tokenExpiryTime, String username, @Nullable String password,
        RememberMeTokenAlgorithm algorithm) {
    String data = username + ":" + tokenExpiryTime + ":" + password + ":" + getKey(); // [18] Uses both leaked secrets.
    try {
        MessageDigest digest = MessageDigest.getInstance(algorithm.getDigestAlgorithm());
        return new String(Hex.encode(digest.digest(data.getBytes())));
    }
    catch (NoSuchAlgorithmException ex) {
        // ... error handling omitted.
    }
}

[18] hashes the username, expiry, password digest and key. WFS has already returned the digest and the key, so an attacker can compute a valid SHA-256 signature for admin@default and exchange the cookie for an administrator session.

GeoServer's admin-only Server Status page opened with only the forged remember-me cookie

A Database Value Becomes a Java Object (CVE-2026-129242)

With that session, an attacker can write files beneath the data directory through ResourceController.resourcePut() and register a JDBC user service through UserGroupServiceController.post(). HSQLDB ships with GeoServer 3.0.0, and JdbcSecurityConfigValidator.java allows a local HSQLDB URL, so the service can point at an uploaded database.

A user lookup through the resulting JDBC service reaches this loop in JDBCUserGroupService.java.

ps2 = getDMLStatement("userprops.selectForUser", con);
ps2.setString(1, username);
rs2 = ps2.executeQuery();
while (rs2.next()) {
    String propName = rs2.getString(1);
    Object propValue = rs2.getObject(2); // [19] Gets property as an object.
    u.getProperties().put(propName, propValue == null ? "" : propValue);
}

getObject() at [19] returns whatever Java object the driver says the column holds. For HSQLDB's OTHER type, JDBCResultSet.getObject() in version 2.7.2 takes this branch.

case Types.OTHER :
case Types.JAVA_OBJECT : {
    Object o = getColumnInType(columnIndex, sourceType);

    if (o == null) {
        return null;
    }

    try {
        return ((JavaObjectData) o).getObject(); // [20] Converts bytes to an object.
    } catch (HsqlException e) {
        throw JDBCUtil.sqlException(e);
    }
}

[20] hands the stored bytes to JavaObjectData.getObject().

public Object getObject() {

    try {
        return InOutUtil.deserialize(data); // [21] Deserialises the bytes.
    } catch (Exception e) {
        throw Error.error(ErrorCode.X_22521, e.toString());
    }
}

InOutUtil.deserialize() at [21] builds a plain ObjectInputStream.

public static Serializable deserialize(byte[] ba)
throws IOException, ClassNotFoundException {

    HsqlByteArrayInputStream bi = new HsqlByteArrayInputStream(ba);
    ObjectInputStream        is = new ObjectInputStream(bi); // [22] Plain object stream.

    return (Serializable) is.readObject(); // [23] Reads attacker graph.
}

The stream at [22] has no object filter, so readObject() at [23] rebuilds whatever object graph the attacker stored, from any serialisable class on GeoServer's classpath.

Impact

Successful exploitation runs arbitrary commands with the operating-system permissions of the GeoServer process. The chain works on a default Linux install with no extensions or configuration changes. It ran on OpenJDK 17 under Jetty 12 and on the Java 21 runtime in the official Docker image.

Exploitation

Preconditions

  • Network access to GeoServer's WFS endpoint and REST API.
  • The stock admin account enabled in the default user service.
  • A Linux host, because the payload runs /bin/sh -c.

PoC

The PoC accompanying this writeup runs the whole chain and prints the command's output. Its HSQLDB database stores a PriorityQueue with a BeanComparator. When the queue rebuilds itself, the comparator calls getOutputProperties() on a JDK TemplatesImpl. That loads a compiled XSLT translet, and the translet's constructor runs the command.

python3 geoserver_preauth_rce.py -u http://127.0.0.1:18080/geoserver -c id
 [*] Probing anonymous WFS stored-query errors for the data-directory path
 [+] data directory: /opt/geoserver_data
 [*] Persisting an anonymous x/WFS stored query with deferred XInclude
 [+] DescribeStoredQueries disclosed the remember-me key and admin password digest
 [*] Forging a remember-me cookie and exchanging it for a session
 [+] administrator JSESSIONID accepted by the REST API
 [*] Uploading the HSQLDB payload database and request via REST
 [+] registered JDBC user-group service 'jdbc_geoserver_poc'
 [*] Triggering deserialisation through a user-property lookup
 [+] command executed (exit code 0)
 [+] output of: id
  ------------------------------------------------------------
uid=0(root) gid=0(root) groups=0(root)
 [*] Cleaning up
 [+] removed the staging directory and temporary JDBC service

This run is against the official 3.0.0 container, where GeoServer runs as root.

Patch Diffing

The Overlong ID No Longer Leaks the Path

GEOS-12240 changes StoredQueryProvider.getStoredQuery() in two places.

// StoredQueryProvider.java (getStoredQuery)
+    // an id too long to form a valid file name cannot match a stored query
+    if (name == null || isIdTooLong(name)) {
+        return null;
+    }
+
     try {
         // ... unchanged lookup and parsing omitted.
     } catch (Exception e) {
-        throw new RuntimeException("Error accessing stored query: " + name, e);
+        LOGGER.log(Level.WARNING, e, () -> "Error accessing stored query: " + name);
+        throw new RuntimeException("Error accessing stored query: " + name);
     }

The early return keeps an overlong ID away from Files.readAttributes(), and the new throw drops the e cause, so the filesystem error only reaches the log. An attacker who already knows the data-directory path doesn't need this step.

The same overlong storedQuery_id against GeoServer 3.0.2 returning No such stored query without any path

The Service Name Is Canonicalised Before the Access Check

Dispatcher.service() now replaces the request's service name with the resolved service ID before the security callback runs, as long as the request had one (GEOS-12195, PR #9922).

// Dispatcher.java (service)
     req.setServiceDescriptor(serviceDescriptor);
+    // don't set it if it was never provided in the first place
+    if (req.getService() != null) {
+        req.setService(serviceDescriptor.getId());
+    }
     return fireServiceDispatchedCallback(req, serviceDescriptor);

OperationSecurityCallback is unchanged, but it now reads WFS instead of x/WFS. The wfs.CreateStoredQuery and wfs.DropStoredQuery rules match, so the anonymous request is rejected before it can store anything.

Stored-Query Parsing Uses the Configured Entity Resolver

StoredQueryProvider.parseStoredQuery() installs GeoServer's configured entity resolver on the reload parser (GEOS-12199, PR #9928).

// StoredQueryProvider.java (parseStoredQuery, getEntityResolver)
 StoredQuery parseStoredQuery(Resource file, Parser p) throws Exception {
     p.setRootElementType(WFS.StoredQueryDescriptionType);
+    EntityResolver entityResolver = getEntityResolver();
+    if (entityResolver != null) {
+        p.setEntityResolver(entityResolver);
+    }
     try (InputStream fin = file.in()) {
 // ... unchanged parsing omitted.
+private EntityResolver getEntityResolver() {
+    return catalog.getResourcePool().getEntityResolver();
+}

The resolver now comes from the catalog's ResourcePool instead of the process-wide NullEntityResolver. The file is still reparsed, but its xi:include elements can no longer open file: references, so DescribeStoredQueries has nothing to return from config.xml or users.xml.

GEOS-12199 also sets the resolver in StoredQuery.compile(), which parses the built-in GetFeatureById query. That query has its own XML injection, which GHSA-39mw-5chv-jh47 describes. GeoServer filed the stored-query XInclude read under the same advisory. The advisory also lists GEOT-7938 from GeoTools 35.2, where PreventLocalEntityResolver now follows allowed HTTP redirects itself and checks each destination against its allow-list.

JDBC Property Values Are Read as Text

GEOS-12239 changes JDBCUserGroupService to read each property value with getString() instead of getObject().

// JDBCUserGroupService.java (user-property loop)
 while (rs2.next()) {
     String propName = rs2.getString(1);
-    Object propValue = rs2.getObject(2);
+    String propValue = rs2.getString(2);
     u.getProperties().put(propName, propValue == null ? "" : propValue);
 }

An OTHER value now comes back as its string form, so HSQLDB never hands the stored bytes to ObjectInputStream. The same change covers the bulk user-property load and every property read in JDBCRoleService.

The Remember-Me Key Is No Longer Read From the Data Directory

PR #10008 removes the stored key and its setter from RememberMeServicesConfig. The key now comes from GEOSERVER_REMEMBERME_KEY, or from a random value generated once per run.

// RememberMeServicesConfig.java
 private static final long serialVersionUID = 1L;

-public static final String DEFAULT_KEY = "geoserver";
+/** System or environment property that sets the remember-me cookie key across a cluster. */
+public static final String KEY_PROPERTY = "GEOSERVER_REMEMBERME_KEY";
+
+private static final int RANDOM_KEY_BYTES = 32;
+
+private static final SecureRandom SR = new SecureRandom();
+private static final String resolvedKey = resolveKey();

-String key = DEFAULT_KEY;
+static String resolveKey() {
+    String configured = GeoServerExtensions.getProperty(KEY_PROPERTY);
+    if (configured != null && !configured.isBlank()) {
+        return configured;
+    }
+    byte[] bytes = new byte[RANDOM_KEY_BYTES];
+    SR.nextBytes(bytes);
+    return HexFormat.of().formatHex(bytes);
+}

 public RememberMeServicesConfig() {}

 public RememberMeServicesConfig(RememberMeServicesConfig other) {
     super(other);
-    setKey(other.getKey());
 }

+/** Returns the key that signs the remember-me cookie, from {@link #KEY_PROPERTY} or a random value. */
 public String getKey() {
-    return key;
-}
-
-public void setKey(String key) {
-    this.key = key;
+    return resolvedKey;
 }

The chain read the live key, so it never depended on the shipped geoserver value. With the key out of the data directory, a file read no longer reveals it.

Remediation

Upgrade to GeoServer 3.0.2, 2.28.6 or 2.27.7.

The fixed releases generate a new remember-me key each time they start, so remember-me cookies stop working after a restart. If you run a cluster and need cookies to work across nodes, set the same GEOSERVER_REMEMBERME_KEY on each one.

If you can't upgrade straight away, GeoServer's advisories suggest blocking service values that contain / at a proxy and removing rememberme from the web filter chain. They also suggest checking wfs/query and workspaces/*/wfs/query in the data directory for stored queries you didn't create.

Disclosure Timeline

  • August 2, 2026: I reported the full chain to the GeoServer team through a private GitHub security advisory, and sent a revised PoC the same day.
  • August 10, 2026: Security team acknowledged the report.
  • August 15, 2026: I retested the chain on the official 3.0.0 release and on 3.0.1, released the day before, and it worked on both.
  • September 14, 2026: The service-rule bypass fix (#9922) merged.
  • September 24, 2026: The remember-me configuration fix (#10008) merged.
  • October 12, 2026: The stored-query entity-resolver fix (#9928) merged.
  • October 13, 2026: The entity-resolver change was backported to 3.0.x (#10080), and GeoTools merged the accompanying GEOT-7938 redirect hardening.
  • October 15, 2026: The JDBC property fix and WFS path-disclosure fix landed on 3.0.x.
  • October 17, 2026: GeoServer 3.0.2 released with fixes for the chain.
  • October 18, 2026: GeoServer 2.27.7 released with the same fixes.
  • October 29, 2026: GeoServer identified the five fixes in 3.0.2, scheduled disclosure under GEOS-12273 and asked GitHub for CVEs.
  • November 2, 2026: GeoServer 2.28.6 released with the same fixes.
  • November 7, 2026: At the GitHub CVE team's request, GeoServer split the report into five advisories and retitled the original one to cover the remember-me key.
  • November 16, 2026: GitHub assigned a CVE to each of the five advisories.
  • November 23, 2026: GeoServer published all five advisories. Quikko and nteusink are also credited on the x/WFS bypass and XML injection advisories, and McCaulay was added as a reporter on the remember-me key advisory.

Conclusion

Five separate vulns took an anonymous WFS request in GeoServer to command execution as the GeoServer process. I guess you could call this GeoServer2Shell 😁

References