CVE-2024-23640: Gs main Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-9rfr-pf2x-g4xf
CVSS 4.8
CWE-79
Published
Advisory Summary

CVE-2024-23640 is a MODERATE (CVSS 4.8) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Gs main libraries in the Maven ecosystem. The issue involves geoserver's style publisher vulnerable to stored cross-site scripting (xss). Remediation is available by upgrading affected packages to version 2.23.3.

CVE-2024-23640 at a Glance

CVE Identifier CVE-2024-23640
GHSA Identifier GHSA-9rfr-pf2x-g4xf
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 main
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-2024-23640

To remediate this vulnerability, upgrade all affected Gs main 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-main fixed: 2.23.3
<dependency>
    <groupId>org.geoserver</groupId>
    <artifactId>gs-main</artifactId>
    <version>2.23.3</version>
</dependency>
org.geoserver:gs-ows fixed: 2.23.3
<dependency>
    <groupId>org.geoserver</groupId>
    <artifactId>gs-ows</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-2024-23640, 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 main 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 main, 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 or in a specially crafted datastore file that will execute in the context of another user's browser when viewed in the Style Publisher. Access to the Style Publisher is available to all users although data security may limit users' ability to trigger the XSS. ### Details _Give all details on the vulnerability. Pointing to the incriminated source code is very helpful for the maintainer._ ### PoC _Complete instructions, including specific configuration details, to reproduce the vulnerability._ ### 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-11149 https://github.com/geoserver/geoserver/pull/7162 https://osgeo-org.atlassian.net/browse/GEOS-11155 https://github.com/geoserver/geoserver/pull/7181

CVE-2024-23640 Affected Gs main Versions

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

References

Frequently Asked Questions

What is CVE-2024-23640?
CVE-2024-23640 is a security vulnerability in Gs main involving GeoServer's Style Publisher vulnerable to Stored Cross-Site Scripting (XSS) under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Gs main versions are affected?
Affected versions include releases prior to 2.23.3 across affected packages: org.geoserver:gs-main, org.geoserver:gs-ows.
What version fixes CVE-2024-23640?
Upgrading to 2.23.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is gs-main affected?
Yes, org.geoserver:gs-main is affected in releases prior to 2.23.3. Upgrade your dependency to 2.23.3 or later.
Is gs-ows affected?
Yes, org.geoserver:gs-ows 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-2024-23640?
CVE-2024-23640 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-2024-23640?
CVE-2024-23640 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-2024-23640?
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-9rfr-pf2x-g4xf",
  "modified" : "2024-03-20T21:04:02Z",
  "published" : "2024-03-20T15:06:03Z",
  "aliases" : [ "CVE-2024-23640" ],
  "summary" : "GeoServer's Style Publisher vulnerable to Stored Cross-Site Scripting (XSS)",
  "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 or in a specially crafted datastore file that will execute in the context of another user's browser when viewed in the Style Publisher.  Access to the Style Publisher is available to all users although data security may limit users' ability to trigger the XSS.\n\n### Details\n_Give all details on the vulnerability. Pointing to the incriminated source code is very helpful for the maintainer._\n\n### PoC\n_Complete instructions, including specific configuration details, to reproduce the vulnerability._\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-11149\nhttps://github.com/geoserver/geoserver/pull/7162\nhttps://osgeo-org.atlassian.net/browse/GEOS-11155\nhttps://github.com/geoserver/geoserver/pull/7181",
  "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-main"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.23.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.geoserver:gs-ows"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.23.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/geoserver/geoserver/security/advisories/GHSA-9rfr-pf2x-g4xf"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-23640"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/geoserver/geoserver/pull/7162"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/geoserver/geoserver/pull/7181"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/geoserver/geoserver"
  }, {
    "type" : "WEB",
    "url" : "https://osgeo-org.atlassian.net/browse/GEOS-11149"
  }, {
    "type" : "WEB",
    "url" : "https://osgeo-org.atlassian.net/browse/GEOS-11155"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-03-20T15:06:03Z",
    "nvd_published_at" : "2024-03-20T16:15:08Z"
  }
}