Sep 12, 2026·6 min read·4 visits
Unauthenticated endpoints and wildcard CORS in Mockoon allow local and remote attackers to compromise administrative APIs and hijack local server instances.
An in-depth analysis of CVE-2026-59148, a high-severity flaw in Mockoon where unauthenticated administrative endpoints and a wildcard Cross-Origin Resource Sharing (CORS) policy allow remote execution, state poisoning, and credential theft.
Mockoon versions prior to 9.7.0 contain a critical vulnerability where high-privilege administrative endpoints, routed through the /mockoon-admin path, are exposed by default without authentication. These routes are co-located on the same listener port as standard mock routes designed to receive untrusted external traffic. This architecture creates an entry point where any party capable of reaching the mock service can access administrative controls.\n\nThe administration endpoints provide several dangerous actions, such as dynamically editing mock route behaviors, viewing raw transaction logs containing HTTP headers, and writing configuration parameters directly to the running process. Because the application did not perform any access control verification, this design flaw left Mockoon services vulnerable to unauthorized administrative operations. This class of weakness is categorized under CWE-306.\n\nIn addition to the lack of authentication, Mockoon implemented a permissive Cross-Origin Resource Sharing (CORS) configuration that used a wildcard origin header. When local servers are executed during development, browsers allow external web resources to query these services if wildcard headers are active. Consequently, malicious websites could execute cross-origin requests targeting Mockoon's administrative API, creating a remote exploitation vector against local systems.
The primary technical flaw resides within the administrative route registration module in packages/commons-server/src/libs/server/admin-api.ts. In affected versions, the router handles administrative requests without invoking any session, credential, or token-based authorization filters. Because administrative interfaces share the same port and server thread as user-defined routes, any client that can route requests to Mockoon also has access to administrative controls.\n\nFurthermore, the CORS middleware registered for administrative endpoints unconditionally set the Access-Control-Allow-Origin header to *. This configuration tells the web browser to ignore cross-origin isolation policies. If an engineer hosts Mockoon locally and visits a malicious site, scripts on that site can send queries to local admin ports and read the responses directly, bypassing standard local-host isolation boundaries.\n\nAnother critical weakness involves the /mockoon-admin/env-vars route mapping to setEnvVarHandler. The code took parameters from the incoming request body and assigned them directly to Node's process.env dictionary without sanitization or validation. Without structural constraints, attackers could overwrite sensitive variables like NODE_OPTIONS to execute shell commands, enabling arbitrary code execution under the privileges of the active process.
In versions preceding the fix, the CORS configuration on /mockoon-admin* paths configured permissive headers without authentication check steps. The implementation of environment variable writing accepted keys directly into the global environment array.\n\ntypescript\n// VULNERABLE: Wildcard CORS configuration without authorization checks\napp.use(`${adminApiPrefix}*`, (req, res, next) => {\n res.setHeaders(\n new Headers({\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'GET,POST,PUT,PATCH,DELETE,HEAD,OPTIONS',\n 'Access-Control-Allow-Headers': 'Content-Type, Origin, Accept, Authorization, Content-Length, X-Requested-With'\n })\n );\n next();\n});\n\n// VULNERABLE: Direct write capability to environment dictionary\nconst setEnvVarHandler = (req, res) => {\n try {\n const { key, value } = req.body;\n if (key !== undefined && value !== undefined) {\n process.env[key] = value;\n res.send({ message: `Environment variable '${key}' has been set` });\n }\n } catch (_error) {\n res.status(400).send({ message: 'Invalid request' });\n }\n};\n\n\nThe fix introduced in commit c420b5a56918475b8663977b51e5f986e45b3299 added mandatory authorization token verification using a cryptographically secure token. It also restricted CORS origins to authorized lists and limited environment variable modifications to keys that begin with an approved prefix.\n\ntypescript\n// PATCHED: Authentication check using constant-time evaluation\nconst hasValidAdminApiToken = (providedToken: string): boolean => {\n const expectedTokenBuffer = Buffer.from(adminApiAuthToken, 'utf8');\n const providedTokenBuffer = Buffer.from(providedToken, 'utf8');\n if (expectedTokenBuffer.length !== providedTokenBuffer.length) {\n return false;\n }\n return timingSafeEqual(expectedTokenBuffer, providedTokenBuffer);\n};\n\n// PATCHED: Prefix restriction on environment variable assignments\nif (!envVarsPrefix) {\n res.status(403).send({\n message: 'Environment variable writes are disabled when the prefix is empty'\n });\n return;\n}\nconst prefixedKey = key.startsWith(envVarsPrefix) ? key : envVarsPrefix + key;\nprocess.env[prefixedKey] = value;\n\n\nThis update resolves the core vulnerabilities by securing the administration interface against unauthorized access and preventing dangerous environment modifications. The use of timingSafeEqual blocks attempts to crack the token via timing side-channels, ensuring the validation logic is robust.
Exploitation of CVE-2026-59148 relies either on direct network access to the port or on a drive-by cross-origin attack targeting local developers. The cross-origin scenario is particularly effective because Mockoon is widely run on local workstations (localhost:3000). If a developer visits a malicious website, client-side scripts running on that site can run silent HTTP requests to the Mockoon port.\n\nmermaid\ngraph LR\n subgraph "Victim Web Browser"\n A["Developer Browser"] -- "1. Navigates to" --> B["Malicious Website"]\n B -- "2. Loads exploit script" --> A\n A -- "3. Executes fetch to localhost" --> C["Local Mockoon Port 3000"]\n end\n subgraph "Local Host"\n C -- "4. Administrative actions executed" --> D["Mockoon Service Process"]\n D -- "5. Responds with wildcard CORS" --> A\n end\n A -- "6. Transmits data to C2" --> E["Attacker Server"]\n\n\nBecause the browser sends local requests, and Mockoon responds with Access-Control-Allow-Origin: *, the browser permits the exploit script to read administrative responses. The script can read transaction logs via /mockoon-admin/logs, extracting active session credentials and API keys.\n\nAn attacker can also inject malicious endpoints by issuing a PUT request to /mockoon-admin/environment. This allows them to dynamically reconfigure the mock server to return phishing content or redirect active client calls to malicious endpoints, compromising other development workflows.
The severity score for this vulnerability is 8.8 (High). The primary impact includes complete control over Mockoon's administrative capabilities, allowing attackers to manipulate mock responses and monitor network traffic. This compromise affects developers relying on these mocks for local application validation.\n\nConfidentiality is severely compromised. Since mock servers log standard transactional headers, authentication headers like Bearer tokens, API keys, and cookies are written directly to transaction files. Attackers can exfiltrate these files through the log endpoint, gaining access to production credentials used by clients during testing.\n\nFurthermore, the ability to write arbitrary environment variables provides a path to system compromise. By overwriting process environment variables, an attacker can manipulate application controls or launch arbitrary processes, leading to remote code execution under the privileges of the system user running the Mockoon server.
The primary remediation strategy is upgrading all Mockoon clients and libraries to version 9.7.0 or higher. This update resolves the vulnerability by introducing mandatory administrative authentication and restricting permissive CORS settings. The patch also prevents arbitrary environment variable overrides by implementing prefix restrictions.\n\nIf upgrading is not immediately possible, disable the administrative API. This can be achieved by running the Mockoon CLI with the --disable-admin-api flag, or setting enableAdminApi: false in serverless configuration options. Disabling this API prevents administrative routes from mounting, eliminating the attack surface.\n\nIn addition, ensure that the mock service is configured to bind strictly to the loopback interface (127.0.0.1 or ::1) instead of 0.0.0.0. This step prevents external systems from reaching the ports over the network. Setting up localized firewall rules further restricts inbound communication to these development environments.
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H| Product | Affected Versions | Fixed Version |
|---|---|---|
Mockoon Mockoon | < 9.7.0 | 9.7.0 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-306, CWE-942, CWE-732, CWE-352 |
| Attack Vector | Network (AV:N) |
| CVSS Score | 8.8 (High) |
| EPSS Score | 0.00262 (0.26% probability) |
| Impact | Remote Code Execution / Environment Pollution / Credential Exfiltration |
| Exploit Status | Proof of Concept |
| KEV Status | Not Listed |
The product does not perform any authentication for a functionality that requires a secure identity or is restricted to a subset of users.
CVE-2026-11746 is a critical vulnerability in Central Dogma Server prior to version 0.84.0, where an embedded ZooKeeper replication secret silently falls back to a publicly known, hard-coded default string ('ch4n63m3'). Remote attackers with access to the replication network can authenticate as legitimate cluster peers, potentially leading to unauthorized data exposure, state manipulation, or complete cluster takeover.
A logical verification flaw in ZITADEL's external JWT Identity Provider validation allows attackers to bypass session expiration checks. If an incoming JWT lacks the 'exp' claim, the system skips validation entirely, creating an indefinitely valid session. This issue has been addressed in versions 3.4.12 and 4.15.2.
CVE-2026-59149 identifies a directory traversal vulnerability in `@mockoon/commons-server`, the backend mock-server library powering the Mockoon application. The flaw occurs in the path containment validation logic used during raw file response generation. An unauthenticated attacker can exploit this weakness to retrieve arbitrary files from sibling directories sharing a common prefix with the designated static base directory.
An improper authentication vulnerability (CWE-287) in ZITADEL's external identity provider handler before version 4.15.3 allows remote attackers to perform complete account takeover. When auto-linking by email is enabled, ZITADEL verifies that the local target account has a verified email address but fails to verify if the external provider confirmed ownership of that same email. Attackers can exploit this by registering an unverified account with a victim's email address on a permissive external provider, leading to unauthorized account binding and persistent access.
A critical authentication bypass and cross-tenant account takeover vulnerability exists in the Prowler cloud security platform due to improper validation of the SAML Assertion Consumer Service (ACS) flow. An authenticated attacker controlling a custom Identity Provider (IdP) can forge assertions targeting arbitrary user identities across distinct tenants, allowing complete unauthorized access to target tenant-scoped resources.
An issue was identified in Central Dogma prior to version 0.84.0. The Git mirror SSH client does not verify remote host keys for git+ssh:// connections, which allows an on-path attacker to execute man-in-the-middle attacks and compromise mirrored repositories.