CVE-2025-50864: @elysiajs/cors Elysia-cors Origin Validation Error Vulnerability

MODERATE
Advisory Identifier: GHSA-f9qj-4c5x-cpcw
CVSS 6.5
CWE-346 CWE-178
Published
Advisory Summary

CVE-2025-50864 is a MODERATE (CVSS 6.5) elysia-cors origin validation error vulnerability (CWE-346: Origin Validation Error) affecting @elysiajs/cors libraries in the npm ecosystem. The issue involves elysia-cors origin validation error. Remediation is available by upgrading affected packages to version 1.3.1.

CVE-2025-50864 at a Glance

CVE Identifier CVE-2025-50864
GHSA Identifier GHSA-f9qj-4c5x-cpcw
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-346: Origin Validation Error
Affected Product @elysiajs/cors
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 6.5

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:N/I:H/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 None (C:N)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2025-50864

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

@elysiajs/cors fixed: 1.3.1
npm install @elysiajs/cors@1.3.1
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 @elysiajs/cors

How to Check if You Are Affected

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

npm ls @elysiajs/cors

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

Note: The npm ls @elysiajs/cors 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-346: Origin Validation Error, where the product does not properly verify that the source of data or communication is valid. In @elysiajs/cors, 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

An Origin Validation Error in the elysia-cors library thru 1.3.0 allows attackers to bypass Cross-Origin Resource Sharing (CORS) restrictions. The library incorrectly validates the supplied origin by checking if it is a substring of any domain in the site's CORS policy, rather than performing an exact match. For example, a malicious origin like "notexample.com", "example.common.net" is whitelisted when the site's CORS policy specifies "example.com." This vulnerability enables unauthorized access to user data on sites using the elysia-cors library for CORS validation.

CVE-2025-50864 Affected @elysiajs/cors Versions

1 component(s)
Fixed Versions:
1.3.1
Product / Package Ecosystem Affected Versions Fixed Version
@elysiajs/cors
npm
< 1.3.1
1.3.1

References

Frequently Asked Questions

What is CVE-2025-50864?
CVE-2025-50864 is a security vulnerability in @elysiajs/cors involving elysia-cors Origin Validation Error under CWE-346: Origin Validation Error.
Which @elysiajs/cors versions are affected?
Affected versions include releases prior to 1.3.1 across affected packages: @elysiajs/cors.
What version fixes CVE-2025-50864?
Upgrading to 1.3.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @elysiajs/cors affected?
Yes, @elysiajs/cors is affected in releases prior to 1.3.1. Upgrade your dependency to 1.3.1 or later.
What is the CVSS score of CVE-2025-50864?
CVE-2025-50864 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N.
What CWE is associated with CVE-2025-50864?
CVE-2025-50864 is classified under CWE-346: Origin Validation Error (The product does not properly verify that the source of data or communication is valid.).
How can I check npm dependencies for CVE-2025-50864?
Run the dependency tree command: 'npm ls @elysiajs/cors'. 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-f9qj-4c5x-cpcw",
  "modified" : "2026-01-29T02:36:18Z",
  "published" : "2025-08-20T15:31:42Z",
  "aliases" : [ "CVE-2025-50864" ],
  "summary" : "elysia-cors Origin Validation Error",
  "details" : "An Origin Validation Error in the elysia-cors library thru 1.3.0 allows attackers to bypass Cross-Origin Resource Sharing (CORS) restrictions. The library incorrectly validates the supplied origin by checking if it is a substring of any domain in the site's CORS policy, rather than performing an exact match. For example, a malicious origin like \"notexample.com\", \"example.common.net\" is whitelisted when the site's CORS policy specifies \"example.com.\" This vulnerability enables unauthorized access to user data on sites using the elysia-cors library for CORS validation.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@elysiajs/cors"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.3.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-50864"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/elysiajs/elysia-cors/commit/9b9eb92e32a7a4b43b6d5108668941701c33e221"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/elysiajs/elysia-cors"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/elysiajs/elysia-cors/blob/main/src/index.ts"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/elysiajs/elysia-cors/tree/main"
  }, {
    "type" : "WEB",
    "url" : "https://medium.com/@raghavagrawal_23036/cors-bypass-in-popular-opensource-library-ad27fb41e16a"
  }, {
    "type" : "WEB",
    "url" : "http://elysiajs.com"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-178", "CWE-346" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-08-20T20:50:39Z",
    "nvd_published_at" : "2025-08-20T15:15:32Z"
  }
}