CVE-2024-38364: Dspace server webapp Cross-Site Scripting Vulnerability

LOW
Advisory Identifier: GHSA-94cc-xjxr-pwvf
CVSS 2.6
CWE-79
Published
Advisory Summary

CVE-2024-38364 is a LOW (CVSS 2.6) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Dspace server webapp libraries in the Maven ecosystem. The issue involves dspace cross site scripting (xss) via a deposited html/xml document. Remediation is available by upgrading affected packages to version 7.6.2.

CVE-2024-38364 at a Glance

CVE Identifier CVE-2024-38364
GHSA Identifier GHSA-94cc-xjxr-pwvf
Severity LOW
CVSS v3.1 Base Score 2.6
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Dspace server webapp
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 2.6

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

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

How to Fix CVE-2024-38364

To remediate this vulnerability, upgrade all affected Dspace server webapp 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.dspace:dspace-server-webapp fixed: 7.6.2
<dependency>
    <groupId>org.dspace</groupId>
    <artifactId>dspace-server-webapp</artifactId>
    <version>7.6.2</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.dspace

How to Check if You Are Affected

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

mvn dependency:tree -Dincludes=org.dspace

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

Note: The mvn dependency:tree -Dincludes=org.dspace 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 Dspace server webapp, 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

### Impact In DSpace 7.0 through 7.6.1, when an HTML, XML or JavaScript Bitstream is downloaded, the user's browser _may_ execute any embedded JavaScript. If that embedded JavaScript is malicious, there is a risk of an XSS attack. This attack may only be initialized by a user who already has Submitter privileges in the repository. The submitter must upload the malicious HTML/XML/JavaScript file themselves. The attack itself would not occur until a visitor or logged-in user downloads the file or clicks on a download link shared by the attacker. If your site is running the frontend and backend from separate domains, CORS and CSRF protection built into DSpace help to limit the impact of the attack. If the repository is configured to only download HTML / XML / JavaScript Bitstreams using the [`Content-Disposition: attachment`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) header, then the attack is no longer possible. See "Workarounds" below. ### Patches The fix is included in both 8.0 and 7.6.2. Please upgrade to one of these versions, or manually apply one of the "Workarounds" below. If you are already running 7.6 or 7.6.1, then this vulnerability can be fixed via a configuration update in your `dspace.cfg` configuration file. See details in below. ### Workarounds **DSpace sites running 7.6 or 7.6.1** can fix this issue by adding the following `webui.content_disposition_format` settings to their `dspace.cfg` (or `local.cfg`). These settings force all HTML, XML, RDF & JavaScript files to always be downloaded to a user's machine, blocking the attack. For more details see [PR #9638](https://github.com/DSpace/DSpace/pull/9638) ``` webui.content_disposition_format = text/html webui.content_disposition_format = text/javascript webui.content_disposition_format = text/xml webui.content_disposition_format = rdf ``` These settings will take effect immediately. There is no need to restart Tomcat. To verify the settings are working: upload an HTML or XML file to an in-progress submission. Attempt to download the file. The file should *not* open in your browser window. Instead, it should download to your local computer. **DSpace sites running 7.0 through 7.5** will need to **either** (CHOOSE ONE): * Upgrade to 7.6.2 or 8.0 * Or, upgrade to 7.6 or 7.6.1 and then apply the configuration change mentioned above * Or, manually add the `webui.content_disposition_format` setting (which was first released in 7.6), and then apply the configuration changes mentioned above. * The `webui.content_disposition_format` setting can be added by applying the changes in [PR #8891](https://github.com/DSpace/DSpace/pull/8891). A [`patch` file](https://github.com/DSpace/DSpace/pull/8891.patch) is also available. * Please be aware this patch may not apply cleanly to all prior versions of 7.x. In that scenario, you would need to find a way to manually apply the changes or consider a different workaround. * Or, find a way in your Apache or NGinx proxy to force the `Content-Disposition: attachment` header to be sent for **all files** downloaded via `/server/api/core/bitstreams/[uuid]/content` in the REST API. * NOTE: This workaround will patch the vulnerability. However, it does so by no longer allowing users to open _any_ downloaded files in their browser window. (This behavior may or may not be desirable in the long term, so you may wish to remove it in the future, once you have upgraded.) * For example, in Apache, using "mod_headers", you may add a configuration similar to this in your `<VirtualHost>`: ``` # Set "Content-Disposition: attachment" whenever path is /server/api/core/bitstreams/[uuid]/content Header set Content-Disposition attachment "expr=%{REQUEST_URI} =~ m#^/server/api/core/bitstreams/.*/content$#" ``` ### References Discovered and reported by Muhammad Zeeshan ([Xib3rR4dAr](https://github.com/Xib3rR4dAr)) ### For more information If you have any questions or comments about this advisory: * Email us at [security@dspace.org](mailto:security@dspace.org)

CVE-2024-38364 Affected Dspace server webapp Versions

1 component(s)
Fixed Versions:
7.6.2
Product / Package Ecosystem Affected Versions Fixed Version
org.dspace:dspace-server-webapp
Maven
≥ 7.0
< 7.6.2
7.6.2

References

Frequently Asked Questions

