Summary
Manyfold's model render generation feature contained an OS command injection flaw where uploaded filenames were passed into a Ruby backtick (`) call without proper sanitization.
A logged-in user could upload a crafted ZIP archive containing a file whose name included shell metacharacters, leading to remote code execution on the server when renders were generated.
Affected context
This vulnerability occurs in Manyfold deployments that:
- Enable the model render generation feature, and
- Accept user uploads of 3D model archives (e.g., ZIP files), and
- Use server-side processing that invokes shell commands to handle those files.
The risk is present when filenames from user-controlled archives are used to construct shell commands without strict validation or escaping. Only authenticated users with the ability to upload model files can reach this code path.
Exploit preconditions
- Attack surface: HTTP(S) interface of a Manyfold instance with render generation enabled.
- Required access: Authenticated user account with permission to upload 3D model ZIP files.
- Trigger point: Uploading a ZIP containing a file whose name includes shell metacharacters; triggering render generation so the backend processes the file.
- Why exploitation is possible: The filename from the archive is propagated to a Ruby backtick (
`) command execution context without proper escaping or neutralization, allowing shell syntax in the filename to be interpreted as part of the command.
Why this happens
The core issue is the construction of shell commands using untrusted data—specifically, filenames extracted from user-uploaded ZIP archives—and executing them via Ruby backticks.
This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where data that should be treated purely as text is instead parsed by the shell as executable syntax.
Rather than invoking lower-level APIs with explicit argument arrays or using safe library abstractions for handling 3D model processing, the application relied on shell command composition, allowing metacharacters in filenames to alter command behavior at runtime.
Potential impact
- Execution of arbitrary OS commands under the Manyfold server's operating system account.
- Reading, modification, or deletion of data accessible to the application process.
- Pivoting to other systems or services reachable from the affected host.
- Installation of backdoors, cryptominers, or other persistent malware.
- Complete compromise of the Manyfold instance's confidentiality, integrity, and availability.
General mitigation guidance
Mitigation focuses on eliminating unsafe shell command construction and reducing the trust placed in user-controlled data:
- Avoid using shell-evaluating constructs (e.g., Ruby backticks,
systemwith single-string commands) for user-influenced operations; prefer APIs that accept argument arrays (e.g.,Open3.capture3(cmd, *args)or equivalent) which bypass the shell. - Treat filenames and paths as data, not as part of command strings; pass them as separate arguments to process execution functions where possible.
- Enforce strict validation and normalization of uploaded filenames, rejecting or rewriting names containing shell metacharacters, control characters, or unexpected encodings.
- Apply a strong allowlist for acceptable characters in filenames (e.g., alphanumerics, underscores, hyphens, and periods) and normalize directory paths to avoid traversal or injection concerns.
- Run the render generation and file processing components under a dedicated, least-privileged OS user with minimal filesystem and network permissions to limit blast radius.
- Consider isolating rendering logic into sandboxed workers or containers constrained by mandatory access controls (e.g., seccomp, AppArmor, SELinux) to reduce the impact of any injection that slips through.
How teams detect issues like this
Detection typically involves a combination of code-centric and operational monitoring approaches:
- Static analysis: Configure SAST tools or custom rules to flag:
- Ruby backtick (
`) usage,system,exec,Open3.popen*, and similar APIs when called with dynamically constructed command strings. - Interpolation of user-controlled variables (e.g., parameters derived from uploads, request data, or database fields) into shell command strings.
- Code review signals: During manual review, pay attention to:
- Any place filenames, archive entries, or user-controlled paths are concatenated into command strings.
- Lack of canonicalization and character validation on uploaded filenames.
- Absence of argument-array process execution patterns in favor of generic shell invocation.
- Runtime monitoring:
- Collect and inspect process execution logs (e.g., from auditd or equivalent) for unusual command lines involving upload directories or temporary file paths.
- Set up alerting for unexpected shell or interpreter invocations spawned by the application process.
- Policy enforcement: Use pre-commit hooks, CI checks, or organizational coding standards that:
- Prohibit direct shell invocation with untrusted data.
- Enforce use of safer execution libraries and patterns for all file processing and rendering tasks.

