Summary
A command injection vulnerability in sysPass's file backup service allows a configured backup path to be inserted directly into a shell command without adequate validation or escaping. An administrator, or an attacker holding equivalent administrative access, may trigger arbitrary operating-system commands with the privileges of the web server process.
Affected context
The vulnerability occurs when sysPass constructs a tar backup command using a backup directory path persisted in application configuration. It becomes risky when an attacker can alter that setting through the administrative interface or API and subsequently invoke a backup operation, particularly where the web server account has access to sensitive application files, configuration, or runtime secrets.
Exploit preconditions
- Attack surface: Administrative settings and the backup operation exposed by the sysPass application
- Required access: An administrator account, administrator session, or valid administrative API token; equivalent configuration-database write access may also satisfy this condition
- Trigger point: File backup execution after the configured backup path has been stored
- Why exploitation is possible: The path is concatenated into a shell command and passed to PHP
exec()without shell-argument escaping or sufficiently strict validation
Why this happens
The underlying bug is shell command construction from configuration data that is treated as trusted without enforcing a safe boundary. Passing a concatenated string to a command interpreter allows shell metacharacters in the path value to alter command semantics, which maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command.
Potential impact
- Arbitrary commands may execute as the web server process user
- Sensitive application configuration and runtime data could be read
- The password vault may be exported or decrypted if required secrets are accessible
- Stored credentials could be used to access internal systems
- The sysPass host could be modified to establish persistence
- The application, host, or connected environments could be compromised
General mitigation guidance
Mitigation generally focuses on removing shell interpretation from backup workflows and reducing the trust placed in configurable paths.
Common defensive patterns include:
- Use a process execution API that passes arguments as an array rather than constructing a shell command string
- Apply strict allowlist validation to backup paths and constrain them to approved directories
- Avoid invoking a shell when performing archive operations; use a library or direct system-call interface where practical
- Treat administrative configuration values as untrusted input at command boundaries
- Limit the web server account's filesystem, process, and secret access through least privilege
- Isolate backup storage and protect it with appropriate permissions and access controls
- Reduce exposure of master keys and other sensitive secrets to the web application process where feasible
How teams detect issues like this
Detection approaches may include:
- Static analysis rules that flag string concatenation or interpolation in arguments passed to
exec(), shell wrappers, or process-spawning APIs - Code review checks for missing argument escaping, absent allowlist validation, and configuration values reaching command interpreters
- Runtime monitoring for unexpected child processes launched by the web server account
- Audit logging and alerting for administrative changes to backup paths followed by backup execution
- Policy enforcement requiring argument-vector process APIs or approved archive libraries
- Automated security review tools that identify command-injection patterns in application code

