# GHSA-39MW-5CHV-JH47: Unauthenticated WFS GetFeatureById XML injection

- Database: GitHub
- Severity: CVSS 8.6 (High)
- Published: 2026-11-23
- Modified: 2026-11-23

## Tracked as

- [CVE-2026-120705](https://cve.now/CVE-2026-120705.md): GeoServer unauthenticated XML injection in WFS GetFeatureById

## Affected versions

- org.geoserver:gs-wfs-core (Maven): through 2.27.6
- org.geoserver:gs-wfs-core (Maven): from 2.28.0, through 2.28.5
- org.geoserver:gs-wfs-core (Maven): from 3.0.0, through 3.0.1
- org.geotools:gt-metadata (Maven): through 33.6
- org.geotools:gt-metadata (Maven): from 34.0, through 34.5
- org.geotools:gt-metadata (Maven): from 35.0, through 35.1

## Description

GeoServer exposes the built-in WFS 2.0 stored query `urn:ogc:def:query:OGC-WFS::GetFeatureById` through the public `GetFeature` operation. The stored query substituted the caller's `ID` parameter into an XML template without escaping, then parsed the result without GeoServer's entity resolver. An unauthenticated caller could inject XML, including an `xi:include`, into the query.

### Impact

A single unauthenticated WFS request can:

* read a local text file readable by the GeoServer process;
* fetch an attacker selected HTTP or HTTPS URL (server-side request forgery);
* receive the fetched text in the `Illegal property name` error response.

No authentication, custom stored query or `CreateStoredQuery` access is required. Contents are echoed when a layer is published to anonymous users; otherwise the file is still read but not returned.

### Details

`StoredQuery.compile()` replaced the `${ID}` token in the `GetFeatureById` template (`<fes:ResourceId rid='${ID}'/>`) using plain string replacement, so quotes and angle brackets in the value could close the `rid` attribute and add new FES elements. The result was parsed with `new Parser(new WFSConfiguration())` without the catalog entity resolver used elsewhere in the class, so XInclude and external entities were resolved with ordinary URI access.

### Mitigation

Restrict or disable the WFS service for anonymous users using service security, or disable WFS if it is not required.

### Resolution

Stored query parsing now uses the GeoServer entity resolver, and the GeoTools `PreventLocalEntityResolver` checks redirects.

* GeoServer 2.27.7, 2.28.6, 3.0.2
* GeoTools 33.7, 34.6, 35.2

### References

* https://osgeo-org.atlassian.net/browse/GEOS-12199
* https://osgeo-org.atlassian.net/browse/GEOT-7938
* https://github.com/geoserver/geoserver/pull/9928
* https://github.com/geoserver/geoserver/security/advisories/GHSA-hgm3-wq4h-8vvq
* https://github.com/geoserver/geoserver/security/advisories/GHSA-rv5g-g2r9-58rj

## References

- https://github.com/geoserver/geoserver/security/advisories/GHSA-39mw-5chv-jh47

Page: https://cve.now/GHSA-39MW-5CHV-JH47

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
