Vulnerabilities in pkg:maven/org.geoserver/gs-restconfig

PACKAGE
Advisory Identifier: GHSA-fh7p-5f6g-vj2w
Advisory Summary

CVE-2023-51445 is a MODERATE (CVSS 4.8) remote code execution vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Gs restconfig libraries in the Maven ecosystem. The issue involves stored cross-site scripting (xss) vulnerability in geoserver's rest resources api. Remediation is available by upgrading affected packages to version 2.23.3.

3 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:maven/org.geoserver/gs-restconfig

3 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:maven/org.geoserver/gs-restconfig. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-fh7p-5f6g-vj2w CVE-2023-51445 MODERATE Stored Cross-Site Scripting (XSS) vulnerability in GeoServer's REST Resources API
GHSA-75m5-hh4r-q9gx CVE-2024-23634 MODERATE GeoServer Arbitrary file renaming vulnerability in REST Coverage/Data Store API
GHSA-9v5q-2gwq-q9hq CVE-2023-51444 HIGH Arbitrary file upload vulnerability in GeoServer's REST Coverage Store API

CVE-2023-51445 at a Glance

CVE Identifier CVE-2023-51445
GHSA Identifier GHSA-fh7p-5f6g-vj2w
Severity MODERATE
CVSS v3.1 Base Score 4.8
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Gs restconfig
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 4.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:L/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required High (PR:H)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2023-51445

To remediate this vulnerability, upgrade all affected Gs restconfig dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

org.geoserver:gs-restconfig fixed: 2.23.3
<dependency>
    <groupId>org.geoserver</groupId>
    <artifactId>gs-restconfig</artifactId>
    <version>2.23.3</version>
</dependency>
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

mvn dependency:tree -Dincludes=org.geoserver

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2023-51445, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=org.geoserver

Analyze the terminal output to locate any version of Gs restconfig in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.23.3), your application is affected.

