Elysiajs CORS, Origin Validation Bypass, CVE-2025-xxxx (Moderate)

Listen to this Post

The vulnerability (CVE-2025-xxxx) in the elysia-cors library up to version 1.3.0 stems from an improper origin validation mechanism. The library’s function for validating incoming request origins against a whitelist uses a flawed substring matching algorithm instead of a strict equality or regex-based boundary check. Specifically, when comparing the `Origin` header value to a configured allowed origin like “example.com”, the check `allowedOrigin.includes(incomingOrigin)` is used. This logic incorrectly returns true for malicious origins such as “notexample.com” or “example.common.net” because the string “example.com” is contained within them. Consequently, the Access-Control-Allow-Origin header is set to the malicious origin, bypassing the Same-Origin Policy and enabling attackers to perform unauthorized cross-origin requests to retrieve sensitive user data from a vulnerable application.
Platform: Elysia.js
Version: <=1.3.0
Vulnerability: CORS Bypass
Severity: Moderate

date: 2025-08-20

Prediction: 2025-09-03

What Undercode Say:

`curl -H “Origin: http://notexample.com” -v http://vulnerable-site.com/api/data`
`const app = new Elysia().use(cors({ origin: [‘example.com’] })) // Vulnerable config`
`// Patch: Use strict comparison or regex with anchors: ^example.com$`

How Exploit:

Craft HTTP request with malicious Origin header pointing to a domain that contains the whitelisted string as a substring.

Protection from this CVE:

Upgrade elysia-cors. Implement strict origin validation on server-side.

Impact:

Unauthorized cross-origin data access, potential information disclosure.

🎯Let’s Practice Exploiting & Learn Patching For Free:

Sources:

Reported By: github.com
Extra Source Hub:
Undercode

🔐JOIN OUR CYBER WORLD [ CVE News • HackMonitor • UndercodeNews ]

💬 Whatsapp | 💬 Telegram

📢 Follow DailyCVE & Stay Tuned:

𝕏 formerly Twitter 🐦 | @ Threads | 🔗 Linkedin Featured Image

Scroll to Top