Summary
Importing connections in MongoDB Compass allows overriding connection options that are normally restricted in the UI, including the browser open command for OIDC authentication.
If an attacker can supply a crafted connection import, they may inject arbitrary commands into the browser launcher flow, turning a configuration import into a local code execution risk.
Affected context
This vulnerability arises in environments where MongoDB Compass users import connection configurations rather than creating them solely through the UI.
The issue is relevant when OIDC-based authentication is used and the application honors a browser open command set in imported configuration data that bypasses normal global settings.
It becomes risky when users import files or snippets from untrusted or loosely validated sources, or when shared configuration bundles circulate within a team or organization.
Exploit preconditions
- Attack surface: Compass connection import functionality that accepts externally provided configuration data.
- Required access: Ability to supply or influence the imported connection definition (e.g., sharing a file, snippet, or template).
- Trigger point: User imports the malicious connection, then initiates an OIDC authentication flow that invokes the browser open command.
- Why exploitation is possible: The imported configuration can override otherwise globally controlled browser launch behavior, allowing injection of arbitrary command strings without equivalent validation or restriction.
Why this happens
The underlying bug stems from treating imported configuration values as trusted and allowing them to override security-sensitive options that are normally constrained by global settings.
In particular, a browser open command used during OIDC authentication is derived from import data without enforcing strict validation, canonicalization, or separation between data and executable instructions.
This aligns with CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where user-controlled input is incorporated into command execution paths without sufficient sanitization or policy enforcement.
Potential impact
- Imported connections could cause arbitrary OS commands to be executed when OIDC login is triggered.
- Attackers may gain local code execution in the context of the Compass user account.
- Users can be tricked into running malicious scripts or tools during routine database connection workflows.
- System integrity and confidentiality may be affected if executed commands read, modify, or exfiltrate local data.
General mitigation guidance
Mitigation efforts typically focus on reducing the trust placed in imported configuration data and separating configuration from command execution.
Secure patterns include:
- Treating all imported connection properties as untrusted and enforcing strict whitelists for any options that influence executable commands.
- Ensuring that browser open behavior is controlled only by hardened global settings that cannot be overridden by per-connection imports.
- Applying robust input validation and escaping for any configuration values that might be incorporated into OS-level command invocations.
- Using indirect, parameterized mechanisms (e.g., safe APIs or URI handlers) instead of shell commands to launch external applications.
- Restricting the ability to define or change command-like options to privileged administrators and not to regular connection imports.
How teams detect issues like this
Effective detection relies on identifying insecure handling of configuration data that flows into command execution APIs.
Typical approaches include:
- Static analysis rules that flag direct concatenation or interpolation of configuration values into shell or process-launch commands.
- Code review practices that scrutinize any logic where imported settings can override global, security-relevant options such as browser or authentication tools.
- Policy-based checks ensuring that only predefined, vetted commands or handlers can be used for OIDC browser launches, regardless of connection-level configuration.
- Use of automated security testing or configuration-linting tools that validate imported connection definitions against a schema that excludes executable fields.