Note: The mvn dependency:tree -Dincludes=org.geoserver command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Gs restconfig, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary A stored cross-site scripting (XSS) vulnerability exists that enables an authenticated administrator with workspace-level privileges to store a JavaScript payload in uploaded style/legend resources that will execute in the context of another administrator's browser when viewed in the REST Resources API. Access to the REST Resources API is limited to full administrators by default and granting non-administrators access to this endpoint should be carefully considered as it may allow access to files containing sensitive information. ### Details Upload a new Legend via the New Style page if user has permissions for this. This file is then not checked and is uploaded to the backend system. This file can then be viewed directly by requesting it via the API which will then view the file in its raw format without sanitisation. ![image](https://user-images.githubusercontent.com/6471928/232732469-7dbf2776-5712-4c68-bd12-e2403c136a7c.png) ![image](https://user-images.githubusercontent.com/6471928/232732832-4fe2337f-9b28-41b1-9181-24abff4a6973.png) ### PoC 1 .User makes the following request to upload file. ``` POST /geoserver/web/wicket/bookmarkable/org.geoserver.wms.web.data.StyleNewPage?11-1.IBehaviorListener.0-dialog-dialog-content-form-submit&wicket-ajax=true&wicket-ajax-baseurl=wicket%2Fbookmarkable%2Forg.geoserver.wms.web.data.StyleNewPage%3F11 HTTP/1.1 Host: geoserver:8080 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Content-Type: multipart/form-data; boundary=---------------------------37957706701641834739220342753 Content-Length: 619 Connection: close Upgrade-Insecure-Requests: 1 -----------------------------37957706701641834739220342753 Content-Disposition: form-data; name="id89_hf_0" -----------------------------37957706701641834739220342753 Content-Disposition: form-data; name="userPanel:image" -----------------------------37957706701641834739220342753 Content-Disposition: form-data; name="userPanel:upload"; filename="test.html" Content-Type: text/html <script>alert(document.cookie)</script> -----------------------------37957706701641834739220342753 Content-Disposition: form-data; name="p::submit" 1 -----------------------------37957706701641834739220342753-- ``` 2. File is uploaded to the backend system and is viewable via the API at - /geoserver/rest/resourse/styles as per the screenshot above. 3. If admin user views this file the Javascript is executed and this could be used to craft a payload to steal the user's cookies(as these do not currently use HTTPOnly) ![image](https://user-images.githubusercontent.com/6471928/232733694-5a994b08-53e4-4cd0-a20e-ec8717537e26.png) Alternatively - If the user has permissions to use the API to make PUT requests then they can directly upload malicious files as per a request below. This would be viewable in the same way as above. PUT /geoserver/rest/resource/styles/test2.html HTTP/1.1 Host: geoserver:8080 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Authorization: Basic YWRtaW46Z2Vvc2VydmVy (admin:geoserver default credentials) Connection: close Upgrade-Insecure-Requests: 1 Content-Type: text/html Content-Length: 29 <script>alert(1)</script> ### Impact If an attacker can control a script that is executed in the victim's browser, then they can typically fully compromise that user. Amongst other things, the attacker can: 1 .Perform any action within the application that the user can perform. 2. View any information that the user is able to view. 3. Modify any information that the user is able to modify. 4. Initiate interactions with other application users, including malicious attacks, that will appear to originate from the initial victim user. ### References https://osgeo-org.atlassian.net/browse/GEOS-11148 https://github.com/geoserver/geoserver/pull/7161

CVE-2023-51445 Affected Gs restconfig Versions

1 component(s)
Fixed Versions:
2.23.3
Product / Package Ecosystem Affected Versions Fixed Version
org.geoserver:gs-restconfig
Maven
< 2.23.3
2.23.3

References

Frequently Asked Questions

What is CVE-2023-51445?
CVE-2023-51445 is a security vulnerability in Gs restconfig involving Stored Cross-Site Scripting (XSS) vulnerability in GeoServer's REST Resources API under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Gs restconfig versions are affected?
Affected versions include releases prior to 2.23.3 across affected packages: org.geoserver:gs-restconfig.
What version fixes CVE-2023-51445?
Upgrading to 2.23.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is gs-restconfig affected?
Yes, org.geoserver:gs-restconfig is affected in releases prior to 2.23.3. Upgrade your dependency to 2.23.3 or later.
What is the CVSS score of CVE-2023-51445?
CVE-2023-51445 has a CVSS v3.1 base score of 4.8 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2023-51445?
CVE-2023-51445 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check Maven dependencies for CVE-2023-51445?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.geoserver'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-fh7p-5f6g-vj2w",
  "modified" : "2024-03-20T21:04:09Z",
  "published" : "2024-03-20T14:58:17Z",
  "aliases" : [ "CVE-2023-51445" ],
  "summary" : "Stored Cross-Site Scripting (XSS) vulnerability in GeoServer's REST Resources API",
  "details" : "### Summary\nA stored cross-site scripting (XSS) vulnerability exists that enables an authenticated administrator with workspace-level privileges to store a JavaScript payload in uploaded style/legend resources that will execute in the context of another administrator's browser when viewed in the REST Resources API.  Access to the REST Resources API is limited to full administrators by default and granting non-administrators access to this endpoint should be carefully considered as it may allow access to files containing sensitive information.\n\n### Details\nUpload a new Legend via the New Style page if user has permissions for this. This file is then not checked and is uploaded to the backend system. This file can then be viewed directly by requesting it via the API which will then view the file in its raw format without sanitisation.\n![image](https://user-images.githubusercontent.com/6471928/232732469-7dbf2776-5712-4c68-bd12-e2403c136a7c.png)\n\n![image](https://user-images.githubusercontent.com/6471928/232732832-4fe2337f-9b28-41b1-9181-24abff4a6973.png)\n\n\n### PoC\n\n1 .User makes the following request to upload file.\n```\nPOST /geoserver/web/wicket/bookmarkable/org.geoserver.wms.web.data.StyleNewPage?11-1.IBehaviorListener.0-dialog-dialog-content-form-submit&wicket-ajax=true&wicket-ajax-baseurl=wicket%2Fbookmarkable%2Forg.geoserver.wms.web.data.StyleNewPage%3F11 HTTP/1.1\nHost: geoserver:8080\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\nAccept-Language: en-US,en;q=0.5\nAccept-Encoding: gzip, deflate\nContent-Type: multipart/form-data; boundary=---------------------------37957706701641834739220342753\nContent-Length: 619\nConnection: close\nUpgrade-Insecure-Requests: 1\n\n-----------------------------37957706701641834739220342753\nContent-Disposition: form-data; name=\"id89_hf_0\"\n-----------------------------37957706701641834739220342753\nContent-Disposition: form-data; name=\"userPanel:image\"\n-----------------------------37957706701641834739220342753\nContent-Disposition: form-data; name=\"userPanel:upload\"; filename=\"test.html\"\nContent-Type: text/html\n<script>alert(document.cookie)</script>\n-----------------------------37957706701641834739220342753\nContent-Disposition: form-data; name=\"p::submit\"\n1\n-----------------------------37957706701641834739220342753--\n```\n2. File is uploaded to the backend system and is viewable via the API at - /geoserver/rest/resourse/styles as per the screenshot above.\n\n3. If admin user views this file the Javascript is executed and this could be used to craft a payload to steal the user's cookies(as these do not currently use HTTPOnly)\n![image](https://user-images.githubusercontent.com/6471928/232733694-5a994b08-53e4-4cd0-a20e-ec8717537e26.png)\n\nAlternatively -\n\nIf the user has permissions to use the API to make PUT requests then they can directly upload malicious files as per a request below. This would be viewable in the same way as above.\n\nPUT /geoserver/rest/resource/styles/test2.html HTTP/1.1\nHost: geoserver:8080\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\nAccept-Language: en-US,en;q=0.5\nAccept-Encoding: gzip, deflate\nAuthorization: Basic YWRtaW46Z2Vvc2VydmVy (admin:geoserver default credentials)\nConnection: close\nUpgrade-Insecure-Requests: 1\nContent-Type: text/html\nContent-Length: 29\n\n<script>alert(1)</script>\n\n\n### Impact\nIf an attacker can control a script that is executed in the victim's browser, then they can typically fully compromise that user. Amongst other things, the attacker can:\n\n1 .Perform any action within the application that the user can perform.\n2. View any information that the user is able to view.\n3. Modify any information that the user is able to modify.\n4. Initiate interactions with other application users, including malicious attacks, that will appear to originate from the initial victim user.\n\n### References\nhttps://osgeo-org.atlassian.net/browse/GEOS-11148\nhttps://github.com/geoserver/geoserver/pull/7161\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.geoserver:gs-restconfig"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.23.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/geoserver/geoserver/security/advisories/GHSA-fh7p-5f6g-vj2w"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-51445"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/geoserver/geoserver/pull/7161"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/geoserver/geoserver/commit/7db985738ff2422019ccac974cf547bae5770cad"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/geoserver/geoserver"
  }, {
    "type" : "WEB",
    "url" : "https://osgeo-org.atlassian.net/browse/GEOS-11148"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-03-20T14:58:17Z",
    "nvd_published_at" : "2024-03-20T16:15:07Z"
  }
}