Summary
A command injection flaw in MariaDB's CONNECT storage engine on Windows allows HTTP table attributes to be interpolated directly into a curl command line without proper sanitization.
When REST support is enabled, a user who can define or modify CONNECT/REST tables may execute arbitrary shell commands on the database server host.
Affected context
The vulnerability arises in MariaDB deployments on Windows that:
- Have the CONNECT storage engine installed and REST support enabled
- Allow users (including potentially low-privileged DB users) to create or alter CONNECT tables using HTTP/REST options
- Construct outbound HTTP requests via curl from within the database server process
In such configurations, untrusted table attributes are incorporated into the underlying command line that curl uses, creating an opportunity for command injection if those attributes are not tightly controlled or validated.
Exploit preconditions
- Attack surface: SQL interface to the MariaDB server on Windows (network-exposed or local).
- Required access: Ability to create, alter, or otherwise control CONNECT tables with REST/HTTP attributes; this may be granted to authenticated database users with specific privileges.
- Trigger point: Execution of a CONNECT table operation (e.g., SELECT, DML, or metadata operations) that causes the server to invoke curl with attacker-controlled attributes.
- Why exploitation is possible: User-supplied HTTP attributes are interpolated into a shell command used to launch curl without robust validation, quoting, or escaping, allowing those attributes to break out of the intended argument context and inject additional OS commands.
Why this happens
This issue is a classic OS Command Injection (CWE-78) vulnerability.
Instead of invoking curl via a safe API that separates executable path and arguments, the implementation constructs a command line string that includes user-controlled HTTP table attributes.
Because this string is passed to the operating system command interpreter on Windows, special characters, meta-sequences, or additional tokens in the attributes can alter the command structure and cause arbitrary commands to run.
The core insecure pattern is treating configuration-like user input as trusted when assembling a shell command, rather than binding it as strictly delimited arguments.
Potential impact
- Execution of arbitrary commands on the Windows host running MariaDB
- Full compromise of the database server, including read/write access to data files
- Use of the database server as a pivot point for lateral movement within the network
- Installation of backdoors, ransomware, or other persistent malware on the host
- Exfiltration or destruction of sensitive data stored in MariaDB or on the underlying system
General mitigation guidance
Effective mitigation focuses on eliminating direct command-line construction and tightening trust boundaries around CONNECT/REST features:
- Prefer library or API-level HTTP clients that avoid invoking the shell, passing user-controlled values as structured arguments rather than concatenated strings.
- Apply strict validation and canonicalization to CONNECT/REST attributes, using allow-lists for expected values and rejecting unexpected characters or patterns.
- Restrict who can use the CONNECT engine and REST features; grant CONNECT-related privileges only to trusted service accounts instead of general users.
- Run the MariaDB service account with least-privilege on Windows so that, if a command is injected, its capabilities are constrained.
- Where possible, disable the CONNECT engine or REST support entirely in environments that do not explicitly require it, reducing unnecessary attack surface.
How teams detect issues like this
Detection should combine code-level analysis with operational monitoring:
- Use static analysis or manual code review to flag any code paths that construct shell commands from user-controlled strings, particularly in storage engine and plugin code.
- Define secure coding guidelines that prohibit shell invocation for network calls when safer APIs are available, and enforce them through pre-commit hooks or CI rules.
- Monitor database activity for suspicious CONNECT/REST table definitions containing unusual characters, command separators, or atypical HTTP attributes.
- Instrument host-level logging on the Windows server to detect unexpected child processes spawned by the MariaDB service, especially recurring curl invocations or command shells.
- Include automated database configuration scanning in security reviews to identify instances where the CONNECT engine and REST support are enabled inappropriately.

