CVE-2025-50864

6.5 MEDIUM

📋 TL;DR

An origin validation error in the elysia-cors library allows attackers to bypass CORS restrictions by using malicious domains that contain legitimate domain names as substrings. This vulnerability affects any web application using elysia-cors version 1.3.0 or earlier for CORS validation, potentially exposing user data to unauthorized cross-origin access.

💻 Affected Systems

Products:
  • elysia-cors
Versions: through 1.3.0
Operating Systems: all
Default Config Vulnerable: ⚠️ Yes
Notes: All configurations using elysia-cors for CORS validation are affected. The vulnerability exists in the origin validation logic.

⚠️ Manual Verification Required

This CVE does not have specific version information in our database, so automatic vulnerability detection cannot determine if your system is affected.

Why? The CVE database entry doesn't specify which versions are vulnerable (no version ranges provided by the vendor/NVD).

🔒 Custom verification scripts are available for registered users. Sign up free to download automated test scripts.

Recommended Actions:
  1. Review the CVE details at NVD
  2. Check vendor security advisories for your specific version
  3. Test if the vulnerability is exploitable in your environment
  4. Consider updating to the latest version as a precaution

⚠️ Risk & Real-World Impact

🔴

Worst Case

Attackers can bypass CORS policies entirely, enabling cross-origin attacks that steal sensitive user data, perform unauthorized actions, or conduct CSRF attacks against authenticated users.

🟠

Likely Case

Malicious websites can make unauthorized cross-origin requests to vulnerable applications, potentially accessing user data or performing actions on behalf of users.

🟢

If Mitigated

With proper server-side validation and additional security controls, the impact is limited to potential information disclosure from improperly configured endpoints.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires crafting malicious domains that contain legitimate domain names as substrings (e.g., 'notexample.com' when 'example.com' is allowed).

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 1.3.1 or later

Vendor Advisory: https://github.com/elysiajs/elysia-cors/commit/9b9eb92e32a7a4b43b6d5108668941701c33e221

Restart Required: No

Instructions:

1. Update elysia-cors to version 1.3.1 or later using npm: 'npm update elysia-cors' 2. Verify the update in package.json 3. Test CORS functionality after update

🔧 Temporary Workarounds

Implement custom origin validation

all

Override the default CORS origin validation with exact string matching

Implement custom origin validation middleware that performs exact domain matching instead of substring checking

🧯 If You Can't Patch

  • Implement additional server-side validation for all sensitive endpoints
  • Use Content Security Policy (CSP) headers to restrict cross-origin requests

🔍 How to Verify

Check if Vulnerable:

Check package.json for elysia-cors version <=1.3.0 or examine the origin validation logic in the CORS middleware

Check Version:

npm list elysia-cors

Verify Fix Applied:

Verify elysia-cors version is >=1.3.1 and test that domains like 'notexample.com' are rejected when 'example.com' is allowed

📡 Detection & Monitoring

Log Indicators:

  • Unusual cross-origin requests from domains containing legitimate domain names as substrings
  • CORS policy violations from unexpected origins

Network Indicators:

  • Cross-origin requests with suspicious origin headers
  • Requests bypassing expected CORS restrictions

SIEM Query:

web.logs origin:*example.com* AND NOT origin:example.com

🔗 References

📤 Share & Export