Skip to content

Authenticated remote code execution through MariaDB client commands in backup restore

High
snipe published GHSA-x53f-48vj-c5fc Aug 24, 2026

Package

No package listed

Affected versions

< 8.7.0

Patched versions

8.7.0

Description

Snipe-IT versions prior to 8.7.0 streamed the SQL entry from an uploaded backup archive directly into the MySQL / MariaDB command-line client without the --binary-mode flag. The client interprets lines beginning with \! as local shell commands to execute on the host. A superadministrator restoring a crafted backup could achieve remote code execution as the web application's operating-system user.

Impact

A superadministrator can execute arbitrary shell commands as the Snipe-IT web-service account. On the official Docker image, this ran as uid=10000(docker) in the reporter's proof. Typical consequences:

  • Read of application secrets, including database credentials and APP_KEY
  • Read and write of Snipe-IT data and persistent storage
  • Modification of application-writable files
  • Potential container escape depending on the deployment's mounts and privileges

The chain requires an authenticated superadministrator session. Where a separate authentication or privilege-escalation vulnerability grants superadministrator access, the combined chain warrants a higher score than this standalone finding.

Vector

  1. Attacker signs in as a superadministrator.
  2. Attacker crafts a ZIP backup whose .sql entry begins with a MariaDB client command such as \! /usr/bin/id > /tmp/marker.
  3. Attacker uploads the archive via POST /admin/backups/upload.
  4. Attacker triggers the restore via POST /admin/backups/restore/{filename} without the clean form parameter. DB_SANITIZE_BY_DEFAULT is false by default, so the sanitizer is not applied on the default restore path.
  5. snipeit:restore opens proc_open on the mysql binary and pipes the SQL bytes into stdin. Without --binary-mode, the client interprets \! COMMAND as "run COMMAND on the host as this process's OS user". The command executes with the web application's privileges.

Preconditions:

  • Attacker is authenticated as a Snipe-IT superadministrator
  • Backup upload and restore are enabled (default when APP_LOCKED=false)
  • The deployment uses the supported MySQL / MariaDB restore path with the mysql client installed (the official Docker image satisfies this)
  • The clean sanitizer parameter is not applied (default)

Affected versions

< 8.7.0

Patched versions

8.7.0

Fix

Commit f511ce490951bf8e09cd4bd62ab8d72f3e4457e0 ("Refactor import code, improve error messaging, speed up MySQL import") added the --binary-mode flag to the mysql client invocation in app/Console/Commands/RestoreFromBackup.php. Per the MySQL / MariaDB documentation, --binary-mode disables the client's local-command interpretation of \!, \., system, source, and equivalent backslash commands in non-interactive input, closing the specific execution primitive this finding exploits.

The reporter also suggested layered hardening beyond the specific --binary-mode fix:

  • Server-side always-sanitize as the default posture rather than the current opt-in checkbox controlled by DB_SANITIZE_BY_DEFAULT
  • Explicit rejection of \!, system, source, and other client-command lines before the SQL stream reaches the CLI, accounting for whitespace and buffer boundaries
  • Argv-array proc_open invocation rather than a shell command string
  • Minimal filesystem and container permissions on the app service account

The --binary-mode flag closes the specific execution path used in this finding. The layered hardening above is tracked separately as follow-up work.

Severity

CVSS v3.1: 7.2 High (AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H)

Weakness

CWE-78: Improper Neutralization of Special Elements Used in an OS Command (OS Command Injection)

Credit

Submersion.ai Security Research Team

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
High
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H

CVE ID

No known CVE

Weaknesses

Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')

The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component. Learn more on MITRE.

Credits