Vulnerabilities in pkg:npm/swagger-ui

PACKAGE
Advisory Identifier: GHSA-cr3q-pqgq-m8c2
Advisory Summary

CVE-2018-25031 is a MODERATE (CVSS 4.3) spoofing attack vulnerability (CWE-922: Insecure Storage of Sensitive Information) affecting Swagger ui libraries in the npm ecosystem. The issue involves spoofing attack in swagger-ui. Remediation is available by upgrading affected packages to version 4.1.3.

14 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/swagger-ui

14 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/swagger-ui. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-cr3q-pqgq-m8c2 CVE-2018-25031 MODERATE Spoofing attack in swagger-ui
GHSA-c427-hjc3-wrfw CVE-2019-17495 CRITICAL Cross-site scripting in Swagger-UI
GHSA-h8wp-wgcq-qhrf CVE-2016-1000229 MODERATE Improper Neutralization of Input During Web Page Generation in swagger-ui
GHSA-qrmm-w75w-3wpx - MODERATE Server side request forgery in SwaggerUI
GHSA-w992-2gmj-9xxj - MODERATE Cross-Site Scripting in swagger-ui
GHSA-22q9-hqm5-mhmc - MODERATE Cross-Site Scripting in swagger-ui
GHSA-vp93-gcx5-4w52 - MODERATE Cross-Site Scripting in swagger-ui
GHSA-388g-jwpg-x6j4 - MODERATE Cross-Site Scripting in swagger-ui
GHSA-4f9m-pxwh-68hg - MODERATE Cross-Site Scripting in swagger-ui
GHSA-g336-c7wv-8hp3 - CRITICAL Cross-Site Scripting in swagger-ui
GHSA-mrx7-8hxf-f853 CVE-2016-1000233 HIGH Cross-Site Scripting in swagger-ui
GHSA-p239-93f7-h6xf CVE-2016-5682 CRITICAL Cross-Site Scripting in swagger-ui
GHSA-7f59-x49p-v8mq CVE-2016-1000226 CRITICAL Cross-Site Scripting in swagger-ui
GHSA-x9p2-fxq6-2m5f - MODERATE Reverse Tabnapping in swagger-ui

CVE-2018-25031 at a Glance

CVE Identifier CVE-2018-25031
GHSA Identifier GHSA-cr3q-pqgq-m8c2
Severity MODERATE
CVSS v3.1 Base Score 4.3
CWE Classification CWE-922: Insecure Storage of Sensitive Information
Affected Product Swagger ui
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 4.3

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

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

How to Fix CVE-2018-25031

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

swagger-ui fixed: 4.1.3
npm install swagger-ui@4.1.3
org.webjars:swagger-ui fixed: 4.1.3
<dependency>
    <groupId>org.webjars</groupId>
    <artifactId>swagger-ui</artifactId>
    <version>4.1.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:

npm ls swagger-ui

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2018-25031, inspect your project dependencies using npm:

npm ls swagger-ui

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

Note: The npm ls swagger-ui command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-922: Insecure Storage of Sensitive Information, where the product stores sensitive information without properly limiting read or write access by unauthorized actors. In Swagger ui, 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

Swagger UI before 4.1.3 could allow a remote attacker to conduct spoofing attacks. By persuading a victim to open a crafted URL, an attacker could exploit this vulnerability to display remote OpenAPI definitions.

CVE-2018-25031 Affected Swagger ui Versions

2 component(s)
Fixed Versions:
4.1.3
Product / Package Ecosystem Affected Versions Fixed Version
swagger-ui
npm
< 4.1.3
4.1.3
org.webjars:swagger-ui
Maven
< 4.1.3
4.1.3

References

Frequently Asked Questions

What is CVE-2018-25031?
CVE-2018-25031 is a security vulnerability in Swagger ui involving Spoofing attack in swagger-ui under CWE-922: Insecure Storage of Sensitive Information.
Which Swagger ui versions are affected?
Affected versions include releases prior to 4.1.3 across affected packages: swagger-ui, org.webjars:swagger-ui.
What version fixes CVE-2018-25031?
Upgrading to 4.1.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is swagger-ui affected?
Yes, swagger-ui is affected in releases prior to 4.1.3. Upgrade your dependency to 4.1.3 or later.
What is the CVSS score of CVE-2018-25031?
CVE-2018-25031 has a CVSS v3.1 base score of 4.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:N/A:N.
What CWE is associated with CVE-2018-25031?
CVE-2018-25031 is classified under CWE-922: Insecure Storage of Sensitive Information (The product stores sensitive information without properly limiting read or write access by unauthorized actors.).
How can I check npm dependencies for CVE-2018-25031?
Run the dependency tree command: 'npm ls swagger-ui'. 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-cr3q-pqgq-m8c2",
  "modified" : "2025-09-02T22:23:59Z",
  "published" : "2022-03-12T00:00:36Z",
  "aliases" : [ "CVE-2018-25031" ],
  "summary" : "Spoofing attack in swagger-ui",
  "details" : "Swagger UI before 4.1.3 could allow a remote attacker to conduct spoofing attacks. By persuading a victim to open a crafted URL, an attacker could exploit this vulnerability to display remote OpenAPI definitions.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "swagger-ui"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.1.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.webjars:swagger-ui"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.1.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2018-25031"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/swagger-api/swagger-ui/issues/4872"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/swagger-api/swagger-ui/pull/7697"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/swagger-api/swagger-ui"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/swagger-api/swagger-ui/releases/tag/v4.1.3"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20220407-0004"
  }, {
    "type" : "WEB",
    "url" : "https://security.snyk.io/vuln/SNYK-JS-SWAGGERUI-2314885"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20", "CWE-918", "CWE-922" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-03-14T23:31:48Z",
    "nvd_published_at" : "2022-03-11T07:15:00Z"
  }
}