GHSA-3244-8mff-w398: Github.com/gotify/server Cross-Site Scripting Vulnerability

MODERATE
CWE-79
Published
Advisory Summary

GHSA-3244-8mff-w398 is a MODERATE cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Github.com/gotify/server libraries in the Go ecosystem. The issue involves reflected xss in gotify's /docs via import of outdated swagger ui. Remediation is available by upgrading affected packages to version 2.2.3.

GHSA-3244-8mff-w398 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-3244-8mff-w398
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Github.com/gotify/server
Package Ecosystem Go
Published Date
Last Updated

How to Fix GHSA-3244-8mff-w398

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

github.com/gotify/server fixed: 2.2.3
Upgrade github.com/gotify/server to 2.2.3
Verify Direct and Transitive Dependencies

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

inspect dependencies for github.com/gotify/server

How to Check if You Are Affected

To determine whether your application is affected by GHSA-3244-8mff-w398, inspect your project dependencies for Github.com/gotify/server:

inspect dependencies for github.com/gotify/server

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

Note: Verify declared build manifests and deployed runtime container environments.

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 Github.com/gotify/server, 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 Gotify exposes an outdated instance of the [Swagger UI](https://swagger.io/tools/swagger-ui/) API documentation frontend at `/docs` which is susceptible to reflected XSS attacks when loading external Swagger config files. Specifically, the DOMPurify version included with this version of Swagger UI is vulnerable to a [rendering XSS](https://www.vidocsecurity.com/blog/hacking-swagger-ui-from-xss-to-account-takeovers/) incorporating the mutation payload detailed in [CVE-2020-26870](https://research.securitum.com/mutation-xss-via-mathml-mutation-dompurify-2-0-17-bypass/) which was patched in 2021. This is further tracked in the GitHub Advisory Database as GHSA-QRMM-W75W-3WPX. An attacker can execute arbitrary JavaScript and potentially take over the account of the user that clicked the link. Keep in mind, the Gotify UI won't natively expose such a malicious link, so an attacker has to get the user to open the malicious link in a context outside of Gotify. ### Patches The vulnerability has been fixed in version 2.2.3. ### References https://github.com/gotify/server/pull/541

GHSA-3244-8mff-w398 Affected Github.com/gotify/server Versions

1 component(s)
Fixed Versions:
2.2.3
Product / Package Ecosystem Affected Versions Fixed Version
github.com/gotify/server
Go
< 2.2.3
2.2.3

References

Frequently Asked Questions

What is GHSA-3244-8mff-w398?
GHSA-3244-8mff-w398 is a security vulnerability in Github.com/gotify/server involving Reflected XSS in Gotify's /docs via import of outdated Swagger UI under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Github.com/gotify/server versions are affected?
Affected versions include releases prior to 2.2.3 across affected packages: github.com/gotify/server.
What version fixes GHSA-3244-8mff-w398?
Upgrading to 2.2.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/gotify/server affected?
Yes, github.com/gotify/server is affected in releases prior to 2.2.3. Upgrade your dependency to 2.2.3 or later.
What CWE is associated with GHSA-3244-8mff-w398?
GHSA-3244-8mff-w398 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 Go dependencies for GHSA-3244-8mff-w398?
Run the dependency tree command: 'inspect dependencies for github.com/gotify/server'. 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-3244-8mff-w398",
  "modified" : "2023-01-10T22:48:43Z",
  "published" : "2023-01-10T22:48:43Z",
  "aliases" : [ ],
  "summary" : "Reflected XSS in Gotify's /docs via import of outdated Swagger UI",
  "details" : "### Impact\n\nGotify exposes an outdated instance of the [Swagger UI](https://swagger.io/tools/swagger-ui/) API documentation frontend at `/docs` which is susceptible to reflected XSS attacks when loading external Swagger config files.\n\nSpecifically, the DOMPurify version included with this version of Swagger UI is vulnerable to a [rendering XSS](https://www.vidocsecurity.com/blog/hacking-swagger-ui-from-xss-to-account-takeovers/) incorporating the mutation payload detailed in [CVE-2020-26870](https://research.securitum.com/mutation-xss-via-mathml-mutation-dompurify-2-0-17-bypass/) which was patched in 2021. This is further tracked in the GitHub Advisory Database as GHSA-QRMM-W75W-3WPX.\n\nAn attacker can execute arbitrary JavaScript and potentially take over the account of the user that clicked the link. Keep in mind, the Gotify UI won't natively expose such a malicious link, so an attacker has to get the user to open the malicious link in a context outside of Gotify.\n\n### Patches\n\nThe vulnerability has been fixed in version 2.2.3.\n\n### References\n\nhttps://github.com/gotify/server/pull/541",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/gotify/server"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.2.3"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 2.2.2"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/gotify/server/security/advisories/GHSA-3244-8mff-w398"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/gotify/server/pull/541"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/gotify/server"
  }, {
    "type" : "WEB",
    "url" : "https://research.securitum.com/mutation-xss-via-mathml-mutation-dompurify-2-0-17-bypass"
  }, {
    "type" : "WEB",
    "url" : "https://www.vidocsecurity.com/blog/hacking-swagger-ui-from-xss-to-account-takeovers"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-01-10T22:48:43Z",
    "nvd_published_at" : null
  }
}