Summary
Snipe-IT passes SQL content from an uploaded backup archive to the MySQL or MariaDB command-line client without binary-safe handling, allowing backslash commands to be interpreted as local shell commands. An authenticated superadministrator who uploads a crafted backup and restores it without effective sanitization may execute operating-system commands as the web application's user.
Affected context
The vulnerability occurs in Snipe-IT backup restoration workflows where uploaded ZIP archives contain SQL data that is streamed directly into the database command-line client. Risk is higher when an authenticated superadministrator can upload and restore backups, the client is invoked without binary-mode protection, and sanitization is not enabled by default or is otherwise bypassed.
Exploit preconditions
- Attack surface: Authenticated Snipe-IT backup upload and restore functionality
- Required access: Superadministrator privileges sufficient to upload a backup and initiate its restoration
- Trigger point: Processing the SQL entry from a crafted backup during database restoration
- Configuration condition: The restore proceeds without the optional sanitization behavior being applied
- Why exploitation is possible: The database client interprets certain backslash-prefixed input as client commands, including commands that invoke the local shell
Why this happens
The underlying bug is a failure to treat imported SQL as strictly data when passing it to an interactive database client. Without binary-mode or equivalent non-interactive safeguards, client metacommands embedded in the input can be interpreted and executed by the operating-system process running the client. This behavior maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, because attacker-controlled content crosses a command-processing boundary without adequate neutralization or isolation.
Potential impact
- An attacker may execute arbitrary operating-system commands as the web application's user.
- Application secrets, database credentials, and signing keys could be exposed.
- Application-writable files or stored data could be modified.
- The application could be further compromised through credential theft or persistence.
- Data integrity and availability could be affected.
General mitigation guidance
Mitigation generally focuses on ensuring that imported SQL is processed by a database interface that cannot interpret client-side shell metacommands.
Common defensive patterns include:
- Use binary-safe, non-interactive database client invocation or a library-based import path that treats input strictly as SQL data.
- Apply sanitization and schema validation before any restore operation, with secure behavior enabled by default.
- Restrict backup upload and restore capabilities to narrowly scoped administrative roles.
- Store uploaded archives outside executable or application-writable paths where practical.
- Run the web application and restore process with least-privilege operating-system and database accounts.
- Protect application secrets, limit their exposure, and rotate them when unauthorized command execution is suspected.
- Add audit logging, approval controls, and size or content limits around backup restoration.
How teams detect issues like this
Detection approaches can include:
- Static analysis rules identifying database client invocations that consume attacker-controlled files or streams without binary-safe options.
- Code review checks for shell-sensitive parsing, interactive client metacommands, and restore paths that process uploads before validation.
- Policy enforcement requiring strict backup schemas, default sanitization, and restricted administrative operations.
- Runtime monitoring for unexpected child processes, shell launches, or filesystem changes by the web application account during restore activity.
- Audit review of backup upload and restore events, particularly those performed by privileged accounts.
Automated code review and software composition analysis tools may help identify unsafe command-boundary patterns during development.

