Summary
Aperi'Solve contained a command injection flaw where a user-supplied JPEG password was passed directly into an expect script and then into bash -c without any sanitization.
An unauthenticated attacker could send a single crafted HTTP request to achieve root-level remote code execution inside the worker container, potentially accessing all uploaded files, stored passwords, and backend services on the same Docker network.
Affected context
This vulnerability arises in the JPEG upload functionality of the Aperi'Solve steganalysis web platform when an optional password is provided with the image.
The application constructs and executes an expect command that embeds this password, which is then executed via bash -c inside a worker container.
In environments where the worker container has network access to PostgreSQL and Redis, and especially where Docker socket or host volumes are mounted, the blast radius can extend beyond the container itself.
Exploit preconditions
- Attack surface: Public HTTP endpoint handling JPEG uploads with optional passwords.
- Required access: None; the issue is exploitable by unauthenticated users over the network.
- Trigger point: Submission of a JPEG upload request that includes a crafted password value.
- Why exploitation is possible: The password parameter is interpolated into an
expectcommand and then intobash -cwithout quoting, sanitization, or validation, allowing arbitrary shell metacharacters and commands to be injected.
Why this happens
The core flaw is direct concatenation of untrusted user input into a shell command string, which is then executed via bash -c.
This matches CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the application treats external input as part of executable shell syntax.
By embedding the user-provided password into an expect command line without strict quoting or argument separation, the system allows attackers to break out of the intended command context and inject arbitrary commands executed with the privileges of the worker process (root in this case).
Potential impact
- Remote execution of arbitrary commands as root inside the worker container.
- Full read/write access to all user-uploaded images and analysis outputs stored on the worker filesystem.
- Exposure of plaintext steganography passwords and other sensitive artifacts stored on disk.
- Unauthorized access to PostgreSQL and Redis instances on the shared Docker network, including database dumping or manipulation of analysis job queues.
- Data tampering or poisoning of analysis results displayed to other users.
- Defacement of the Aperi'Solve web interface and manipulation of application behavior.
- Potential escalation to host-level compromise if Docker socket or host volume mounts are accessible from the container.
General mitigation guidance
Effective mitigation focuses on eliminating direct shell interpretation of user-controlled values and reducing the privileges and reach of the execution environment.
Recommended defensive patterns include:
- Avoid building shell command strings from user input; instead, use high-level language APIs or libraries that invoke tools via parameterized system calls without invoking a shell.
- If external tools must be called, construct argument lists as arrays and pass them directly to process-spawning functions that bypass
bash -c. - Enforce strict validation and canonicalization of input fields like passwords, including length limits and character whitelisting, especially when they influence tooling behavior.
- Apply least-privilege principles for worker containers: run processes as non-root where possible, limit filesystem access, and ensure that sensitive sockets (like the Docker daemon) and host volumes are not mounted by default.
- Segment the network so worker containers have only the minimal access necessary to backend services, and require authentication for internal data stores such as PostgreSQL and Redis.
- Design the platform so that compromise of a single worker has minimized impact on the control plane, database, and other users' data.
How teams detect issues like this
Organizations can approach detection of similar command injection risks and active exploitation through multiple layers:
- Static analysis and code scanning:
- Flag use of
bash -c,system,popen, or language-specific wrappers that build shell commands using string concatenation with user-controlled variables. - Define rules that look for patterns where HTTP parameters, form fields, or other external inputs are passed into OS command execution APIs, especially in job workers or background processors.
- Code review practices:
- During review, require explicit justification and scrutiny for any use of shell commands,
expectscripts, or command interpreters, with attention to quoting and argument separation. - Use checklists that call out OS command execution and inter-process scripting as high-risk areas needing security review.
- Runtime monitoring and logging:
- Log command-line invocations from worker containers and monitor for unusual arguments or patterns inconsistent with normal usage.
- Employ container runtime security tools or EDR agents that can alert on suspicious process creation, lateral network connections to internal databases, and unexpected filesystem writes.
- Policy and CI/CD controls:
- Integrate security linters or SAST tools into CI pipelines to block new code that introduces unsafe command construction patterns.
- Define infrastructure policies that prevent mounting the Docker socket or sensitive host directories into application containers unless explicitly justified and reviewed.