What is CVE-2024-38364?
CVE-2024-38364 is a security vulnerability in Dspace server webapp involving DSpace Cross Site Scripting (XSS) via a deposited HTML/XML document under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Dspace server webapp versions are affected?
Affected versions include releases prior to 7.6.2 across affected packages: org.dspace:dspace-server-webapp.
What version fixes CVE-2024-38364?
Upgrading to 7.6.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is dspace-server-webapp affected?
Yes, org.dspace:dspace-server-webapp is affected in releases prior to 7.6.2. Upgrade your dependency to 7.6.2 or later.
What is the CVSS score of CVE-2024-38364?
CVE-2024-38364 has a CVSS v3.1 base score of 2.6 (LOW) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:N/I:N/A:L.
What CWE is associated with CVE-2024-38364?
CVE-2024-38364 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-38364?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.dspace'. 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-94cc-xjxr-pwvf",
  "modified" : "2024-06-28T20:00:56Z",
  "published" : "2024-06-25T17:07:32Z",
  "aliases" : [ "CVE-2024-38364" ],
  "summary" : "DSpace Cross Site Scripting (XSS) via a deposited HTML/XML document",
  "details" : "### Impact\nIn DSpace 7.0 through 7.6.1, when an HTML, XML or JavaScript Bitstream is downloaded, the user's browser _may_ execute any embedded JavaScript.  If that embedded JavaScript is malicious, there is a risk of an XSS attack.\n\nThis attack may only be initialized by a user who already has Submitter privileges in the repository. The submitter must upload the malicious HTML/XML/JavaScript file themselves. The attack itself would not occur until a visitor or logged-in user downloads the file or clicks on a download link shared by the attacker.  \n\nIf your site is running the frontend and backend from separate domains, CORS and CSRF protection built into DSpace help to limit the impact of the attack.\n\nIf the repository is configured to only download HTML / XML / JavaScript Bitstreams using the [`Content-Disposition: attachment`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) header, then the attack is no longer possible.  See \"Workarounds\" below.\n\n### Patches\nThe fix is included in both 8.0 and 7.6.2.  Please upgrade to one of these versions, or manually apply one of the \"Workarounds\" below.\n\nIf you are already running 7.6 or 7.6.1, then this vulnerability can be fixed via a configuration update in your `dspace.cfg` configuration file.  See details in below.\n\n### Workarounds\n\n**DSpace sites running 7.6 or 7.6.1** can fix this issue by adding the following `webui.content_disposition_format` settings to their `dspace.cfg` (or `local.cfg`).  These settings force all HTML, XML, RDF & JavaScript files to always be downloaded to a user's machine, blocking the attack.  For more details see [PR #9638](https://github.com/DSpace/DSpace/pull/9638)\n```\nwebui.content_disposition_format = text/html\nwebui.content_disposition_format = text/javascript\nwebui.content_disposition_format = text/xml\nwebui.content_disposition_format = rdf\n```\nThese settings will take effect immediately. There is no need to restart Tomcat.\n\nTo verify the settings are working: upload an HTML or XML file to an in-progress submission. Attempt to download the file. The file should *not* open in your browser window. Instead, it should download to your local computer.\n\n**DSpace sites running 7.0 through 7.5** will need to **either** (CHOOSE ONE):\n* Upgrade to 7.6.2 or 8.0\n* Or, upgrade to 7.6 or 7.6.1 and then apply the configuration change mentioned above\n* Or, manually add the `webui.content_disposition_format` setting (which was first released in 7.6), and then apply the configuration changes mentioned above.\n    * The `webui.content_disposition_format` setting can be added by applying the changes in [PR #8891](https://github.com/DSpace/DSpace/pull/8891).  A [`patch` file](https://github.com/DSpace/DSpace/pull/8891.patch) is also available.\n    * Please be aware this patch may not apply cleanly to all prior versions of 7.x. In that scenario, you would need to find a way to manually apply the changes or consider a different workaround.\n* Or, find a way in your Apache or NGinx proxy to force the `Content-Disposition: attachment` header to be sent for **all files** downloaded via `/server/api/core/bitstreams/[uuid]/content` in the REST API.  \n    * NOTE: This workaround will patch the vulnerability. However, it does so by no longer allowing users to open _any_ downloaded files in their browser window. (This behavior may or may not be desirable in the long term, so you may wish to remove it in the future, once you have upgraded.)\n    * For example, in Apache, using \"mod_headers\", you may add a configuration similar to this in your `<VirtualHost>`:\n      ```\n      # Set \"Content-Disposition: attachment\" whenever path is /server/api/core/bitstreams/[uuid]/content\n      Header set Content-Disposition attachment \"expr=%{REQUEST_URI} =~ m#^/server/api/core/bitstreams/.*/content$#\"\n      ```\n\n### References\n\nDiscovered and reported by Muhammad Zeeshan ([Xib3rR4dAr](https://github.com/Xib3rR4dAr))\n\n### For more information\nIf you have any questions or comments about this advisory:\n\n* Email us at [security@dspace.org](mailto:security@dspace.org)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:N/I:N/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.dspace:dspace-server-webapp"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "7.0"
      }, {
        "fixed" : "7.6.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/DSpace/DSpace/security/advisories/GHSA-94cc-xjxr-pwvf"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-38364"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/DSpace/DSpace/pull/8891"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/DSpace/DSpace/pull/9638"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/DSpace/DSpace/commit/f1059b4340857cca3dc4c45b1ebbadce6bb61c0b"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/DSpace/DSpace"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-06-25T17:07:32Z",
    "nvd_published_at" : "2024-06-26T00:15:10Z"
  }
}